2019-09-18 07:55:39 +00:00
# RPC
## Client
Client is provided as a Go package, so please refer to the
[relevant godocs page ](https://godoc.org/github.com/nspcc-dev/neo-go/pkg/rpc ).
## Server
The server is written to support as much of the [JSON-RPC 2.0 Spec ](http://www.jsonrpc.org/specification ) as possible. The server is run as part of the node currently.
### Example call
An example would be viewing the version of the node:
```bash
$ curl -X POST -d '{"jsonrpc": "2.0", "method": "getversion", "params": [], "id": 1}' http://localhost:20332
```
which would yield the response:
```json
{
"jsonrpc" : "2.0",
"id" : 1,
"result" : {
"port" : 20333,
"useragent" : "/NEO-GO:0.36.0-dev/",
"nonce" : 9318417
}
}
```
### Supported methods
| Method | Implemented |
| ------- | ------------|
| `getaccountstate` | Yes |
2020-02-21 14:56:28 +00:00
| `getapplicationlog` | Yes |
2019-09-18 07:55:39 +00:00
| `getassetstate` | Yes |
| `getbestblockhash` | Yes |
| `getblock` | Yes |
| `getblockcount` | Yes |
| `getblockhash` | Yes |
2020-03-04 17:35:37 +00:00
| `getblockheader` | Yes |
2020-02-19 09:44:31 +00:00
| `getblocksysfee` | Yes |
2020-03-03 15:15:26 +00:00
| `getclaimable` | Yes |
2019-09-18 07:55:39 +00:00
| `getconnectioncount` | Yes |
2020-02-15 17:02:41 +00:00
| `getcontractstate` | Yes |
2020-03-05 11:50:06 +00:00
| `getnep5balances` | Yes |
2020-03-05 12:16:03 +00:00
| `getnep5transfers` | Yes |
2019-09-18 07:55:39 +00:00
| `getpeers` | Yes |
2020-03-02 16:13:44 +00:00
| `getrawmempool` | Yes |
2019-11-16 21:33:42 +00:00
| `getrawtransaction` | Yes |
2020-01-30 08:03:44 +00:00
| `getstorage` | Yes |
2020-03-05 14:20:50 +00:00
| `gettransactionheight` | Yes |
2020-02-06 12:02:03 +00:00
| `gettxout` | Yes |
2020-03-03 15:15:26 +00:00
| `getunclaimed` | No (#712) |
2019-11-16 21:33:42 +00:00
| `getunspents` | Yes |
2020-03-03 15:15:26 +00:00
| `getvalidators` | No (#714) |
2019-09-18 07:55:39 +00:00
| `getversion` | Yes |
2019-11-28 16:08:31 +00:00
| `invoke` | Yes |
2019-11-26 10:13:17 +00:00
| `invokefunction` | Yes |
2019-11-16 21:33:42 +00:00
| `invokescript` | Yes |
| `sendrawtransaction` | Yes |
2020-03-02 17:01:32 +00:00
| `submitblock` | Yes |
2019-09-18 07:55:39 +00:00
| `validateaddress` | Yes |
2020-03-03 15:15:26 +00:00
### 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 |
2019-11-26 10:13:17 +00:00
#### Implementation notices
2019-11-28 16:08:31 +00:00
##### `invokefunction` and `invoke`
2019-11-26 10:13:17 +00:00
2019-11-28 16:08:31 +00:00
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.
2019-11-26 10:13:17 +00:00
2019-09-18 07:55:39 +00:00
## Reference
* [JSON-RPC 2.0 Specification ](http://www.jsonrpc.org/specification )
2020-02-15 16:26:47 +00:00
* [NEO JSON-RPC 2.0 docs ](https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html )