eth_getTransactionByBlockNumberAndIndex
Returns information about a transaction given block number and transaction index position.
Parameters
block number: (string) [Required] A string representing the number of a block.transaction index: [Required] A hexadecimal of the integer position in the block.
Returns
A transaction object, or null when no transaction was found. The transaction object will consist of the following keys and their values:
accessList: A list of addresses and storage keys accessed by the transaction. See access list transactions.blockHash: 32 bytes. A hash of the block including this transaction.nullwhen it's pending.blockNumber: The number of the block including this transaction.nullwhen it's pending.chainID: chain ID specifying the network. Returned only for EIP-1559 transactions.from: 20 bytes. The address of the sender.gas: Gas provided by the sender.gasPrice: Gas price provided by the sender (in wei).hash: 32 bytes. The hash of the transaction.input: The data sent along with the transaction.maxPriorityFeePerGas: Maximum fee (in wei) the sender is willing to pay per gas above the base fee. See EIP-1559 transactions.maxFeePerGas: [optional] Maximum total fee (base fee + priority fee, in wei) the sender is willing to pay per gas. See EIP-1559 transactions.nonce: The number of transactions made by the sender prior to this one.r: 32 bytes. The ECDSA signaturer.s: 32 bytes. The ECDSA signatures.to: 20 bytes. The address of the receiver.nullwhen it's a contract creation transaction.transactionIndex: The transaction's index position in the block, in hexadecimal.nullwhen it's pending.type: The transaction type.v: The ECDSA recovery ID.value: The value transferred (in wei).yParity: Parity (0x0for even,0x1for odd) of the y-value of asecp256k1signature.
Example
Request
curl https://rpc.testnet.radiustech.xyz/<YOUR-RPC-ENDPOINT> \
-X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [
"1738267480915",
"0x0"
],
"id": 1
}
'Response
{
"jsonrpc": "2.0",
"result": 1,
"id": 1
}This method does not work as expected using cast, but we are looking into it.
Workaround: Use curl or eth_getBlockTransactionCountByHash instead.
Request
cast rpc eth_getTransactionByBlockNumberAndIndex \
1738267480915 \
0x0 \
--rpc-url https://rpc.testnet.radiustech.xyz/<YOUR-RPC-ENDPOINT>Response
Error: server returned an error response: error code -32602: Invalid params, data: "invalid type: integer `1738267480915`, expected a string at line 1 column 13"Last updated
Was this helpful?

