The bloXroute Gateway 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.
To install the bloxroute-cli use the following command:
pip install bloxroute-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.
bloxroute-cli [optional arguments]
2. Non-interactive: Send a request to the Gateway or Cloud-API and exits.
bloxroute-cli [optional arguments] command
Sending a request to Cloud-API should use the following arguments
--cloud-api --account-id 09973226-8544-461b-a2e4-443d13579251 --secret-hash 5a200b966dc332b1a44fdb5c14b6dc23
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
.
docker exec -it bloxroute-gateway bloxroute-cli memory
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” | |
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” |
gateway_status>>> bloxroute-cli gateway_status summary<<< {"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}
memory>>> bloxroute-cli memory<<< {"total_mem_usage": "728 MB","total_cached_transactions": 257919,"total_cached_transactions_size": "71 MB"}
peers>>> bloxroute-cli 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"},{...}]
Sending transaction asynchronously blxr_tx>>> bloxroute-cli blxr_tx f86683018371843b9aca0082520894e26150519a0cfdcaab8f4b6343adfddb1bd1aaf5808029a07115486389bbb1f8d19f3c9b4fa16dab2bb125f14c6b9fe3f22b09858305776ca06a52bf64c5170daf1422f328b3f0a557e2b7f0d034c0c8f41e97c5ca3e21c1ff<<< {"tx_hash": "not available with async","quota_type": "paid_daily_quota","synchronous": "False"}
Sending transaction synchronously blxr_tx>>> bloxroute-cli blxr_tx f86683018371843b9aca0082520894e26150519a0cfdcaab8f4b6343adfddb1bd1aaf5808029a07115486389bbb1f8d19f3c9b4fa16dab2bb125f14c6b9fe3f22b09858305776ca06a52bf64c5170daf1422f328b3f0a557e2b7f0d034c0c8f41e97c5ca3e21c1ff synchronous