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

Interface for the application

The NEO community has a created few JavaScript libraries to interface with the NEO blockchain. We will be using a popular library called neon-js (https://github.com/CityOfZion/neon-js), which is backed by the City of Zion community.

The following script creates an interface to query the owner of the asset for our proof of ownership application:

queryAsset(assetID) {
  const props = { 
    scriptHash: '60a7ed582c6885addf1f9bec7e413d01abe54f1a', 
    operation: 'query', 
    args: [assetID.hexEncode()]
  }; 
  const Script = Neon.create.script(props); 
 
  rpc.Query.invokeScript(Script).execute('http://localhost:30333') .then((res) => { 
    return res.result.stack[0].value.hexDecode() 
  }); 
} 

The interface created using the neon-js library builds ...

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