1. Home
  2. bloXroute Documentation
  3. Gateway Installation
  4. bloXroute-CLI

bloXroute-CLI

Starting with version 1.6, the bloXroute Gateway can be invoked via cli. The bloxroute-cli is a command line interface to communicate with the bloXroute Gateway. It’s part of the Gateway PIP install but can also be installed separately via PIP.

Installing the cli

To install the bloxroute-cli use the following command:

pip install bloxroute-cli

 

Running the cli

There are two modes of operation to the cli: interactive or non-interactive.

Interactive: Open a shell window to execute the cli command

bloxroute-cli [optional arguments]

Non-interactive

bloxroute-cli [optional arguments] command

 

Optional Arguments

Parameter Description Default
rpc-host the Gateway RPC host 127.0.0.1
rpc-port The Gateway RPC port. 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 exits 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 transaction: (required) transaction payload in hex string format
quota_type: (optional) possible values are paid_daily_quota for binding with a paid account(default) or free_daily_quota

Examples

gateway_status

bloxroute-cli gateway_status SUMMARY --rpc-host 127.0.0.1 --rpc-port 28332

>> gateway_status
{
"gateway_status": "Online",
"account_info": "This gateway is not registered to any account  and is limited to the daily free quota",
"block_relay_connection_state": "Established",
"transaction_relay_connection_state": "Established",
"blockchain_node_connection_state": "Established",
"remote_blockchain_node_connection_state": "Established",
“Ip_address”: “XXX.XXX.XXX.XXX”,
"continent": "AS",
"country": "China",
"update_required": false
}

bloxroute-cli memory

>>memory
{
"total_mem_usage": "728 MB",
"total_cached_transactions": 257919,
"total_cached_transactions_size": "71 MB"
}

Peers

bloxroute-cli peers

>> peers
[
{
"id": null,
"type": "BLOCKCHAIN_NODE",
"addr": "YYY.YYY.YYY.YYY 30303",
"direction": "OUTBOUND",
"state": "INITIALIZED"
},
{
"id": "1b3a08fb-d0ba-485b-a66f-a5058921698a",
"type": "RELAY_BLOCK",
"addr": "XXX.XXX.XXX.XXX 1809",
"direction": "OUTBOUND",
"state": "ESTABLISHED"
},
[...]
]

blxr_tx

>> blxr_tx 0xf86683018371843b9aca0082520894e26150519a0cfdcaab8f4b6343adfddb1bd1aaf5808029a07115486389bbb1f8d19f3c9b4fa16dab2bb125f14c6b9fe3f22b09858305776ca06a52bf64c5170daf1422f328b3f0a557e2b7f0d034c0c8f41e97c5ca3e21c1ff
{
    "tx_hash": "Sha256Hash",
    "quota_type": "free_daily_quota",
    "account_id": null
}

Using RPC with user and password

To enable user and password protection for the Gateway’s RPC, start the gateway with the --rpc-user and --rpc-password arguments set to the values you want. Those values are stored, during the Gateway startup in its configuration file.

Once you configure the Gateway to allow access to RPC using a username and password, you can must use the bloxroute-cli using the --rpc-user and --rpc-password arguments.

$ bloxroute-cli --rpc-user my_user --rpc-password my_password
>> peers
[
{
"id": null,
"type": "BLOCKCHAIN_NODE",
"addr": "XXX.XXX.XXX.XXX 30303",
"direction": "OUTBOUND",
"state": "INITIALIZED"
}
]

 

Opening the RPC to remote hosts

By default the bloXroute Gateway listens for RPC connections on port 28332. If you connect from a different host you will need to make sure that there is no firewall or other mechanism blocking the connection. Please see the section General Connectivity Troubleshooting for a detailed explanation on how to check.

To enable RCP connectivity for a Gateway running as a Docker you need to publish the RPC port.

How can we help?