eth_getTransactionByBlockNumberAndIndex - Optimism

eth_getTransactionByBlockNumberAndIndex. Retrieves a transaction based on its block number and index

eth_getTransactionByBlockNumberAndIndex - optimism [Value: 13CU]
Retrieves a specific transaction from a block by its number and index position
Use cases

Use cases

  • Retrieve transaction details by block number and index
  • Verify transaction order within a specific block
  • Audit transactions for a given block and index
Constraints

Constraints

  • Requires valid block number and index
  • Node must be synchronized with the blockchain
  • Accurate input parameters are necessary for results
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl https://optimism.drpc.org \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_getTransactionByBlockNumberAndIndex","params":["0xc5043f", "0x0"],"id":1,"jsonrpc":"2.0"}'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xb1770efb14906e509893b6190359658208ae64d0c56e22f748a1b0869885559e"
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray of strings
array of strings
blockNumberstring
(optional) Block number as an integer, or string
  • latest [default] - The most recent block in the blockchain (default).
  • earliest - The first block, also known as the genesis block.
  • pending - Transactions that have been broadcast but not yet included in a block.
indexstring
The index position of the transaction within the block, specified as an integer or a hexadecimal string.

Response

200
Detailed transaction object if found, or null if no transaction is found at the given index.

Response params

object
idinteger
jsonrpcstring
resultarray_of_objects
object
blockHashstring
Hash of the block containing the transaction.
blockNumberstring
Block number containing the transaction.
transactionIndexstring
Position of the transaction in the block (null if pending)
noncestring
Number of prior transactions from the sender.
hashstring
32 Bytes - hash of the transaction.
fromstring
Transaction hash.
gasstring
Gas provided by the sender.
gasPricestring
Gas price provided by the sender in wei.
inputstring
Data sent with the transaction.
rstring
ECDSA signature r.
sstring
ECDSA signature r.
tostring
Receiver's address (null if contract creation).
vstring
ECDSA recovery id.
valuestring
Value transferred in Wei.