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

Setting up a JSON-RPC interface for the node

As specified in an earlier section while setting up a node, an NEO node acts as a JSON-RPC server so that it can communicate using the RPC interface. The JSON-RPC server can be instantiated in NEO-CLI by adding the /rpc flag, as mentioned earlier. You need to launch a different process to create an RPC server in neo-python:

$ np-api-server --port-rpc 10332 

Just like Bitcoin's JSON-RPC interface, NEO provides an RPC endpoint for each of its APIs:

$ curl -X POST http://localhost:10332 -H 'Content-Type:  application/json' -d '{ "jsonrpc": "2.0", "id": 5, "method":  "getversion", "params": [] }' 
 
{"jsonrpc": "2.0", "id": 5, "result": {"port": 8080, "nonce":  1439440988, "useragent": "/NEO-PYTHON:0.6.6/"}} ...
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