curl --request POST \
--url https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [
"0x1aadf3889f14f7f4adbd176e4b9efccc144c6123f52c76bfafc8224f66cd1d52",
"0x35"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
curl --request POST \
--url https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [
"0x1aadf3889f14f7f4adbd176e4b9efccc144c6123f52c76bfafc8224f66cd1d52",
"0x35"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
hash
— the hash of the blockquantity
— the integer identifying the transaction index position within the block, encoded as hexadecimalobject
— a transaction response object, or null
if no transaction is found:
blockHash
— the block hash. Identifies the block in which the transaction was included. This field is null
for transactions that have not yet been included in a block.blockNumber
— the number of the block in which the transaction was included. This field is null
for transactions that have not yet been included in a block.from
— the address of the sender who initiated the transaction.gas
— the units of gas included in the transaction by the sender.gasPrice
— the price of gas in Wei included in the transaction by the sender.maxFeePerGas
— the maximum amount the transaction’s sender is willing to pay per unit of gas for the transaction to be executed.maxPriorityFeePerGas
— the maximum priority fee the transaction sender is willing to pay per unit of gas.hash
— the hash that uniquely identifies the transaction.input
— the optional input data sent with the transaction, usually used to interact with smart contracts.nonce
— a counter identifying the transaction’s number sent by the sender’s wallet. It essentially identifies how many transactions an account has made. Used to ensure each transaction is executed only once.to
— the recipient’s address of the transaction if it was a transaction to an address. For contract creation transactions, this field is null
.transactionIndex
— the index of the transaction within the block. It is null
for transactions that have not yet been included in a block.value
— the value of the native token transferred along with the transaction, in Wei.type
— the type of the transaction. 0
indicates a regular transfer; 2
indicates a contract creation or smart contract function call.accessList
— a list of authorized addresses and storage keys with which the transaction plans to interact.v
— the recovery parameter in the Ethereum Signature Algorithm (ECDSA).r
— the first component of the signature in the Ethereum Signature Algorithm (ECDSA).s
— the second component of the signature in the Ethereum Signature Algorithm (ECDSA).eth_getTransactionByBlockHashAndIndex
code examplesconst { Web3 } = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
async function getTransaction() {
const transaction = await web3.eth.getTransactionFromBlock("0x7a2d5056c1aa293e94b19dd6cb4e2893442338586c7c736855490e02c7e627fe", 22);
console.log(transaction);
}
getTransaction();
eth_getTransactionByBlockHashAndIndex
can be used to retrieve transaction details from a block.The transaction information
The response is of type object
.