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

eth_getTransactionByBlockHashAndIndex

Introduction

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

Parameter Description

Parameter

Type

Description

Transaction hash

String

The hash of a transaction.

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_getTransactionByBlockHashAndIndex","params":["0x81e807e7a6031d9f103eeee2a2edc5994c3432ee1e3227c66ff78eef30ea1dec","0x0"],"id":1,"jsonrpc":"2.0"}'