Skip to Content
Foundations of Blockchain
book

Foundations of Blockchain

by Koshik Raj
January 2019
Beginner to intermediate
372 pages
11h 17m
English
Packt Publishing
Content preview from Foundations of Blockchain

Script example

Let's take a simple example to execute the script:

2 4 OP_ADD 6 OP_EQUAL 

Execution of the script starts from the left-hand side. The data constants 2 and 4 are inserted into the stack as soon as the execution begins. Next, the script performs an addition operation, represented by the OP_ADD operator. The addition operation is performed on the top two items of the stack after popping them, so 2 + 4 = 6. The result is pushed back to the stack. The data constant 6 is pushed to the stack when it is encountered. Finally, the conditional OP_EQUAL operator is performed on the stack items. The last two items are popped from the stack and compared to see if they are equal. Since the last two data items in our stack are 6, the equality ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Blockchain Basics

Blockchain Basics

Daniel Drescher
What Is Blockchain?

What Is Blockchain?

Sir John Hargrave, Evan Karnoupakis
Mastering Blockchain

Mastering Blockchain

Lorne Lantz, Daniel Cawrey

Publisher Resources

ISBN: 9781789139396Supplemental Content