eth_getTransactionByBlockNumberAndIndex
Returns information about a transaction by block number and transaction index position.
Parameters
QUANTITY|TAG
- a block number, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.QUANTITY
- the transaction index position.
Returns
Example
NOTE: In this example we are using public Ethereum endpoint. Ideally, for your own projects, you should use your own endpoint, which you can generate for free by connecting to your wallet here.
Query
NOTE: ethers
used below is a well-known web3 library, check it out here.
import { ethers } from 'ethers';
const provider =
new ethers
.providers
.JsonRpcProvider("https://www.noderpc.xyz/rpc-mainnet/public")
provider.send('eth_getTransactionByBlockNumberAndIndex', ["0xc5043f", "0x0"]).then((tx) => {
console.log(tx);
});
Result
{
"blockHash": "0xa917fcc721a5465a484e9be17cda0cc5493933dd3bc70c9adbee192cb419c9d7",
"blockNumber": "0xc5043f",
"from": "0xc4a675c5041e9687768ce154554d6cddd2540712",
"gas": "0xf4240",
"gasPrice": "0x0",
"hash": "0x23e3362a76c8b9370dc65bac8eb1cda1d408ac238a466cfe690248025254bf52",
"input": "0x1cff79cd000000000000000000000000a4a69bd8a6c99d754566da6544438e1b5973591e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a48c983612000000000000000000000000cba47689202d31575bfa204efe70e2c83d29da4d0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c00000000000000000000000056178a0d5f301baf6cf3e1cd53d9863437345bf9000000000000000000000000fee7eeaa0c2f3f7c7e6301751a8de55ce4d059ec00000000000000000000000000000000000000000000000000000000005b8d8000000000000000000000000000000000000000000000000000000000b2d05e0000000000000000000000000000000000000000000000000000004fd88ce2b8b600000000000000000000000000000166a1f7cf9ecbf2cca9726da712b7c8000000000000000000000000000000000000000000022e7b8d2ad6442e7f6a000000000000000000000000000000000000000000000000000000000000006100bcfa000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
"nonce": "0x607d",
"to": "0xa57bd00134b2850b2a1c55860c9e9ea100fdd6cf",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x1",
"accessList": [
{
"address": "0x52ae12abe5d8bd778bd5397f99ca900624cfadd4",
"storageKeys": [
"0x44a5b8b1e63f53ad70167c41a4041b0b6b5f14adc886eec519dc90e1b14375a8",
"0xd2a7b5b83c07b6760039cbccd0ca2f18d89b23c34a5d5e4463285f2a3e2468ff"
]
},
{
"address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000005",
"0xb547c99775228368f713c105c8e2569f4eeff64049f0a04e27adaf502cb32256",
"0xf7c84b5d1f3a0563cd20b346c00dcaaaf749870e80d340ce8dc6213863709a60"
]
},
{
"address": "0x2f9ec37d6ccfff1cab21733bdadede11c823ccb0",
"storageKeys": [
"0x2f97bae778107453c9fa4e71a644cd0a05ed4723a03b3b8af2d1b088c870a29b",
"0xb60d239ff9659f468f86510b3362e39665434128808acc7ec01162d3cdd1cd06",
"0x0000000000000000000000000000000000000000000000000000000000000002",
"0x0000000000000000000000000000000000000000000000000000000000000003"
]
},
{
"address": "0xfee7eeaa0c2f3f7c7e6301751a8de55ce4d059ec",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000006"
]
},
{
"address": "0xa4a69bd8a6c99d754566da6544438e1b5973591e",
"storageKeys": []
},
{
"address": "0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c",
"storageKeys": [
"0x0a5f22deea0e0bbeb15c6065e354e3a681aaa10b5580c8d340f29a6863bfb7e8",
"0x5befb1066c6de63d54074968889df3b90a145629cf3f823ddbe406d3d4591678",
"0x6f50e4502f0b091d7555b01ede4a5d06ca92c50d65b9e6d40a485b6943f37cd4",
"0x000000000000000000000000000000000000000000000000000000000000000a",
"0x1c3b3c94d0c72b7f21d200ecbc5f69f7566fc1cfb938be71bdf5893d4003db1a",
"0x16f6374328f5eeb369ad19d3c5c4511c1edf435a758c4f3ceb6ff39313cbc048"
]
},
{
"address": "0xcba47689202d31575bfa204efe70e2c83d29da4d",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000005",
"0x000000000000000000000000000000000000000000000000000000000000000a",
"0x0000000000000000000000000000000000000000000000000000000000000004",
"0x0000000000000000000000000000000000000000000000000000000000000009",
"0x609d0718fd54704574dad7ab71221534c39a496e9d44b963a09c499af4f67393",
"0x0000000000000000000000000000000000000000000000000000000000000002",
"0xf0143fb5658938af6c252334909b934918a50cd50669454a3dfc1f115b325d7f"
]
}
],
"chainId": "0x1",
"v": "0x1",
"r": "0xee6dabd2507fa02fff121c94a4546d1a9f961aae30d813d58f3536c60c64921",
"s": "0x5585a3cfc0cd639bf786e0b8f2bd4fd4471a7aa70cb10d93d0b2bee8064914c1"
}
Last updated