From a881c1da9e5d14680b7030ec1a91cf2490c2cb10 Mon Sep 17 00:00:00 2001 From: 1HXb9KMAtwNJqz4egi6hJx08EQgJajiBTH <1HXb9KMAtwNJqz4egi6hJx08EQgJajiBTH@reference.cash> Date: Wed, 18 Dec 2019 13:08:17 -0500 Subject: [PATCH] wiki commit --- protocol/blockchain/transaction/locking-script.md | 6 +++--- .../blockchain/transaction/unlocking-script.md | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/protocol/blockchain/transaction/locking-script.md b/protocol/blockchain/transaction/locking-script.md index 68e0c6f..64c5c31 100644 --- a/protocol/blockchain/transaction/locking-script.md +++ b/protocol/blockchain/transaction/locking-script.md @@ -6,7 +6,7 @@ A locking script is a [Script](/protocol/blockchain/script) that is used dictate ### Pay to Public Key (P2PK) -The P2PK locking script expects the unlocking script to push a signature to the stack. If the signature is valid for the specified public key in the locking script, the script is valid. +The P2PK locking script expects the unlocking script to push a signature to the stack. If the signature is valid for the specified public key in the locking script, the output is allowed to be spent. | Operation | Description | |--|--| @@ -21,7 +21,7 @@ The P2PK locking script expects the unlocking script to push a signature to the ### Pay to Public Key Hash (P2PKH) -Pay to Public Key Hash is a widely used standard locking script format, that works similarly to P2PK but instead of pushing the public key, it pushes a hash of the public key, commonly referred to as an address. This heavily reduces the risks associated with a plain P2PK script as the hashing algorithms used provide a considerable barrier to determining the public key a priori. To spend an output locked with this type of script, the unlocking script is expected to push a signature and then the public key corresponding to the private key that created the signature. If that public key hashes to the expected address, and the signature is valid, the funds are allowed to be transferred. +Pay to Public Key Hash is a widely used standard locking script format, that works similarly to P2PK but instead of pushing the public key, it pushes a hash of the public key, commonly referred to as an address. This heavily reduces the risks associated with a plain P2PK script as the hashing algorithms used provide a considerable barrier to determining the public key a priori. To spend an output locked with this type of script, the unlocking script is expected to push a signature and then the public key corresponding to the private key that created the signature. If that public key hashes to the expected address, and the signature is valid, the output is allowed to be spent. | Operation | Description | |--|--| @@ -33,7 +33,7 @@ Pay to Public Key Hash is a widely used standard locking script format, that wor ### Pay to Script Hash (P2SH) -Pay to Script Hash is used to require the spender of an output to include a specific set of operations in their unlocking script. To achieve this, the unlocking script is expected to end by pushing data to the stack that is the expected script to be executed. Once this data is verified to match the expected script hash, this internal script is executed on the pre-locking-script-execution stack. If this internal script finishes execution successfully, the funds are allowed to be transferred. +Pay to Script Hash is used to require the spender of an output to include a specific set of operations in their unlocking script. To achieve this, the unlocking script is expected to end by pushing data to the stack that is the expected script to be executed. Once this data is verified to match the expected script hash, this internal script is executed on the pre-locking-script-execution stack. If this internal script finishes execution successfully, the output is allowed to be spent. | Operation | Description | |--|--| diff --git a/protocol/blockchain/transaction/unlocking-script.md b/protocol/blockchain/transaction/unlocking-script.md index 0a55769..3cb91e3 100644 --- a/protocol/blockchain/transaction/unlocking-script.md +++ b/protocol/blockchain/transaction/unlocking-script.md @@ -2,4 +2,17 @@ An unlocking script is a [Script](/protocol/blockchain/script) that is used to prove that a transaction is permitted to spend a given UTXO. This is accomplished by first executing the unlocking script and then executing the locking script for the UTXO referenced by the transaction input. If this execution triggers no failures and leaves a single non-zero (TRUE) value on the stack, the UTXO has been successfully unlocked. One way to look at this is that the unlocking script provides an initial state that acts as an inverse to the previously published locking script. For more information about how script execution works, see [Script](/protocol/blockchain/script). -## Standard Scripts \ No newline at end of file +## Standard Scripts + +While unlocking scripts are generally not restricted in their format, they are often de facto restricted due to the fact that they must create a stack state that allows the locking scripts to complete execution successfully. For the standard locking scripts that correspond to the below examples, see [Locking Script](/protocol/blockchain/transaction/locking-script). + +### Pay to Public Key + + + +### Pay to Public Key Hash + + + +### Pay to Script Hash +