Substrate API Sidecar
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.
-
Install Node.js.
-
Install the Substrate API Sidecar.
Terminal window npm install -g @substrate/api-sidecar -
Run the sidecar process and connect to Humanode network.
Terminal window SAS_SUBSTRATE_URL=<URL> substrate-api-sidecarReplace
<URL>with the right JSON-RPC URL from the chains page, or use your own.
-
Install Docker.
-
Run the Substrate API Sidecar image.
Terminal window docker run --rm -it \-p 8080:8080 \-e "SAS_SUBSTRATE_URL=<URL>" \parity/substrate-api-sidecar:latestReplace
<URL>with the right JSON-RPC URL from the chains page, or use your own.
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": []}