⌨️ bloXroute-cli
The bloXroute Python PGateway can be invoked via cli. The bloxroute-cli is a command line interface to communicate with the bloXroute Gateway or the Cloud-API. It’s part of the Gateway pip install but can also be installed separately via pip. Starting with version 1.7, the bloxroute-cli can also call to bloXroute Cloud-API.

Installing the cli

To install the bloxroute-cli use the following command:
1
pip install bloxroute-cli
Copied!

Running the cli

There are two modes of operation to the cli: interactive or non-interactive.
1. Interactive: Open a shell window to execute the cli command. This is supported only for invoking the Gateway.
1
bloxroute-cli [optional arguments]
Copied!
2. Non-interactive: Send a request to the Gateway or Cloud-API and exits.
1
bloxroute-cli [optional arguments] command
Copied!
Sending a request to Cloud-API should use the following arguments
1
--cloud-api --account-id 09973226-8544-461b-a2e4-443d13579251 --secret-hash 5a200b966dc332b1a44fdb5c14b6dc23
Copied!

Running the cli on docker

If you run the Gateway using docker, then you can invoke the bloXroute-cli using the docker exec command. The following example assumes the docker container name is bloxroute-gateway.
1
docker exec -it bloxroute-gateway bloxroute-cli memory
Copied!

Optional Arguments

Parameter
Description
Default
cloud-api
Should the bloXroute-cli send the request to bloXroute Cloud-API. If the argument appears it means to send the request to bloXroute Cloud-API
cloud-api-url
bloXroute’s Cloud-API DNS name
https://api.blxrbdn.com
account-id
The account id you receive when you registered
secret-hash
The secret hash you receive when you registered
rpc-host
The Gateway RPC host
127.0.0.1
rpc-port
The Gateway RPC port. It should match the value set in the config.cfg file of the Gateway
28332
rpc-user
The Gateway RPC user. Should match the value set in the config.cfg file of the Gateway. Please see section below “using rpc user and password”
rpc-password
The Gateway RPC password. Please see section below “using rpc user and password”

Possible Commands

Command
Description
Parameters
exit
exit the cli
gateway_status
get the status of the bloXroute Gateway
details_level: (optional) can be ‘SUMMARY’ (default) or ‘DETAILED’
memory
get the memory stats of the bloXroute Gateway
help
print detailed help
stop
shutdown the Gateway
peers
get the list of peers connected to the bloXroute Gateway
blxr_tx
send a transaction to the bloXroute BDN
usage: blxr_tx <transaction> <synchronous>
transaction: (required) raw transaction payload in hex string format
synchronous: (optional, default: True) a boolean flag that indicates if the caller is waiting for a complete answer from the BDN. For faster asynchronous transaction sending, set it to “False”

Examples

gateway_status
1
>>> bloxroute-cli gateway_status summary
2
3
<<< {
4
"gateway_status": "Online",
5
"account_info": "This gateway is not registered to any account and is limited to the daily free quota",
6
"block_relay_connection_state": "Established",
7
"transaction_relay_connection_state": "Established",
8
"blockchain_node_connection_state": "Established",
9
"remote_blockchain_node_connection_state": "Established",
10
“Ip_address”: “XXX.XXX.XXX.XXX”,
11
"continent": "AS",
12
"country": "China",
13
"update_required": false
14
}
15
Copied!
memory
1
>>> bloxroute-cli memory
2
3
<<< {
4
"total_mem_usage": "728 MB",
5
"total_cached_transactions": 257919,
6
"total_cached_transactions_size": "71 MB"
7
}
8
Copied!
peers
1
>>> bloxroute-cli peers
2
3
<<< [
4
{
5
"id": null,
6
"type": "BLOCKCHAIN_NODE",
7
"addr": "YYY.YYY.YYY.YYY 30303",
8
"direction": "OUTBOUND",
9
"state": "INITIALIZED"
10
},
11
{
12
"id": "1b3a08fb-d0ba-485b-a66f-a5058921698a",
13
"type": "RELAY_BLOCK",
14
"addr": "XXX.XXX.XXX.XXX 1809",
15
"direction": "OUTBOUND",
16
"state": "ESTABLISHED"
17
},
18
{...}
19
]
20
Copied!
Sending transaction asynchronously blxr_tx
1
>>> bloxroute-cli blxr_tx f86683018371843b9aca0082520894e26150519a0cfdcaab8f4b6343adfddb1bd1aaf5808029a07115486389bbb1f8d19f3c9b4fa16dab2bb125f14c6b9fe3f22b09858305776ca06a52bf64c5170daf1422f328b3f0a557e2b7f0d034c0c8f41e97c5ca3e21c1ff
2
3
<<< {
4
"tx_hash": "not available with async",
5
"quota_type": "paid_daily_quota",
6
"synchronous": "False"
7
}
8
Copied!
Sending transaction synchronously blxr_tx
1
>>> bloxroute-cli blxr_tx f86683018371843b9aca0082520894e26150519a0cfdcaab8f4b6343adfddb1bd1aaf5808029a07115486389bbb1f8d19f3c9b4fa16dab2bb125f14c6b9fe3f22b09858305776ca06a52bf64c5170daf1422f328b3f0a557e2b7f0d034c0c8f41e97c5ca3e21c1ff synchronous
2
Copied!
Last modified 1mo ago