Sonic — web3, net, eth (3/3)
API reference for Sonic. All methods ->
eth_getTransactionByBlockNumberAndIndex
Returns information on a transaction by block number and transaction index position.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(quantity|tag): either the hex value of a block number or one of the following block tags:earliest: the lowest numbered block available on the client.finalized: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending: a sample next block built by the client on top of thelatestand containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<string>(quantity): the transaction index position.
Returns
blockHash(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber(string; quantity): a number of the block containing the transaction; null when it's pending.from(string; data, 20 bytes): an address of the sender.gas(string; quantity): the gas provided by the sender.gasPrice(string; quantity): the gas price provided by the sender in wei.hash(string; data, 32 bytes): the hash of the transaction.input(string; data): the data send along with the transaction.nonce(string; quantity): the number of transactions made by the sender prior to this one.to(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex(string; quantity): the transaction index position in the block; null when it's pending.value(string; quantity): the value transferred in wei.v(string; quantity): ECDSA recovery ID.r(string; quantity): ECDSA signature r.s(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/sonic_mainnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": ["0x521B8", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x82fe8e8aec1d5faabe61c618e5fff17127b0a6ea881be2383f6cb5f829ef563b",
"blockNumber": "0x521b8",
"from": "0xa66b0798e5f3812d84a91e5d14723c1c90fb2d00",
"gas": "0x26812",
"gasPrice": "0x4190ab00",
"maxFeePerGas": "0x4190ab00",
"maxPriorityFeePerGas": "0x4190ab00",
"hash": "0x844f55303dc97b4e71f9669acd6efad3dcc6e7e727c3a14ea3cbd243dee195a8",
"input": "0x84bb1e42000000000000000000000000a66b0798e5f3812d84a91e5d14723c1c90fb2d000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000c28f219c40000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000c28f219c400000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0",
"to": "0x13c42cccedb63ccb8980f3b2135e1bd5630269af",
"transactionIndex": "0x0",
"value": "0xc28f219c400",
"type": "0x2",
"accessList": [],
"chainId": "0x92",
"v": "0x1",
"r": "0xfad93fb7b0d204241bdbe082857e9b37c5cc085eca348ee1159fb2887615af5",
"s": "0x2ffe202fe44c01158896f8b6f9d15b4da730eee52102fa3b69b9a697d0841cb8",
"maxFeePerBlobGas": null,
"blobVersionedHashes": null
}
}