eth_getTransactionByBlockHashAndIndex - Optimism
Example code for the eth_getTransactionByBlockHashAndIndex json-rpc method. Сomplete guide on how to use eth_getTransactionByBlockHashAndIndex json-rpc in GetBlock.io Web3 documentation.
Parameters
Parameter
Type
Description
Required
Request Sample
curl --location 'https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [
"0x90caa11f7bec1b9836af2ff235ccce608fbd826b6c3dbc7928ffe94869c59da2",
"0x0"
],
"id": "getblock.io"
}'import axios from 'axios'
let data = JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [
"0x90caa11f7bec1b9836af2ff235ccce608fbd826b6c3dbc7928ffe94869c59da2",
"0x0"
],
"id": "getblock.io"
};
let config = {
method: "post",
maxBodyLength: Infinity,
url: "https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>",
headers: {
"Content-Type": "application/json",
},
data: data,
};
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
Response Parameters
Field
Type
Description
Use Case
Error handling
Status Code
Error Message
Cause
Integration with Web3
Last updated
Was this helpful?