For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

Fuel — Methods (2/2)

API reference for Fuel. All methods ->

Part 2 of 2: 1 · 2

getLatestBlock

Retrieves the most recent block on the network.

Parameters

None.

Returns

  • data (object): the data object with the following fields:
    • chain (object): the object representing the blockchain network info:
      • latestBlock (object): the object containing details of the latest block on the network.
        • id (string): the unique identifier (hash) of the latest block.
        • height (string): the block height of the latest block.

Request example

curl --location 'https://rpc.ankr.com/http/fuel' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"query": "{ chain { latestBlock { id height } } }"
}'

Response example

{
"data": {
"chain": {
"latestBlock": {
"id": "0x1cd6d6725bb58123623e8a60de42f269252dbf0df8922e27e45b9e894bffeea7",
"height": "13781885"
}
}
}
}

getBlockByHeight

Retrieves info on a block specified by height.

Parameters

  • height (string; required): the height of the block.

Returns

  • data (object): the data object with the following fields:
    • block (object): the object with the queried block info.
      • id (string): the unique identifier (hash) of the block.

Request example

curl --location 'https://rpc.ankr.com/http/fuel' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"query": "query Block($height: U64) { block(height: $height) { id } }",
"variables": {
"height": "3000"
}
}'

Response example

{
"data": {
"block": {
"id": "0xe4f573c8ba98085d8006d64176587720f166e761558a6f13fb40ad884d5db52c"
}
}
}

getBlockById

Retrieves info on a block specified by ID.

Parameters

  • id (string; required): a unique hash identifier for a block.

Returns

  • data (object): the data object with the following fields:
    • block (object): the object representing a specific block info.
      • id (string): the unique identifier (hash) of the block.
      • height (string): the height of the block.
      • transactions (array): an array of transactions included in the block.
        • id (string): the unique identifier (hash) of each transaction in the block.

Request example

curl --location 'https://rpc.ankr.com/http/fuel' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"query": "query BlockById($id: BlockId!) { block(id: $id) { id height transactions { id } } }",
"variables": {
"id": "0xe4f573c8ba98085d8006d64176587720f166e761558a6f13fb40ad884d5db52c"
}
}'

Response example

{
"data": {
"block": {
"id": "0xe4f573c8ba98085d8006d64176587720f166e761558a6f13fb40ad884d5db52c",
"height": "3000",
"transactions": [
{
"id": "0x9dd04fce60b052963d8131c3e956a80e9a413363bae4f06a0ed0eeb575e24e0d"
}
]
}
}
}

getMessagesByAddress

Retrieves all messages of a given address.

Parameters

  • address (string; required): the address to fetch the messages for.

Returns

  • data (object): the data object with the following fields:
    • blocks (object): the object representing the queried block info.
      • amount (string): the amount of the message.
      • sender (string): the address of the message sender.
      • recipient (string): the address of the message destination.
      • nonce (string): a unique identifier associated with the message.
      • data (string): an optional additional data included in the message.

Request example

curl --location 'https://rpc.ankr.com/http/fuel' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"query": "query MessageInfo($address: Address) { messages(owner: $address, first: 5) { nodes { amount sender recipient nonce data daHeight } } }",
"variables": {
"address": "0xce9f8d9367fc4671c0ececce7ab603f6f75d1e66082a82ad12ecdc219b308820"
}
}'

Response example

{
"data": {
"messages": {
"nodes": []
}
}
}

dryRunTransaction

Simulates a transaction without broadcasting it.

Parameters

  • encodedTransaction (string: required): the hex-encoded transaction.
  • utxoValidation (boolean; required): a UTXO validation selector.

Returns

  • data (object): the data object with the following fields:
    • dryRun (array): an array representing the simulated transaction result.
      • receiptType (string): the type of receipt generated by the simulation.
      • data (string): the hexadecimal data associated with the transaction outcome.

Request example

curl --location 'https://rpc.ankr.com/http/fuel' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"query": "mutation DryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) { dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) { receiptType data } }",
"variables": {
"encodedTransaction": "YOUR_ENCODED_TRANSACTION_HERE",
"utxoValidation": true
}
}'

submitTransaction

Submits a transaction to the network.

Parameters

  • encodedTransaction (string: required): the hex-encoded transaction.

Returns

  • data (object): the data object with the following fields:
    • submit (object): result of the submit mutation:
      • id (string): the unique transaction ID generated upon transaction submission.

Request example

curl --location 'https://rpc.ankr.com/http/fuel' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"query": "mutation submit($encodedTransaction: HexString!) { submit(tx: $encodedTransaction) { id } }",
"variables": {
"encodedTransaction": "YOUR_ENCODED_TRANSACTION_HERE"
}
}'