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

The application logic is similar to that of one used in the NEO smart contract. But the data structure used to store the asset information is different due to the functionalities provided by the virtual machine. One major difference between NEO and Ethereum contract is that the functions in Ethereum contracts can be directly invoked with the help of ABI.

The ProofOfOwnership smart contract uses a mapping data structure to store the asset ownership information in a key/value pair. The asset information of type bytes32 is mapped to the Ethereum address of the asset owner:

pragma solidity ^0.4.23; 
 
contract ProofOfOwnership { 
  mapping (bytes32 => address) public assetOwners; 

The registerAsset function maps the address ...

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