neoneo-go/docs/rpc.md

80 lines
2.1 KiB
Markdown
Raw Normal View History

# 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 |
| `getapplicationlog` | Yes |
| `getassetstate` | Yes |
| `getbestblockhash` | Yes |
| `getblock` | Yes |
| `getblockcount` | Yes |
| `getblockhash` | Yes |
| `getblocksysfee` | Yes |
| `getconnectioncount` | Yes |
| `getcontractstate` | Yes |
| `getnep5balances` | No (#498) |
| `getnep5transfers` | No (#498) |
| `getpeers` | Yes |
| `getrawmempool` | Yes |
| `getrawtransaction` | Yes |
2020-01-30 08:03:44 +00:00
| `getstorage` | Yes |
2020-02-06 12:02:03 +00:00
| `gettxout` | Yes |
| `getunspents` | Yes |
| `getversion` | Yes |
| `invoke` | Yes |
| `invokefunction` | Yes |
| `invokescript` | Yes |
| `sendrawtransaction` | Yes |
| `submitblock` | No (#344) |
| `validateaddress` | Yes |
#### 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
* [JSON-RPC 2.0 Specification](http://www.jsonrpc.org/specification)
* [NEO JSON-RPC 2.0 docs](https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html)