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

Executing the smart contract

Let's consider the same example of keeping track of document ownership that we used earlier in NEO application. We will also use the same file with the following content as the asset:

This document was created by Alice. 

We will use an md5 (32 characters) hashing algorithm to calculate the asset ID of the file instead of SHA256 (64 characters). This is because the key (bytes32) in the mapping data structure of our contract can accept only 32 characters. The following is the 32-character or 128-bit hash value of the file generated by the md5 algorithm:

c9f50a3bdd2efccb7e34fbd8b42e9675 

Once the proof of ownership smart contract is deployed to the blockchain, it can be invoked from the Truffle console. Let's register ...

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