eth_getTransactionByBlockNumberAndIndex
Returns information about a transaction by block number and transaction index position.
Example
curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
-X POST
-H "Content-Type: application/json"
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\": [\"0x6F3620\", \"0x0\"],\"id\":1}"
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params": ["0x6F3620", "0x0"],"id":1}'
BLOCK PARAMETER
- An int
block number in the form of hex, appended with 0x such as 0x6D7FE0
, or pre-defined strings latest
, earliest
, pending
.
TRANSACTION INDEX POSITION
- a hex of the integer representing the position in the block, appended with 0x such as 0x0
.
Result Fields
TRANSACTION
- A transaction object, or null when no transaction was found
Within the transaction object, the following information are available.
blockHash
: 32 Bytes - hash of the block where this transaction was in, null when its pending.
blockNumber
: block number where this transaction was in, null when its pending.
from
: 20 Bytes - address of the sender.
gas
: gas provided by the sender.
gasPrice
: gas price provided by the sender in Wei.
hash
: 32 Bytes - hash of the transaction.
input
: the data send along with the transaction.
nonce
: the number of transactions made by the sender prior to this one.
to
: 20 Bytes - address of the receiver. null when its a contract creation transaction.
transactionIndex
: integer of the transactions index position in the block. null when its pending.
value
: value transferred in Wei.
Body
{
"jsonrpc":"2.0",
"id":1,
"result":{
"blockHash":"0xe84fe3e06769f2bc5bae419de2c68a6f58917feb1c9fe7fa22abe9685b09412d",
"blockNumber":"0x6f3620",
"from":"0x4cf8800ccc0a56396f77b1e7c46160f5df0e09a5",
"gas":"0x186a0",
"gasPrice":"0x5d21dba00",
"hash":"0x6c46e09a9a0d563ceb540ff32204e43f63090f8a28f1240ebde6f3aef6481a28",
"input":"0xa9059cbb000000000000000000000000e926e07abd2aa8170cef9ecfad6e2e65af7cceaa000000000000000000000000000000000000000000000000a4c81fda4bf52000",
"nonce":"0x406c",
"to":"0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
"transactionIndex":"0x0",
"value":"0x0",
"v":"0x93",
"r":"0xbe9f336c68ef336fcf03fed1d4c8fa6f51beb092056f2201a28e1f59d465ef7e",
"s":"0x5f28510ad969b4faf8ca648900d8e5ab961761b940b5908a6e85db69db383c96"
}
}