January 2019
Beginner to intermediate
372 pages
11h 17m
English
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/"}} ...