Substrate API Sidecar
A REST API on top of Substrate JSON-RPC API for easier interoperation.
The Substrate API Sidecar is an external application that provides a more convenient HTTP API on top of the low-level JSON-RPC API that node exposes.
Humanode network can be used with Substrate API Sidecar, although some of the Humanode specific APIs are not exposed.
If you are an app developer, and you need a quick way to do some common blockchain operations (e.g. balance transfer), consider using the Substrate API Sidecar.
Node.js
Docker
- 1.Install Node.js.
- 2.Install the Substrate API Sidecar.npm install -g @substrate/api-sidecar
- 3.Run the sidecar process and connect to Humanode network.SAS_SUBSTRATE_URL=<URL> substrate-api-sidecar
- 1.Install Docker.
- 2.Run the Substrate API Sidecar image.docker run --rm -it \-p 8080:8080 \-e "SAS_SUBSTRATE_URL=<URL>" \parity/substrate-api-sidecar:latest
You can now send the simple HTTP requests and get simple JSON responses instead of dealing with the Substrate JSON-RPC protocol specifics.
$ curl -sS 'http://127.0.0.1:8080/accounts/hmpwhPbL5XJTYPWd3Gw9dUzdWrPwx2nbMFK7CmCQTrYNSfrW4/balance-info' | jq .
{
"at": {
"hash": "0x50c54161a09a127324de2e7a5c10d01458b896a4eef4905243c23c5c35f17827",
"height": "796175"
},
"nonce": "0",
"tokenSymbol": "HMND",
"free": "353780945734999999999999000",
"reserved": "0",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
Last modified 10mo ago