POST
/
construction
/
metadata
Get Metadata for Transaction Construction
curl --request POST \
  --url https://example.com/construction/metadata \
  --header 'Content-Type: application/json' \
  --data '{
  "network_identifier": {
    "blockchain": "bitcoin",
    "network": "mainnet",
    "sub_network_identifier": {
      "network": "shard 1",
      "metadata": {
        "producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
      }
    }
  },
  "options": {},
  "public_keys": [
    {
      "hex_bytes": "<string>",
      "curve_type": "secp256k1"
    }
  ]
}'
{
  "metadata": {
    "account_sequence": 23,
    "recent_block_hash": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
  },
  "suggested_fee": [
    {
      "value": "1238089899992",
      "currency": {
        "symbol": "BTC",
        "decimals": 8,
        "metadata": {
          "Issuer": "Satoshi"
        }
      },
      "metadata": {}
    }
  ]
}

Body

application/json

A ConstructionMetadataRequest is utilized to get information required to construct a transaction. The Options object used to specify which metadata to return is left purposely unstructured to allow flexibility for implementers. Options is not required in the case that there is network-wide metadata of interest. Optionally, the request can also include an array of PublicKeys associated with the AccountIdentifiers returned in ConstructionPreprocessResponse.

network_identifier
object
required

The network_identifier specifies which network a particular object is associated with.

options
object

Some blockchains require different metadata for different types of transaction construction (ex: delegation versus a transfer). Instead of requiring a blockchain node to return all possible types of metadata for construction (which may require multiple node fetches), the client can populate an options object to limit the metadata returned to only the subset required.

public_keys
object[]

Response

Expected response to a valid request

The ConstructionMetadataResponse returns network-specific metadata used for transaction construction. Optionally, the implementer can return the suggested fee associated with the transaction being constructed. The caller may use this info to adjust the intent of the transaction or to create a transaction with a different account that can pay the suggested fee. Suggested fee is an array in case fee payment must occur in multiple currencies.

metadata
object
required
Example:
{
"account_sequence": 23,
"recent_block_hash": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
}
suggested_fee
object[]