Babylon Gateway API - RCnet V3 (0.5.0)

Download OpenAPI specification:Download

This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission.

It is designed for use by wallets and explorers. For simple use cases, you can typically use the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up.

The Gateway API is implemented by the Network Gateway, which is configured to read from full node(s) to extract and index data from the network.

This document is an API reference documentation, visit User Guide to learn more about how to run a Gateway of your own.

Migration guide

Integration and forward compatibility guarantees

We give no guarantees that other endpoints will not change before Babylon mainnet launch, although changes are expected to be minimal.

Sub-APIs

The Gateway API is split into 5 sub APIs:

  • Status (/status/*) - For status and configuration details for the Gateway / Network.
  • Transaction (/transaction/*) - For transaction construction, preview, submission, and monitoring the status of an individual transaction.
  • Stream (/transaction/*) - For reading committed transactions.
  • State (/state/*) - For reading the current or past ledger state of the network.
  • Statistics (/statistics/*) - For calculating particular statistics against the current or past ledger state of the network.

Concepts

Interacting with this API effectively may require knowledge about the Radix Babylon Transaction Model and the State Model.

We share some very high-level details below, but please see the official documentation for more details on this.

Transactions and the Gateway

User transactions are formed of a core "intent", which is then signed by 0+ signatories, before being notarized. The output is called a notarized payload. It is this notarized transaction payload which is submitted to the network.

For most users, this construction process will generally happen in their Radix Wallet. If you wish to construct transactions programmatically or offline, you will need to integrate the Radix Engine Toolkit into your application for construction and finalization.

Once submitted, a transaction payload can end up being either rejected or committed. Transactions get rejected if they fail to pass certain criteria at the given time. A transaction payload can be marked as a:

  • Permanent Rejection if it is never possible for it to be committed (eg it's statically invalid, or only valid up until epoch 100 and it's now epoch 101)
  • Temporary Rejection if it still may be possible that the transaction payload could be committed

A given intent typically is only part of one submitted notarized payload, but it's possible for a notary to notarize and submit multiple payloads for the same intent. The Radix Engine ensures that any intent can only be committed once.

A committed transaction is either committed with an outcome of "Success" or "Failure":

  • Committed Failure will result in fees being paid up until the failure point, but all other changes will be discarded.
  • Committed Success will result in all changes being committed.

Only committed transactions appear on ledger.

The gateway will attempt to submit your transaction to nodes on the network. If it gets temporarily rejected, the error message will be recorded against the transaction, but the Gateway will retry submission for a limited time. During this time, the status will be reported as pending.

State Model

The Radix Engine consists of "global entities". A global entity has a Bech32m Address, with a human-readable-prefix (and prefix byte) matching the entity type.

As an example, entities include concepts like Components, Packages, Vaults, Resource Managers and Key-Value Stores.

Each entity owns substates which store data, and these substates can own other entities. For example, an Account Component has a struct substate which owns a Key-Value Store. This Key-Value store has an entry for each resoure the Account owns, and each Key-Value Store Entry owns a corresponding Vault.

For each global entity, the Gateway aggregates its owned resources by looking at the contents of Vaults in the subtree of entities under that global entity.

Architecture

Request-Response Format

The API is designed in a JSON-RPC-like style, using HTTP as a transport layer, which means that:

  • Requests always use HTTP POST method.
  • There is no HTTP cache involved.
  • Client-originated errors result in HTTP 4xx error responses.
  • Server-originated errors result in HTTP 5xx error responses:
    • The error object contains an HTTP-like code
    • The error object also contains a structured/typed properties, with a type discriminator, allowing for structured error interpretation in client software.

Pagination Model

Collections can grow in size therefore every dynamic-length collection is a subject to pagination where a generic data struct is used to represent a chunk (page) of underlying data. Gateway API uses cursor-based pagination model where the sole existence of the cursor indicates that next chunk (page) of the underlying collection is available.

collection {
  int64? total_count,
  string? next_cursor,
  T[] items
}
  • total_count (optional) if present specifies the overall size of the underlying collection,
  • next_cursor (optional) if present indicates that the next chunk (page) exists and can be fetched using collection-specific endpoint and cursor value,
  • items a chunk (page) of unerlying collection items.

Status Endpoints

Query information about the Gateway API status.

Get Gateway Status

Returns the Gateway API version and current ledger state.

Responses
200

Network Gateway Information

post/status/gateway-status
Response samples
application/json
{
  • "ledger_state": {
    },
  • "release_info": {
    }
}

Get Network Configuration

Returns network identifier, network name and well-known network addresses.

Responses
200

Network Configuration

post/status/network-configuration
Response samples
application/json
{
  • "network_id": "<network-id>",
  • "network_name": "<network-name>",
  • "well_known_addresses": {
    }
}

Transaction Endpoints

Query status of, construct, preview and submit transactions.

Get Construction Metadata

Returns information needed to construct a new transaction including current epoch number.

Responses
200

Returns information needed to construct transaction.

post/transaction/construction
Response samples
application/json
{
  • "ledger_state": {
    }
}

Preview Transaction

Previews transaction against the network. This endpoint is effectively a proxy towards CoreApi's /v0/transaction/preview endpoint. See CoreApi's documentation for more details.

Request
Request Body schema: application/json
required
manifest
required
string

A text-representation of a transaction manifest

blobs_hex
Array of strings

An array of hex-encoded blob data (optional)

start_epoch_inclusive
required
integer <int64> [ 0 .. 10000000000 ]

An integer between 0 and 10^10, marking the epoch at which the transaction starts being valid

end_epoch_exclusive
required
integer <int64> [ 0 .. 10000000000 ]

An integer between 0 and 10^10, marking the epoch at which the transaction is no longer valid

object (PublicKey)
notary_is_signatory
boolean

Whether the notary should count as a signatory (optional, default false)

tip_percentage
required
integer <int32> [ 0 .. 255 ]

An integer between 0 and 255, giving the validator tip as a percentage amount. A value of 1 corresponds to 1% of the fee.

nonce
required
integer <int64> >= 0

A decimal-string-encoded integer between 0 and 2^32 - 1, used to ensure the transaction intent is unique.

required
Array of objects (PublicKey)

A list of public keys to be used as transaction signers

required
object
Responses
200

Successful Preview

4XX

Client-originated request error

post/transaction/preview
Request samples
application/json
{
  • "manifest": "string",
  • "blobs_hex": [
    ],
  • "start_epoch_inclusive": 10000000000,
  • "end_epoch_exclusive": 10000000000,
  • "notary_public_key": {
    },
  • "notary_is_signatory": true,
  • "tip_percentage": 255,
  • "nonce": 0,
  • "signer_public_keys": [
    ],
  • "flags": {
    }
}
Response samples
application/json
{
  • "encoded_receipt": "string",
  • "receipt": { },
  • "resource_changes": [
    ],
  • "logs": [
    ]
}

Submit Transaction

Submits a signed transaction payload to the network.

Request
Request Body schema: application/json
required
notarized_transaction_hex
required
string (NotarizedTransactionHexString)

Hex-encoded notarized transaction payload which can be submitted.

Responses
200

Successful Submission

4XX

Client-originated request error

post/transaction/submit
Request samples
application/json
{
  • "notarized_transaction_hex": "string"
}
Response samples
application/json
{
  • "duplicate": true
}

Get Committed Transaction Details

Returns the committed details and receipt of the transaction for a given transaction identifier. Transaction identifiers which don't correspond to a committed transaction will return a TransactionNotFoundError.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

intent_hash
required
string (HashBech32mString)

Bech32m-encoded hash.

object (TransactionDetailsOptIns)
Responses
200

Transaction Status

4XX

Client-originated request error

post/transaction/committed-details
Request samples
application/json
{
  • "intent_hash": "<transaction-intent-hash>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "transaction": {
    }
}

Get Transaction Status

Returns overall transaction status and all of its known payloads based on supplied intent hash.

Request
Request Body schema: application/json
required
intent_hash
required
string (HashBech32mString)

Bech32m-encoded hash.

Responses
200

Transaction Status

4XX

Client-originated request error

post/transaction/status
Request samples
application/json
{
  • "intent_hash": "<transaction-intent-hash>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "status": "Unknown",
  • "known_payloads": [
    ],
  • "error_message": "string"
}

Stream Endpoints

Browse through the history of transactions.

Get Transactions Stream

Returns transactions which have been committed to the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

kind_filter
string

Limit returned transactions by their kind. Defaults to user.

Enum: "User" "EpochChange" "All"
manifest_accounts_withdrawn_from_filter
Array of strings (Address)
manifest_accounts_deposited_into_filter
Array of strings (Address)
manifest_resources_filter
Array of strings (Address)
affected_global_entities_filter
Array of strings (Address)
Array of objects (StreamTransactionsRequestEventFilterItem)
order
string

Configures the order of returned result set. Defaults to desc.

Enum: "Asc" "Desc"
object (TransactionDetailsOptIns)
Responses
200

Transactions (paginated)

4XX

Client-originated request error

post/stream/transactions
Request samples
application/json
{
  • "limit_per_page": 5
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "next_cursor": "string",
  • "items": [
    ]
}

State Endpoints

Query information snapshot about state of ledger entities at present or past time.

Get Entity Details

Returns detailed information for collection of entities. Aggregate resources globally by default.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

object (StateEntityDetailsOptIns)
addresses
required
Array of strings (Address)
aggregation_level
string (ResourceAggregationLevel)
Enum: "Global" "Vault"
Responses
200

Entity Details

4XX

Client-originated request error

post/state/entity/details
Request samples
application/json
{
  • "addresses": [
    ],
  • "aggregation_level": "Vault",
  • "opt_ins": {
    }
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "items": [
    ]
}

Get Entity Metadata Page

Returns all the metadata properties associated with a given global entity. The returned response is in a paginated format, ordered by first appearance on the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

address
required
string (Address)

Bech32m-encoded human readable version of the address.

Responses
200

Entity Metadata (paginated)

4XX

Client-originated request error

post/state/entity/page/metadata
Request samples
application/json
{
  • "address": "<entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "next_cursor": "string",
  • "items": [
    ],
  • "address": "string"
}

Get Entity Fungible Resource Totals Page aggregated globally

Returns the total amount of each fungible resource owned by a given global entity. Result can be aggregated globally or per vault. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

address
required
string (Address)

Bech32m-encoded human readable version of the address.

aggregation_level
string (ResourceAggregationLevel)
Enum: "Global" "Vault"
object (StateEntityFungiblesPageRequestOptIns)
Responses
200

Entity Fungibles (paginated)

4XX

Client-originated request error

post/state/entity/page/fungibles/
Request samples
application/json
{
  • "address": "<component-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "next_cursor": "string",
  • "items": [
    ],
  • "address": "string"
}

Get vault page of Entity Fungible resource aggregated per vault

Returns vaults for fungible resource owned by a given global entity. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

address
required
string (Address)

Bech32m-encoded human readable version of the address.

resource_address
required
string (Address)

Bech32m-encoded human readable version of the address.

Responses
200

Entity Fungibles (paginated)

4XX

Client-originated request error

post/state/entity/page/fungible-vaults/
Request samples
application/json
{
  • "address": "<component-entity-address>",
  • "resource_address": "<resource_address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "next_cursor": "string",
  • "items": [
    ],
  • "address": "string",
  • "resource_address": "string"
}

Get Entity Non-Fungible Resource Totals Page aggregated globally

Returns the total amount of each non-fungible resource owned by a given global entity. Result can be aggregated globally or per vault. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

address
required
string (Address)

Bech32m-encoded human readable version of the address.

aggregation_level
string (ResourceAggregationLevel)
Enum: "Global" "Vault"
object (StateEntityNonFungiblesPageRequestOptIns)
Responses
200

Entity Non-Fungibles (paginated)

4XX

Client-originated request error

post/state/entity/page/non-fungibles/
Request samples
application/json
{
  • "address": "<component-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "next_cursor": "string",
  • "items": [
    ],
  • "address": "string"
}

Get vault page of Entity Non Fungible aggregated per vault

Returns vaults for non fungible resource owned by a given global entity. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

address
required
string (Address)

Bech32m-encoded human readable version of the address.

resource_address
required
string (Address)

Bech32m-encoded human readable version of the address.

object (StateEntityNonFungibleResourceVaultsPageOptIns)
Responses
200

Entity Fungibles (paginated)

4XX

Client-originated request error

post/state/entity/page/non-fungible-vaults/
Request samples
application/json
{
  • "address": "<component-entity-address>",
  • "resource_address": "<resource_address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "next_cursor": "string",
  • "items": [
    ],
  • "address": "string",
  • "resource_address": "string"
}

Get Entity Non-Fungible IDs

Returns all non-fungible IDs of a given non-fungible resource owned by a given entity. The returned response is in a paginated format, ordered by the resource's first appearence on the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

address
required
string (Address)

Bech32m-encoded human readable version of the address.

vault_address
required
string (Address)

Bech32m-encoded human readable version of the address.

resource_address
required
string (Address)

Bech32m-encoded human readable version of the address.

Responses
200

Entity Non-Fungible IDs (paginated)

4XX

Client-originated request error

post/state/entity/page/non-fungible-vault/ids
Request samples
application/json
{
  • "address": "<component-entity-address>",
  • "resource_address": null,
  • "vault_address": null
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "next_cursor": "string",
  • "items": [
    ],
  • "address": "string",
  • "resource_address": "string"
}

Get Non-Fungible Collection

Returns the non-fungible IDs of a given non-fungible resource. Returned response is in a paginated format, ordered by their first appearance on the ledger.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit_per_page
integer or null

The page size requested.

resource_address
required
string (Address)

Bech32m-encoded human readable version of the address.

Responses
200

Non-Fungible IDs (paginated)

4XX

Client-originated request error

post/state/non-fungible/ids
Request samples
application/json
{
  • "resource_address": "<non-fungible-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "resource_address": "string",
  • "non_fungible_ids": {
    }
}

Get Non-Fungible Data

Returns data associated with a given non-fungible ID of a given non-fungible resource.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

resource_address
required
string (Address)

Bech32m-encoded human readable version of the address.

non_fungible_ids
required
Array of strings (NonFungibleId)
Responses
200

Non-Fungible ID Data

4XX

Client-originated request error

post/state/non-fungible/data
Request samples
application/json
{
  • "resource_address": "<non-fungible-entity-address>",
  • "non_fungible_ids": [
    ]
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "resource_address": "string",
  • "non_fungible_id_type": "String",
  • "non_fungible_ids": [
    ]
}

Get Non-Fungible Location

Returns location of a given non-fungible ID.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

resource_address
required
string (Address)

Bech32m-encoded human readable version of the address.

non_fungible_ids
required
Array of strings (NonFungibleId)
Responses
200

Non-Fungible ID Location

4XX

Client-originated request error

post/state/non-fungible/location
Request samples
application/json
{
  • "resource_address": "<non-fungible-entity-address>",
  • "non_fungible_ids": [
    ]
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "resource_address": "string",
  • "non_fungible_ids": [
    ]
}

Get KeyValueStore Data

Returns data (value) associated with a given key of a given key-value store.

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

key_value_store_address
required
string (Address)

Bech32m-encoded human readable version of the address.

required
Array of objects (StateKeyValueStoreDataRequestKeyItem)
Responses
200

Non-Fungible ID Data

4XX

Client-originated request error

post/state/key-value-store/data
Request samples
application/json
{
  • "key_value_store_address": "<key-value-store-address>",
  • "keys": [
    ]
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "key_value_store_address": "string",
  • "entries": [
    ]
}

Get Validators List

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

Responses
200

Validators List

4XX

Client-originated request error

post/state/validators/list
Request samples
application/json
{
  • "at_ledger_state": null
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "validators": {
    }
}

Statistics Endpoints

Calculate particular statistics based on current or historic ledger state.

Get Validators Uptime

Request
Request Body schema: application/json
required
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

validator_addresses
Array of strings (Address)
Responses
200

Validators Uptime

4XX

Client-originated request error

post/statistics/validators/uptime
Request samples
application/json
{
  • "at_ledger_state": {
    },
  • "from_ledger_state": {
    },
  • "validator_addresses": [
    ]
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "validators": {
    }
}