/construction/metadata

POST https://rosetta.s0.b.hmny.io/construction/metadata

Overview

This endpoint is online.

This endpoint gets any on-chain (live) information required to construct a transaction.

Reference Rosetta Documentation

Harmony Specific Documentation

Metadata fetched from chain

All data fetch on-chain is returned in the metadata. Below is a brief explanation of each field that a client could consume for construction:

KeyValue TypeValue Description
contract_codeStringHex encoded bytes of the main contract called by the transaction (if applicable).
evm_error_messageStringEVM error message from an evaluation of the transaction smart contract data (if applicable). Empty string if no error message.
evm_returnStringHex encoded bytes of the returned EVM data from an evaluation of the transaction smart contract data (if applicable).
gas_limitIntThe maximum amount of gas 'units' that the transaction's data can consume in the EVM before aborting.
gas_priceIntThe price in ATTO (1 ONE = 1e18 ATTO) per unit of gas. The minimum is 1e9 ATTO (or 1 NANO). Note that this is the number that gets scaled with the suggested_fee_multiplier.
nonceIntThe transaction number (on a specific shard) for the sender's account
transaction_metadataObjectThe transaction metadata (unchanged) from /construction/preprocess

Fee

The suggested_fee is an over estimation of how much it will cost to execute the operation(s) in a transaction.

In the case that your transaction's contract call has an infinite loop, you will see an error that says that you have exceeded the gas cap of the block.

Request Body

{"network_identifier"=>{"blockchain"=>"Harmony", "network"=>"Testnet", "sub_network_identifier"=>{"network"=>"shard 0", "metadata"=>{"is_beacon"=>true}}}, "options"=>{"gas_price_multiplier"=>2, "operation_type"=>"NativeTransfer", "transaction_metadata"=>{"to_shard"=>0, "from_shard"=>0}}, "public_keys"=>[{"hex_bytes"=>"03f91adb1671a2430484441b591bdad19358458e938ba291bf9e717031b6c3330d", "curve_type"=>"secp256k1"}]}

RESPONSES

status: OK

{"metadata":{"contract_code":"0x","evm_error_message":"","evm_return":"0x","gas_limit":21000,"gas_price":2000000000,"nonce":0,"transaction_metadata":{"to_shard":0,"from_shard":0}},"suggested_fee":[{"value":"42000000000000","currency":{"symbol":"ONE","decimals":18}}]}