Highlayer HTTP API
Highlayer sequencer/node expose RESTful API for interacting with highlayer and reading state of contracts, balances etc.
This document provides overview of exposed HTTP endpoints, also acting as a reference/standard for implementing custom nodes.
Please note that most of the structured values are returned in Msgpack format unless explicitly specified otherwise.
Sequencer API
This section describes endpoints exposed by the highlayer sequencer. You can find sequencer endpoint in magic values.
Fetch transaction by sequencer transaction index
GET
/ledger/$sequencerTxIndex
The sequencer assigns a unique number to each transaction it processes in incremental order (if index 2 exists, index 1 must exist too).
Returns TransactionFetch available deposit on sequencer
GET
/depositBalance/$address
Fetch current balance on highlayer sequencer.
It is useful when needed to estimate if a current deposit is enough for the transaction to be accepted by the sequencer.
Returns AlansSee Depositing to sequencer for more details.
Post transaction to highlayer
POST
/tx
Posts transaction to sequencer.
Required headers:
Header name | Header value |
---|---|
Content-Type | application/vnd.msgpack |
Content-Length | Byte length of transaction |
Body must be Transaction in encoded form with valid signature provided.
Fetch pricing per byte
GET
/sequencerPrices
Fetches the price that the sequencer will charge per byte of uploaded transaction.
ReturnsKey | Value |
---|---|
feePerByte | Alans |
Highlayerd node API
This section describes endpoints exposed by the highlayer's highlayerd node. You can find public node endpoint in magic values or host your own node.
Fetch network/node info
GET
/info
Gives overview of network that highlayerd node is running.
ReturnsKey | Value |
---|---|
network | (Name).(T/M/B for testnet, mainnet, betanet)/(version), i.e "Highlayer.T/0.4" |
Recommended cache level (for node operators): 1 second
Fetch account KV pair
GET
/kv/$account:$key
Fetches account's KV store value with provided key.
ReturnsMsgpack representation of value.
Recommended cache level (for node operators): 10 seconds
Fetch data blob uploaded to highlayer
GET
/data/$dataId
Fetches data blob with provided data ID.
ReturnsBinary
Recommended cache level (for node operators): Full
Fetch balance
GET
/balance/$address
Fetches HI/tHI balance of an address.
ReturnsRecommended cache level (for node operators): 10 seconds
Fetch transaction
GET
/tx/$id
Fetches raw, encoded transaction by txID. Signed by the sequencer.
ReturnsRecommended cache level (for node operators): Full
POST
/calculateTxGas
Ask node to calculate gas for your transaction's actions (without gas consumed by smart contracts executed).
Required headers:
Header name | Header value |
---|---|
Content-Type | application/vnd.msgpack |
Content-Length | Byte length of transaction |
Body must be Transaction in encoded form WITHOUT signature provided.
ReturnsKey | Value |
---|---|
gas | String of digits. Must be positive for transaction to be executed by network. |
Recommended cache level (for node operators): None