1. Home
  2. bloXroute Documentation
  3. Gateway-API
  4. Gateway-API Overview

Gateway-API Overview

The bloXroute Gateway supports receiving commands using the Gateway-API. The Gateway-API is based on RPC. The Gateway-API commands can be invoked directly from users application or via the bloXroute-cli utility. Some Gateway-API requests are only available for paid tiers (for example, the ability to send Transactions via the Gateway-API). You can purchase a paid account here.

Each request must have the following headers:

  • Content-Type: text/plain
  • Authorization: should be base64 encoding of combination of rpc_user:rpc_password

Python code example:

base64.b64encode(f"{rpc_user}:{rpc_password}".encode("utf-8")).decode("utf-8")

Possible Commands

 Command Description Parameters
gateway_status get the status of the bloXroute Gateway details_level: (optional) can be ‘SUMMARY’ (default) or ‘DETAILED’
memory get the memory status 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

>>> curl http://127.0.0.1:28332 --data '{"method": "gateway_status", "id": "c85c96c2-587f-4be0-a58a-ac9b91716312", "params": {"details_level": "summary"}}' --header "Content-Type:text/plain" --header "Authorization:xxxxxxxxxxx"

<<< "{\"jsonrpc\": \"2.0\", \"id\": \"c85c96c2-587f-4be0-a58a-ac9b91716312\", \"result\": {\"gateway_status\": \"Online with Errors\", \"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\": \"Disconnected\", \"ip_address\": \"xxx.xxx.xxx.xxx\", \"continent\": \"AS\", \"country\": \"China\", \"update_required\": false, \"quota_level\": \"0%\"}}"

memory

>>> curl http://127.0.0.1:28332 --data '{"method": "memory", "id": "c85c96c2-587f-4be0-a58a-ac9b91716312"}' --header "Content-Type:text/plain" --header "Authorization:xxxxxxxxxxx"  
<<< "{\"jsonrpc\": \"2.0\", \"id\": \"c85c96c2-587f-4be0-a58a-ac9b91716312\", \"result\": {\"total_mem_usage\": \"728 MB\", \"total_cached_transactions\": \"257919\", \"total_cached_transactions_size\": \"71 MB\"}}"

peers

>>> curl http://127.0.0.1:28332 --data '{"method": "peers", "id": "c85c96c2-587f-4be0-a58a-ac9b91716312"}' --header "Content-Type:text/plain" --header "Authorization:xxxxxxxxxxx"  
<<< "{\"jsonrpc\": \"2.0\", \"id\": \"c85c96c2-587f-4be0-a58a-ac9b91716312\", \"result\": {[{\"id\": null, \"type\": \"type\", \"addr\": \"YYY.YYY.YYY.YYY 30303\", \"direction\": \"OUTBOUND\", \"state\": \"INITIALIZED\"}, {...}]}}"