eth_getTransactionByBlockNumberAndIndex
Returns information about a transaction by block number and transaction index position.
Params
- a string array containing (required):QUANTITY|TAG(hex string|string, required)
- integer block number in hex string format, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.QUANTITY(hex string, required)
- the transaction index position.
Object
- A transaction object, or null
when no transaction was found:blockHash(hex string)
.DATA
, 32 Bytes - hash of the block where this transaction was in.null
when its pending.blockNumber(hex string)
.QUANTITY
- block number where this transaction was in.null
when its pending.from(hex string)
.DATA
, 20 Bytes - address of the sender.gas(hex string)
.QUANTITY
- gas provided by the sender.gasPrice(hex string)
.QUANTITY
- gas price provided by the sender in Wei.hash(hex string)
.DATA
, 32 Bytes - hash of the transaction.input(hex string)
.DATA
- the data send along with the transaction.nonce(hex string)
.QUANTITY
- the number of transactions made by the sender prior to this one.to(hex string)
.DATA
, 20 Bytes - address of the receiver.null
when its a contract creation transaction.transactionIndex(hex string)
.QUANTITY
- integer of the transactions index position in the block.null
when its pending.value(hex string)
.QUANTITY
- value transferred in Wei.v(hex string)
.QUANTITY
- ECDSA recovery id.r(hex string)
.DATA
, 32 Bytes - ECDSA signature r.s(hex string)
.DATA
, 32 Bytes - ECDSA signature s.
curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params":["0x52a90b","0x25"],
"id": 1
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.BNB_MAINNET)
// Access BlockVision Enhanced API requests
bv.getBlockTransactionByIndex('0x52a90b', '0x25').then(console.log)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x785b221ec95c66579d5ae14eebe16284a769e948359615d580f02e646e93f1d5",
"blockNumber": "0x52a90b",
"from": "0x11b6a5fe2906f3354145613db0d99ceb51f604c9",
"gas": "0x6b6c",
"gasPrice": "0x11e1a300",
"hash": "0xb2fea9c4b24775af6990237aa90228e5e092c56bdaee74496992a53c208da1ee",
"input": "0x80dfa34a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002e516d556558334448416654747442464a42315454384a617a67765744776a727a7342686973693473547532613551000000000000000000000000000000000000",
"nonce": "0x10",
"to": "0xfa28ec7198028438514b49a3cf353bca5541ce1d",
"transactionIndex": "0x25",
"value": "0x0",
"type": "0x0",
"v": "0x26",
"r": "0xacdf839bdcb6653da60900f739076a00ecbe0059fa046933348e9b68a62a222",
"s": "0x132a0517a4c52916e0c6b0e74b0479326891df2a9afd711482c7f3919b335ff6"
}
}
Last modified 1mo ago