Skip to main content

Construction-metadata

Intermediate
Tutorial

Overview

This section details how to call the construction/metadata endpoint of the Rosetta construction API. The request and response types can be found in the official documentation.

How to fetch metadata from the ICP ledger

An example of a call to the metadata endpoint can be found below:

curl --location '0.0.0.0:8081/construction/metadata'  --header 'Content-Type: application/json' --data '{
"network_identifier": {
"blockchain": "Internet Computer",
"network": "00000000000000020101"
},
"options": {
"request_types": [
"TRANSACTION"
]
},
"public_keys": [
{
"hex_bytes": "047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c757367",
"curve_type": "secp256k1"
}
]
}'

The response would resemble the following:

{"metadata":{},"suggested_fee":[{"value":"10000","currency":{"symbol":"ICP","decimals":8}}]}

For the request type TRANSACTION the metadata includes the suggested fee for this operation. In the case of the ICP ledger this fee is 10_000 e8s of ICP.