1. Home
  2. bloXroute Documentation
  3. Cloud-API
  4. Sending Transactions

Sending Transactions

The bloXroute Cloud-API allows bloXroute accounts to send transactions to the BDN without a Gateway. Accounts can also check their quota usage. You can send transactions using the bloXroute-cli or directly via http request. For more information on how to send transactions using the bloXroute-cli, visit the bloXroute-cli page or follow along our step-by-step video walkthrough.

Sending a Transaction to the BDN

The data, in a json format, should include the following:

  • method: blxr_tx
  • id: request-id
  • params: is a json that consists the following
    • transaction: (mandatory) – the raw transaction in string hex format
    • synchronous: (optional, default: true) – a boolean flag indicating if the caller waits for a complete answer from BDN

Curl example:

curl http://api.blxrbdn.com:443 --data '{"method": "blxr_tx", "id": "c85c96c2-587f-4be0-a58a-ac9b91716312", "params": {"transaction": "f86b01847735940082520894a2f6090c0483d6e6ac90a9c23d42e461fee2ac5188016147191f13b0008025a0784537f9801331b707ceedd5388d318d86b0bb43c6f5b32b30c9df960f596b05a042fe22aa47f2ae80cbb2c9272df2f8975c96a8a99020d8ac19d4d4b0e0b58219"}}' --header "Content-Type:text/plain" --header "Authorization:xxxxxxxxxxxx"

Explanation:

  • --data '{...}' – This section includes a json string on the requested command
  • "method": "blxr_tx" – This is a blxr_tx command – sending a transaction to bloXroute Gateway
  • "id": "c85c96c2-587f-4be0-a58a-ac9b91716312" – Each command can have its own id, so your code can check the response and match them to the requests
  • "params": {...} – This section includes a json string that has additional parameters required for the execution on the command. In this example, the parameters should include the raw transaction and optionally an indication if to send it asynchronous or synchronous.
  • "transaction": "..." – This is a raw transaction based on your blockchain protocol
  • --header "Content-Type:text/plain" – required by the protocol to indicate the format of the http request
  • --header "Authorization:xxxxxxxxxxx" – used to authenticate the request. Authentication is done against your account id and the secret hash (api key) you received during the account registration

 

Checking the Quota Usage

Use the quota_usage command to check how many transactions were propagated from your account during the last day.

The content of the data argument is a json string. It should include the following:

  • method: quota_usage
  • id: request-id
  • params: null

 
Curl example:

curl http://api.blxrbdn.com:443 --data '{"method": "quota_usage", "id": "1", "params": null}' --header "Content-Type:text/plain" --header "Content-Type:text/plain" --header "Authorization:xxxxxxxxxxxx"