Updated on 2024-11-14 GMT+08:00

eth_getTransactionByBlockNumberAndIndex

Introduction

This API returns information about a transaction by a block number and transaction index position. It consumes 20 CUs.

Parameter Description

Parameter

Type

Description

Block number

String

A hexadecimal block number, or the string (earliest, latest, or pending).

Index

String

The transaction index position encoded as a hexadecimal.

Return Value

  • Object: A transaction object with the following fields, or null when no transaction was found:
    • blockHash: the hash of the block where this transaction was in. It is null for a pending log.
    • blockNumber: the number of the block where this transaction was in. It is null for a pending log.
    • from: the address of the sender.
    • gas: the gas provided by the sender in hexadecimal.
    • gasPrice: the gas price provided by the sender in wei encoded as hexadecimal.
    • maxFeePerGas: the maximum fee per gas set in the transaction.
    • maxPriorityFeePerGas: the maximum priority gas fee set in the transaction.
    • hash: the hash of the transaction.
    • input: the data sent along with the transaction.
    • nonce: the number of transactions made by the sender prior to this one encoded as hexadecimal.
    • to: the address of the receiver. It is null for a contract creation transaction.
    • transactionIndex: the integer of the transactions index position from which this log was created. It is null for a pending log.
    • value: the value transferred in wei encoded as hexadecimal.
    • type: the transaction type.
    • accessList: a list of addresses and storage keys that the transaction plans to access.
    • chainId: the transaction chain ID, if any.
    • v: the standard V field of the signature.
    • r: the R field of the signature.
    • s: the S field of the signature.

Request

curl https://your-http-endpoint/v1/<API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_getTransactionByBlockNumberAndIndex","params":["0xc5043f", "0x0"],"id":1,"jsonrpc":"2.0"}'