For the complete documentation index, see llms.txt. This page is also available as Markdown.

construction/metadata - Cardano

Example code for the construction/metadata JSON-RPC method. Complete guide on how to use construction/metadata JSON-RPC in GetBlock Web3 documentation.

This endpoint returns the online metadata needed to construct a transaction, such as the current fee parameters and time-to-live, from the options produced by preprocess.

Parameters

The request body is a JSON object with the following fields.

Field
Type
Required
Description

network_identifier

object

Yes

The network to construct for

options

object

Yes

The options returned by the preprocess endpoint

public_keys

array

No

Public keys required for the transaction

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/construction/metadata' \
--header 'Content-Type: application/json' \
--data-raw '{
    "network_identifier": {
        "blockchain": "cardano",
        "network": "mainnet"
    },
    "options": {
        "relative_ttl": 1000,
        "transaction_size": 246
    }
}'
example.js
const response = await fetch(
    'https://go.getblock.io/<ACCESS-TOKEN>/construction/metadata',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"network_identifier": {"blockchain": "cardano", "network": "mainnet"}, "options": {"relative_ttl": 1000, "transaction_size": 246}})
    }
);
console.log(await response.json());

Response

Response Parameters

Field
Type
Description

metadata

object

Metadata required to build the transaction, such as ttl

suggested_fee

array

The suggested fee for the transaction, in ada

Use Cases

  • Fee Fetching: Read the suggested fee before building payloads

  • TTL Resolution: Resolve the absolute time to live from relative options

  • Online Step: Fetch chain-dependent metadata for construction

  • Transaction Building: Feed metadata into the payloads endpoint

Error Handling

Error Code
Message
Description

1

Invalid request

A required construction field is missing or malformed

6

Transaction decode failed

The supplied transaction could not be decoded

14

Invalid signature

A supplied signature is malformed or does not match

5

Internal error

The node failed to process the construction step

Last updated

Was this helpful?