neoneo-go/docs/rpc.md
Roman Khimov cf39171485 rpc: implement invokefunction, fix #347
Param getters were redone to return errors because otherwise bad FuncParam
values could lead to panic. FuncParam itself might be not the most elegant
solution, but it works good enough for now.
2019-11-27 13:00:11 +03:00

2 KiB

RPC

Client

Client is provided as a Go package, so please refer to the relevant godocs page.

Server

The server is written to support as much of the JSON-RPC 2.0 Spec as possible. The server is run as part of the node currently.

Example call

An example would be viewing the version of the node:

$ curl -X POST -d '{"jsonrpc": "2.0", "method": "getversion", "params": [], "id": 1}' http://localhost:20332

which would yield the response:

{
  "jsonrpc" : "2.0",
    "id" : 1,
    "result" : {
      "port" : 20333,
      "useragent" : "/NEO-GO:0.36.0-dev/",
      "nonce" : 9318417
    }
}

Supported methods

Method Implemented
getaccountstate Yes
getapplicationlog No (#500)
getassetstate Yes
getbestblockhash Yes
getblock Yes
getblockcount Yes
getblockhash Yes
getblocksysfee No (#341)
getconnectioncount Yes
getcontractstate No (#342)
getnep5balances No (#498)
getnep5transfers No (#498)
getpeers Yes
getrawmempool No (#175)
getrawtransaction Yes
getstorage No (#343)
gettxout No (#345)
getunspents Yes
getversion Yes
invoke No (#346)
invokefunction Yes
invokescript Yes
sendrawtransaction Yes
submitblock No (#344)
validateaddress Yes

Implementation notices

invokefunction

neo-go's implementation of invokefunction does not return tx field in the answer because that requires signing the transaction with some key in the server which doesn't fit the model of our node-client interactions. Lacking this signature the transaction is almost useless, so there is no point in returning it.

Reference