Searchโ€ฆ
Substrate API Sidecar

Biforst Properties

1
ExistentialDeposit = 0.01BNC
2
SS58Prefix = 6
3
BlockLength = 3.75MB
4
Precision = 12
5
Token Name = BNC
Copied!

Bifrost Node Setup

Compile bifrost from source code, either run bifrost by docker container. From source code.
1
git clone https://github.com/bifrost-finance/bifrost.git
2
cd bifrost
3
git checkout develop
4
cargo build --release
Copied!
Checkout this link to compile bifrost node.
Run it on the local by the following command:
1
./target/release/bifrost \
2
--dev \
3
--base-path bifrost-poa \
4
--name "Bifrost POA" \
5
--rpc-cors all --ws-port 9944 \
6
--unsafe-ws-external \
7
--unsafe-rpc-external \
8
--rpc-methods=Unsafe
Copied!

Substrate-api-sidecar Setup

Requirements:
Ensure Node version 12 or higher installed, and yarn installed.
Procedures:
Step 1. Sync sidecar source code and compile it.
1
git clone https://github.com/bifrost-finance/substrate-api-sidecar.git
2
cd substrate-api-sidecar
3
yarn
4
yarn build
Copied!
Step 2. Configure sidecar.
Find .env.local, check these fields SAS_EXPRESS_BIND_HOST, SAS_EXPRESS_PORT, SAS_SUBSTRATE_WS_URL, just replace them with your own setup. But if bifrost and sidecar runs on the local, you don't need to change anything, just go to step 3.
1
SAS_EXPRESS_BIND_HOST=0.0.0.0
2
โ€‹
3
# If this port is occupied, change it to another one.
4
SAS_EXPRESS_PORT=8089
5
โ€‹
6
SAS_SUBSTRATE_WS_URL=ws://127.0.0.1:9944
Copied!
Step 3. Start sidecar.
1
NODE_ENV=local yarn start
Copied!
It should start without error.
Step 4. Test bifrost endpoints APIs.
You can find lots of APIs at Substrate API Sidecarโ€‹
Tips: If you want to show pretty json format, ensure jq installed on your computer.
List some examples here:
Check someone's balance. Take Alice as example
1
curl -s http://127.0.0.1:8089/accounts/5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY/balance-info | jq
Copied!
Output shoule be like this:
1
{
2
"at": {
3
"hash": "0xbcbc376e74fd71eac9555618856e743aa98053dc1c2fea73f928f16e54789c93",
4
"height": "1077"
5
},
6
"nonce": "1",
7
"tokenSymbol": "BNC",
8
"free": "909927992202094564",
9
"reserved": "0",
10
"miscFrozen": "0",
11
"feeFrozen": "0",
12
"locks": []
13
}
Copied!
Get vesting information for an account.
1
curl -s http://127.0.0.1:8089/accounts/5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY/vesting-info | jq
Copied!
Output shoule be like this:
1
{
2
"at": {
3
"hash": "0x030b1f0746937231a7a8a5b41a9afde092a9c4962cd7ff87cdad52711c691467",
4
"height": "1109"
5
},
6
"vesting": {}
7
}
Copied!
Get a block by its height or hash.
1
# By height
2
curl -s http://127.0.0.1:8089:8089/blocks/1 | jq
3
โ€‹
4
# By block hash
5
curl -s http://127.0.0.1:8089:8089/blocks/0x4cf0f48fb8aebcc26f745049aec4d4ea03c36d8d17a2adfc3aa53006a038dfd3 | jq
Copied!
Get version information of the bifrost runtime.
1
curl -s http://127.0.0.1:8089/runtime/spec | jq
Copied!
Output shoule be like this:
1
{
2
"at": {
3
"height": "1148",
4
"hash": "0x0aafa445b2a2970627bbf53211020d79d06b5f3d0746e813398035fff07bf590"
5
},
6
"authoringVersion": "10",
7
"transactionVersion": "1",
8
"implVersion": "0",
9
"specName": "bifrost",
10
"specVersion": "1",
11
"chainType": {
12
"development": null
13
},
14
"properties": {
15
"ss58Format": "6",
16
"tokenDecimals": [
17
"12"
18
],
19
"tokenSymbol": [
20
"BNC"
21
]
22
}
23
}
Copied!
Last modified 1mo ago