wiki commit

This commit is contained in:
1HXb9KMAtwNJqz4egi6hJx08EQgJajiBTH
2020-01-02 11:01:32 -05:00
committed by buwiki
parent 9a775b4291
commit 621be6eb86
2 changed files with 34 additions and 6 deletions
@@ -11,9 +11,9 @@ Standard transactions are those that:
- Have a valid version number (currently only version 2 is valid)
- Have input scripts that only contain push operations
- Have input scripts with unlocking scripts below the 1650 byte maximum
- Have at most one data (OP_RETURN) output
- Have at most one [data output](/protocol/blockchain/transaction/locking-script#Data%20Output)
- Have non-data outputs with amount above the [dust](#dust) threshold
Be aware, however, that these rules may vary from node-to-node as they are often configurable. Some nodes may also accept and relay non-standard transactions. For this reason, among others, it is always wise to send transactions to many nodes.
Be aware, however, that these rules may vary from node-to-node as they are often configurable. Some nodes may also accept and relay non-standard transactions. For this reason, among others, it is always wise to send transactions to multiple nodes.
### Dust
@@ -19,7 +19,7 @@ If the signature is valid for the specified public key in the locking script, th
| Operation | Description |
|--|--|
| [push data](/protocol/blockchain/script/opcodes/push-data) (public key) | Add the recipient's public key to the stack. The data pushed must be either a compressed or uncompressed public key with appropriate length for the type for the script to be recognized as P2PK. |
| [OP_DATA_X](/protocol/blockchain/script/op-codes/op-data-x) (public key) | Add the recipient's public key to the stack. The data pushed must be either a compressed or uncompressed public key with appropriate length for the type for the script to be recognized as P2PK. |
| [OP_CHECKSIG](/protocol/blockchain/script/opcodes/op-checksig) | Check the public key at the top of the stack against the signature below it on the stack. |
<img src="/_static_/images/warning.png" /> **NOTE:** Pay to Public Key is a largely obsolete type of locking script due to its property of leaking the public key of the recipient before the output is unlocked, resulting in:
@@ -40,7 +40,7 @@ If that public key hashes to the expected address, and the signature is valid, t
|--|--|
| [OP_DUP](/protocol/blockchain/script/opcodes/op-dup) | Copy the value at the top of the stack (public key of the recipient). |
| [OP_HASH160](/protocol/blockchain/script/opcodes/op-hash160) | Perform a SHA-256 then a RIPEMD-160 on the copied value. |
| [push data](/protocol/blockchain/script/opcodes/push-data) (20 bytes) | Push the expected 20 byte address. |
| [OP_DATA_X](/protocol/blockchain/script/op-codes/op-data-x) (20 bytes) | Push the expected 20 byte address. |
| [OP_EQUALVERIFY](/protocol/blockchain/script/opcodes/op-equalverify) | Verify that the hash of the copied value matches the expected hash that was pushed. |
| [OP_CHECKSIG](/protocol/blockchain/script/opcodes/op-checksig) | Verify that the stack now contains only a public key (which was duplicated, hashed, and checked against the expected value) and a signature and verify that the signature is valid for that public key. |
@@ -54,7 +54,7 @@ If this redeem script finishes execution successfully, the output is allowed to
| Operation | Description |
|--|--|
| [OP_HASH160](/protocol/blockchain/script/opcodes/op-hash160) | Hash the data at the top of the stack, this should be the script to be executed. |
| [push data](/protocol/blockchain/script/opcodes/push-data) (20 bytes) | Push the expected redeem script hash. |
| [OP_DATA_X](/protocol/blockchain/script/op-codes/op-data-x) (20 bytes) | Push the expected redeem script hash. |
| [OP_EQUAL](/protocol/blockchain/script/opcodes/op-equal) | Verify that the hash of the provided script is equal to the expected hash. |
Due to the nature of this type of locking script, the following steps must be performed by a node executing this script:
@@ -82,4 +82,32 @@ For non-trivial scripts, this will make the UTXO set smaller, since the locking
4. Privacy: P2SH does not reveal the script contents until it is spent.
One drawback of this is that it is not possible to determine whether certain instructions are in use or not.
This makes retirement of opcodes impossible.
However, it's also possible for people to create transactions and not commit them to the blockchain, so the viability of opcode retirement is questionable anyway.
However, it's also possible for people to create transactions and not commit them to the blockchain, so the viability of opcode retirement is questionable anyway.
### Multisig Script
Multiple-signature, or multisig, scripts provide a mechanism to have multiple private keys coordinate with spending funds.
For example, three people could share funds and require that for some transactions any one of them could spend it while, for others, two of them would need to agree, and for others still, all three people would need to agree to spend the funds.
Each party's public key is included in the locking script along with the required number of signatures (i.e. from above, 1, 2, and 3, respectively).
An unlocking script is therefore expected to provide the required number of signatures which are then checked against the list of public keys. If a sufficient number of valid signatures are provided, the output is allowed to be spent.
| Operation | Description |
|--|--|
| [OP_X](/protocol/blockchain/script/op-codes/op-x) | Push the number of parties required to provide signatures. |
| 2 or more [OP_DATA_X](/protocol/blockchain/script/op-codes/op-data-x) (public key) | Push 2 or more public keys, indicating all of the parties that could provide signatures. |
| [OP_X](/protocol/blockchain/script/op-codes/op-x) | The total number of parties added (i.e. the number of public keys pushed). |
| [OP_CHECKMULTISIG](/protocol/blockchain/script/op-codes/op-checkmultisig) | Check for signatures matching the number of required parties, verify that they correspond to permitted public keys, and that the signatures are valid. |
NOTE: due to a historical bug, the locking script must push an additional value before the signatures. Traditionally this is done via [OP_0](/protocol/blockchain/script/op-codes/op-x). The value is not used but is popped off of the stack by the OP_CHECKMULTISIG at the end of the locking script.
### Data Output
Data Output scripts are used to create outputs that are not spendable but instead are used purely to add data to a transaction.
They are made provably unspendable by immediately failing script execution.
As such, outputs locked with data scripts generally have zero satoshis associated with them.
| Operation | Description |
|--|--|
| [OP_RETURN](/protocol/blockchain/script/opcodes/op-return) | Fail execution immediately. |
| Data | Any additional data is not executed and thus can be whatever data is desired by the script creator. |