concept program in category bitcoin

appears as: program, programs, program, The program
Grokking Bitcoin

This is an excerpt from Manning's book Grokking Bitcoin.

I haven’t been totally honest about what a transaction contains. A transaction’s output doesn’t contain a PKH, but part of a small computer program that contains a PKH. This part of the program is called a pubkey script. The input that spends the output contains the other part of this program. This other part, the signature and the public key in John’s transaction, is called a signature script (figure 5.11).

Figure 5.11. The signature script is the first part of a program. The pubkey script in the spent output is the second part. If the complete program results in OK, then the payment is authorized to spend the output.

This tiny program, written in a programming language called Script, contains the instructions to Lisa on how to verify that the spending transaction is authentic. If Lisa performs all the instructions in the program without errors, and the end result is OK, then the transaction is authentic.

Look, the program is empty! Nothing is left to do. After running a program, the top item on the stack reveals whether the spending of the output is authentic. If true—OK—then the spending is authorized. If false—not OK—then the transaction must be declined. Lisa looks at the top item on the stack, and there’s an OK. Lisa now knows that John’s input with index 0 is good (figure 5.16).