In this section, we introduce the main Bitcoin specific data types.

A Merkle tree of depth 3, accumulating eight elements U,... ,U

Figure 3.1 A Merkle tree of depth 3, accumulating eight elements U0,... ,U7.


Bitcoin introduced a custom non-Turing complete scripting language in an attempt to support different types of transactions and extend the applicability of transactions beyond the simple transfer of funds. Scripts are stack-based, support a number of functions (commonly referred to as opcodes), and either evaluate to true or false. The language supports dozens of different opcodes ranging from simple comparison opcodes to cryptographic hash functions and signature verification. Since scripts are supposed to be executed on any Bitcoin node, they could be abused to conduct denial-of-service attacks and therefore, a considerable number of opcodes have been temporarily disabled. This was one of the main reasons why scripts do not provide rich support when compared to standard programming languages.

An example script program OPXHECK- SIG contains two constants (denoted by <...>) and one opcode (execution goes from the left to the right). Constants are pushed by default onto the stack, and upon execution, the stack would therefore contain . The next step is to execute OP_CHECKSIG, which verifies the under the provided . If the signature matches the provided public key, OP-CHECKSIG returns true, and in return, the script outputs true. Otherwise, the script will output false.

< Prev   CONTENTS   Source   Next >