neo-go/docs/rpc.md
2020-03-07 18:05:40 +03:00

3.3 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 Yes
getassetstate Yes
getbestblockhash Yes
getblock Yes
getblockcount Yes
getblockhash Yes
getblockheader Yes
getblocksysfee Yes
getclaimable Yes
getconnectioncount Yes
getcontractstate Yes
getnep5balances Yes
getnep5transfers Yes
getpeers Yes
getrawmempool Yes
getrawtransaction Yes
getstorage Yes
gettransactionheight Yes
gettxout Yes
getunclaimed No (#712)
getunspents Yes
getvalidators Yes
getversion Yes
invoke Yes
invokefunction Yes
invokescript Yes
sendrawtransaction Yes
submitblock Yes
validateaddress Yes

Unsupported methods

Methods listed down below are not going to be supported for various reasons and we're not accepting issues related to them.

Method Reason
claimgas Doesn't fit neo-go wallet model, use CLI to do that
dumpprivkey Shouldn't exist for security reasons, see claimgas comment also
getbalance Use getaccountstate instead, see claimgas comment also
getmetricblocktimestamp Not really useful, use other means for node monitoring
getnewaddress See claimgas comment
getunclaimedgas Use getunclaimed instead, see claimgas comment also
getwalletheight Not applicable to neo-go, see claimgas comment
importprivkey Not applicable to neo-go, see claimgas comment
listaddress Not applicable to neo-go, see claimgas comment
listplugins neo-go doesn't have any plugins, so it makes no sense
sendfrom Not applicable to neo-go, see claimgas comment
sendmany Not applicable to neo-go, see claimgas comment
sendtoaddress Not applicable to neo-go, see claimgas comment

Implementation notices

invokefunction and invoke

neo-go's implementation of invokefunction and invoke 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.

Both methods also don't currently support arrays in function parameters.

Reference