mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2025-01-23 22:21:35 +00:00
Made changes to ch05.asciidoc
This commit is contained in:
parent
bbc922ea61
commit
ac51089cd1
@ -327,7 +327,7 @@ The validation software combines the locking and unlocking scripts and the resul
|
||||
2 3 OP_ADD 5 OP_EQUAL
|
||||
----
|
||||
|
||||
As we saw in the step-by-step example in Figure 5-2, when this script is executed the result is +OP_TRUE+, making the transaction valid. Not only is this a valid transaction output locking script, but the resulting UTXO could be spent by anyone with the arithmetic skills to know that the number 2 satisfies the script.
|
||||
As we saw in the step-by-step example in <<simplemath_script>>, when this script is executed the result is +OP_TRUE+, making the transaction valid. Not only is this a valid transaction output locking script, but the resulting UTXO could be spent by anyone with the arithmetic skills to know that the number 2 satisfies the script.
|
||||
|
||||
[TIP]
|
||||
====
|
||||
@ -336,7 +336,7 @@ Transactions are valid if the top result on the stack is TRUE (noted as +{0x01}+
|
||||
|
||||
==== Turing Incompleteness
|
||||
|
||||
The bitcoin transaction script language contains many operators but is deliberately limited in one important way -- there are no loops or complex flow control capabilities other than conditional flow control. This ensures that the language is not Turing Complete, meaning that scripts have limited complexity and predictable execution times. Script is not a general-purpose language. These limitations ensure that the language cannot be used to create an infinite loop or other form of "logic bomb" that could be embedded in a transaction in a way that causes a Denial-of-Service attack against the bitcoin network. Remember, every transaction is validated by every full node on the bitcoin network. A limited language prevents the transaction validation mechanism from being used as a vulnerability.
|
||||
The bitcoin transaction script language contains many operators, but is deliberately limited in one important way—there are no loops or complex flow control capabilities other than conditional flow control. This ensures that the language is not _Turing Complete_, meaning that scripts have limited complexity and predictable execution times. Script is not a general-purpose language. These limitations ensure that the language cannot be used to create an infinite loop or other form of "logic bomb" that could be embedded in a transaction in a way that causes a Denial-of-Service attack against the bitcoin network. Remember, every transaction is validated by every full node on the bitcoin network. A limited language prevents the transaction validation mechanism from being used as a vulnerability.
|
||||
|
||||
==== Stateless Verification
|
||||
|
||||
@ -345,11 +345,11 @@ The bitcoin transaction script language is stateless, in that there is no state
|
||||
[[std_tx]]
|
||||
=== Standard Transactions
|
||||
|
||||
In the first few years of bitcoin's development, the developers introduced some limitations in the types of scripts that could be processed by the reference client. These limitations are encoded in a function called +isStandard()+ which defines five types of "standard" transactions. These limitations are temporary and may be lifted by the time you read this. Until then, the five standard types of transaction scripts are the only ones that will be accepted by the reference client and most miners who run the reference client. While it is possible to create a non-standard transaction containing a script that is not one of the standard types, you must find a miner who does not follow these limitations, to mine that transaction into a block.
|
||||
In the first few years of bitcoin's development, the developers introduced some limitations in the types of scripts that could be processed by the reference client. These limitations are encoded in a function called +isStandard()+, which defines five types of "standard" transactions. These limitations are temporary and may be lifted by the time you read this. Until then, the five standard types of transaction scripts are the only ones that will be accepted by the reference client and most miners who run the reference client. Although it is possible to create a nonstandard transaction containing a script that is not one of the standard types, you must find a miner who does not follow these limitations, to mine that transaction into a block.
|
||||
|
||||
Check the source code of the bitcoin core client (the reference implementation) to see what is currently allowed as a valid transaction script.
|
||||
Check the source code of the Bitcoin Core client (the reference implementation) to see what is currently allowed as a valid transaction script.
|
||||
|
||||
The five standard types of transaction scripts are Pay-to-Public-Key-Hash (P2PKH), Public-Key, Multi-Signature (limited to 15 keys), Pay-to-Script-Hash (P2SH) and Data Output (OP_RETURN), which are described in more detail below.
|
||||
The five standard types of transaction scripts are Pay-to-Public-Key-Hash (P2PKH), Public-Key, Multi-Signature (limited to 15 keys), Pay-to-Script-Hash (P2SH), and Data Output (OP_RETURN), which are described in more detail in the following sections.
|
||||
|
||||
[[p2pkh]]
|
||||
==== Pay to Public Key Hash (P2PKH)
|
||||
|
Loading…
Reference in New Issue
Block a user