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

Creating the smart contract

Smart contracts created using Python contain a main function as the entry point. This function accepts two parameters. The first parameter accepts the type of operation, and all the additional arguments are passed to the second parameter in a list. The operation parameter accepts register, query, delete, and transfer so that it can perform asset management functions.

The main function of the smart contract parses the operation parameter and invokes the respective function in the smart contract to perform operations on the asset. The main function parses the args parameter and assigns the first item of the list to asset_id, and the others to owner:

from boa.interop.Neo.Runtime import Log, Notify from boa.interop.Neo.Storage ...
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