Merge pull request #540 from Quuxplusone/op-tuck

Bunch of random errata
pull/656/head
Will Binns 5 years ago committed by GitHub
commit 22a5950abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,7 +58,7 @@ Creating and signing a transaction from an UTXO:
----
> utxo = {
txId: transaction id containing an unspent output,
outputIndex: output indexi e.g. 0,
outputIndex: output index e.g. 0,
address: addressOfUtxo,
script: bitcore.Script.buildPublicKeyHashOut(addressOfUtxo).toString(),
satoshis: amount sent to the address

@ -15,12 +15,12 @@ Tables and descriptions sourced from https://en.bitcoin.it/wiki/Script[].
|=======
| Symbol | Value (hex) | Description
| OP_0 or OP_FALSE | 0x00 | An empty array is pushed onto the stack
| 1-75 | 0x01-0x4b | Push the next N bytes onto the stack, where N is 1 to 75 bytes
| 1 to 75 | 0x01 to 0x4b | Push the next N bytes onto the stack, where N is 1 to 75 bytes
| OP_PUSHDATA1 | 0x4c | The next script byte contains N, push the following N bytes onto the stack
| OP_PUSHDATA2 | 0x4d | The next two script bytes contain N, push the following N bytes onto the stack
| OP_PUSHDATA4 | 0x4e | The next four script bytes contain N, push the following N bytes onto the stack
| OP_1NEGATE | 0x4f | Push the value "1" onto the stack
| OP_RESERVED | 0x50 | Halt - Invalid transaction unless found in an unexecuted OP_IF clause
| OP_RESERVED | 0x50 | Halt—Invalid transaction unless found in an unexecuted OP_IF clause
| OP_1 or OP_TRUE| 0x51 | Push the value "1" onto the stack
| OP_2 to OP_16 | 0x52 to 0x60 | For OP_N, push the value "N" onto the stack, e.g., OP_2 pushes "2"
|=======
@ -81,7 +81,7 @@ Tables and descriptions sourced from https://en.bitcoin.it/wiki/Script[].
| OP_ROLL | 0x7a | Pop value N from top, then move the Nth item to the top of the stack
| OP_ROT | 0x7b | Rotate the top three items in the stack
| OP_SWAP | 0x7c | Swap the top two items on the stack
| OP_TUCK | 0x7d | Copy the top item and insert it between the top and second item.
| OP_TUCK | 0x7d | Copy the top item and insert it between the top and second item
|=======
<<tx_script_ops_table_splice>> shows string operators.
@ -111,8 +111,8 @@ Tables and descriptions sourced from https://en.bitcoin.it/wiki/Script[].
| _OP_XOR_ | 0x86 | Disabled (Boolean XOR of two top items)
| OP_EQUAL | 0x87 | Push TRUE (1) if top two items are exactly equal, push FALSE (0) otherwise
| OP_EQUALVERIFY | 0x88 | Same as OP_EQUAL, but run OP_VERIFY after to halt if not TRUE
| OP_RESERVED1 | 0x89 | Halt - Invalid transaction unless found in an unexecuted OP_IF clause
| OP_RESERVED2 | 0x8a | Halt - Invalid transaction unless found in an unexecuted OP_IF clause
| OP_RESERVED1 | 0x89 | Halt&#x2014;Invalid transaction unless found in an unexecuted OP_IF clause
| OP_RESERVED2 | 0x8a | Halt&#x2014;Invalid transaction unless found in an unexecuted OP_IF clause
|=======
[role="pagebreak-before"]
@ -133,11 +133,11 @@ Tables and descriptions sourced from https://en.bitcoin.it/wiki/Script[].
| OP_0NOTEQUAL | 0x92 | If top item is 0 return 0, otherwise return 1
| OP_ADD | 0x93 | Pop top two items, add them and push result
| OP_SUB | 0x94 | Pop top two items, subtract first from second, push result
| OP_MUL | 0x95 | Disabled (multiply top two items)
| OP_DIV | 0x96 | Disabled (divide second item by first item)
| OP_MOD | 0x97 | Disabled (remainder divide second item by first item)
| OP_LSHIFT | 0x98 | Disabled (shift second item left by first item number of bits)
| OP_RSHIFT | 0x99 | Disabled (shift second item right by first item number of bits)
| _OP_MUL_ | 0x95 | Disabled (multiply top two items)
| _OP_DIV_ | 0x96 | Disabled (divide second item by first item)
| _OP_MOD_ | 0x97 | Disabled (remainder divide second item by first item)
| _OP_LSHIFT_ | 0x98 | Disabled (shift second item left by first item number of bits)
| _OP_RSHIFT_ | 0x99 | Disabled (shift second item right by first item number of bits)
| OP_BOOLAND | 0x9a | Boolean AND of top two items
| OP_BOOLOR | 0x9b | Boolean OR of top two items
| OP_NUMEQUAL | 0x9c | Return TRUE if top two items are equal numbers
@ -179,7 +179,7 @@ Tables and descriptions sourced from https://en.bitcoin.it/wiki/Script[].
[options="header"]
|=======
| Symbol | Value (hex) | Description
| OP_NOP1-OP_NOP10 | 0xb0-0xb9 | Does nothing, ignored
| OP_NOP1 to OP_NOP10 | 0xb0 to 0xb9 | Does nothing, ignored
|=======

@ -710,7 +710,7 @@ With Segregated Witness, Alice would create a Pay-to-Witness-Public-Key-Hash (P2
0 ab68025513c3dbd2f7b92a94e0581f5d50f654e7
----
As you can see, a Segregated Witness outputs locking script is much simpler than a traditional output. It consists of two values that are pushed on to the script evaluation stack. To an old (nonsegwit-aware) bitcoin client, the two pushes would look like an output that anyone can spend and does not require a signature (or rather, can be spent with an empty signature). To a newer, segwit-aware client, the first number (0) is interpreted as a version number (the _witness version_) and the second part (20 bytes) is the equivalent of a locking script known as a _witness program_. The 20-byte witness program is simply the hash of the public key, as in a P2PKH script
As you can see, a Segregated Witness outputs locking script is much simpler than a traditional output. It consists of two values that are pushed on to the script evaluation stack. To an old (nonsegwit-aware) bitcoin client, the two pushes would look like an output that anyone can spend and does not require a signature (or rather, can be spent with an empty signature). To a newer, segwit-aware client, the first number (0) is interpreted as a version number (the _witness version_) and the second part (20 bytes) is the equivalent of a locking script known as a _witness program_. The 20-byte witness program is simply the hash of the public key, as in a P2PKH script.
Now, lets look at the corresponding transaction that Bob uses to spend this output. For the original script (nonsegwit), Bobs transaction would have to include a signature within the transaction input:

Loading…
Cancel
Save