Comment on page
Blockchain Node API
This reference guide outlines the interfaces to access blockchain nodes that are created as part of the Bloq Nodes service.
Any key deviations from the standard node interface (by blockchain) are highlighted as part of the reference guide.
TIP
Testnet nodes use the same API calls as their mainnet counterparts. Just make sure the address port matches your node's chain!
Jump to:
TIP
The Bitcoin Node API is largely interoperable with Litecoin, with a few documented distinctions. Please see the Litecoin REST API documentation and Litecoin JSON-RPC methods for more information.
TIP
A key-client pair must be created prior to using the Nodes service. Use the
bcl client-keys
command if client-keys
do not currently exist.If a key-client pair already exists, use the
bcl conf
command to load your keypair.TIP
In addition to having a client-key pair generated, a clientAccessToken and refreshToken are also required to access the Nodes service. Use the
bcl client-token
command to generate the tokens.The Nodes service supports the standard Bitcoin JSON-RPC calls with a number that are blacklisted. RPC calls that would negatively impact the running of the service are blacklisted. Wallet specific RPC calls are also currently not allowed as all nodes are run with
--disable-wallet
.curl -k -X POST \
--user <NodeUser>:<NodePass> \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "1.0", "method": "getblock", "params": ["000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", true] }' \
https://<ip-address>:8332/
Response
{
"hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
"confirmations": 633169,
"size": 285,
"height": 0,
"version": 1,
"versionHex": "00000001",
"merkleroot": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
"tx": ["4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"],
"time": 1231006505,
"mediantime": 1231006505,
"nonce": 2083236893,
"bits": "1d00ffff",
"difficulty": 1,
"chainwork": "0000000000000000000000000000000000000000000000000000000100010001",
"nTx": 1,
"nextblockhash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"
}
curl -k -X POST \
--user <NodeUser>:<NodePass> \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "1.0", "method": "getdifficulty", "params": [] }' \
https://<ip-address>:8332/
Response
{
"result": 15958652328578.1588
}
The following list of JSON-RPC calls are NOT available for the Nodes Bitcoin (BTC) service:
stop
generate
generatetoaddress
Wallet specific RPC calls are currently disabled. For the full list of unsupported wallet RPCs, please see Wallet RPC methods.
TIP
A key-client pair must be created prior to using the Nodes service. Use the
bcl client-keys
command if client-keys
do not currently exist.If a key-client pair already exists, use the
bcl conf
command to load your keypair.TIP
In addition to having a client-key pair generated, a clientAccessToken and refreshToken are also required to access the Nodes service. Use the
bcl client-token
command to generate the tokens.The Nodes service supports the standard Bitcoin Cash JSON-RPC calls with a number that are blacklisted. RPC calls that would negatively impact the running of the service are blacklisted. Wallet specific RPC calls are also currently not allowed as all nodes are run with
--disable-wallet
.The following list of JSON-RPC calls are NOT available for the Nodes Bitcoin Cash (BCH) service:
stop
generate
generatetoaddress
Wallet specific RPC calls are currently disabled. For the full list of unsupported wallet RPCs, please see Wallet RPC methods.
The Nodes service supports the standard Ethereum JSON-RPC calls with a number that are blacklisted. RPC calls that would negatively impact the running of the service are blacklisted.
curl -X POST \
--user <NodeUser>:<NodePass> \
-H 'Content-Type: application/json' \
-d '{ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1 }' \
https://<ip-address>:8545/
Response
{
"jsonrpc": "2.0",
"result": "0x981fb8", //9969592
"id": 1
}
The following list of JSON-RPC calls are NOT available for the Nodes Ethereum (ETH) service:
eth_accounts
shh_newIdentity
Bloq Algorand nodes support some REST APIs for participation nodes to create, list, view and delete participation keys on the node. These are additional REST APIs on top of the standard Algorand REST APIs. For full list of Algorand REST APIs see Algorand REST APIs
curl -X POST \
--user <NodeUser>:<NodePass> \
-H 'Content-Type: application/json' \
-d '{ "address": <address>, "roundFirstValid": <roundFirstValid>, "roundLastValid": <roundLastValid>, "id": 1 }' \
https://<ip-address>:8080/addpartkey --output -
Response
Participation key generation successful
curl --user <NodeUser>:<NodePass> \
https://<ip-address>:8080/listpartkeys --output -
Response
Registered Filename Parent address First round Last round First key
no HMJHNGQPPBNUVSHB3EQ4YJ2IK2RQCCMYC4ZNDIUS75QTOZUEDWAQMFRWBQ.6969458.7969458.partkey HMJHNGQPPBNUVSHB3EQ4YJ2IK2RQCCMYC4ZNDIUS75QTOZUEDWAQMFRWBQ 6969458 7969458 716.3239
no UEDD34QFEMWRGYCBLKZIEHPKSTNBFSRMFBHRJPY3O2JPGKHQCXH4IY6XRI.1221.2221.partkey UEDD34QFEMWRGYCBLKZIEHPKSTNBFSRMFBHRJPY3O2JPGKHQCXH4IY6XRI 1221 2221 715.0
curl --user <NodeUser>:<NodePass> \
https://<ip-address>:8080/partKeyInfo --output -
Response
{
"acct": "UEDD34QFEMWRGYCBLKZIEHPKSTNBFSRMFBHRJPY3O2JPGKHQCXH4IY6XRI",
"first": 1221,
"last": 2221,
"sel": "LnXGberaBu/VSnCdHDlB57ezEcsCXuh8Ayea8PXA7BU=",
"vote": "GL4yNwJ1h/uxHUqExfOzcTw7Q3moqfw89ab14Vj2LiQ=",
"voteKD": 10000
}
------------------------------------------------------------------
File: HMJHNGQPPBNUVSHB3EQ4YJ2IK2RQCCMYC4ZNDIUS75QTOZUEDWAQMFRWBQ.6969458.7969458.partkey
{
"acct": "HMJHNGQPPBNUVSHB3EQ4YJ2IK2RQCCMYC4ZNDIUS75QTOZUEDWAQMFRWBQ",
"first": 6969458,
"last": 7969458,
"sel": "KCUYm7L9dopxVC02LR/WgQWB5qzdG5Pj7WWKaccU6I0=",
"vote": "6sJ+620IFyBQ6TaQQg/vzPvy65lvOOIoBN0SWQjWk/Y=",
"voteKD": 10000
}
curl -X POST \
--user <NodeUser>:<NodePass> \
-H 'Content-Type: application/json' \
-d '{ "address": <address>, "roundFirstValid": <roundFirstValid>, "roundLastValid": <roundLastValid>, "id": 1 }' \
https://<ip-address>:8080/removePartKey --output -
Response
Participation key removed
A special API is provided on port 8080 for all nodes with calls to help manage the nodes.
Request the status of a node.
Responses
Status | Meaning | Description |
---|---|---|
200 | Successful operation |
Example responses
200 Response
"healthy"
Code Sample
curl -k -X GET \
--user <NodeUser>:<NodePass> \
-H 'Content-Type: application/json' \
https://<ip-address>:8080/status
Request the logs from the running blockchain daemon.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
lines | body | number | false | Number of log lines to retrieve. Leave blank for full log. |
Responses
Status | Meaning | Description |
---|---|---|
200 | Successful operation |
Example responses
200 Response
[
"B2019-07-01T19:43:21Z Bitcoin Core version v0.17.1 (release build)",
"z2019-07-01T19:43:21Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1",
"2019-07-01T19:43:21Z Assuming ancestors of block 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 have valid signatures.",
"p2019-07-01T19:43:21Z Setting nMinimumChainWork=0000000000000000000000000000000000000000028822fef1c230963535a90d"
]
Code Sample
curl -k -X GET \
--user <NodeUser>:<NodePass> \
-H 'Content-Type: application/json' \
https://<ip-address>:8080/logs
Last modified 2mo ago