REST API service intended to run next to Substrate, exposing a limited set of endpoints over HTTP with meaningful responses.
Make sure your machine has an
up-to-date version of rustup
installed to manage Rust
dependencies.
Install wasm-pack
if your machine does not already have it:
cargo install wasm-pack
Use yarn to do the remaining setup:
yarn
yarn start
-
/block
fetch latest finalized block details. -
/block/NUMBER
fetch block details at block heightNUMBER
. -
/balance/ADDRESS
fetch balances forADDRESS
at latest finalized block. -
/balance/ADDRESS/NUMBER
fetch balances forADDRESS
at block heightNUMBER
. -
/payout/ADDRESS
fetch payout info forADDRESS
at latest finalized block. -
/payout/ADDRESS/NUMBER
fetch payout info forADDRESS
at block heightNUMBER
. -
/staking/ADDRESS
fetch the staking ledger info forADDRESS
at latest finalized block. -
/staking/ADDRESS/NUMBER
fetch the staking ledger info forADDRESS
at block heightNUMBER
. -
/vesting/ADDRESS
fetch the vesting info forADDRESS
at latest finalized block. -
/vesting/ADDRESS/NUMBER
fetch the vesting info forADDRESS
at block heightNUMBER
. -
/metadata
fetch chain metadata at latest finalized block. -
/metadata/NUMBER
fetch chain metadata at block heightNUMBER
. -
/claims/ADDRESS
fetch claims data for an EthereumADDRESS
. -
/claims/ADDRESS/NUMBER
fetch claims data for an EthereumADDRESS
at blockNUMBER
. -
/tx/artifacts/
fetch artifacts used for creating transactions at latest finalized block. -
/tx/artifacts/NUMBER
fetch artifacts used for creating transactions at block heightNUMBER
. -
/tx/fee-estimate
submit a transaction in order to get back a fee estimation. Expects a string with a hex-encoded transaction in a JSON POST body:curl localhost:8080/tx/fee-estimate -X POST --data '{"tx": "0x..."}' -H 'Content-Type: application/json'
Expected result is a JSON with fee information:
{ "weight": "195000000", "class": "Normal", "partialFee": "165600000" }
-
/tx/
submit a signed transaction, expects a string with hex-encoded transaction in a JSON POST body:curl localhost:8080/tx/ -X POST --data '{"tx": "0x..."}' -H 'Content-Type: application/json'
Expected result is a JSON with transaction hash:
{ "hash": "..." }
Following ENV variables can be set:
BIND_HOST
: address on which the server will be listening, defaults to127.0.0.1
.BIND_PORT
: port on which the server will be listening, defaults to8080
.NODE_WS_URL
: WebSocket URL to which the RPC proxy will attempt to connect to, defaults tows://127.0.0.1:9944
.
Sidecar should be compatible with any Substrate based chain, given constraints:
- The chain ought to use FRAME and the
balances
pallet. - The chain is being finalized (by running
grandpa
). - If the chain is running on custom Node binaries, the JSON-RPC API should be backwards compatible with the default Substrate Node.