๐ eth_getTransactionByHash - Base Chain
What This Method Does
The eth_getTransactionByHash
method lets you look up any transaction on Base using its unique hash (transaction ID). Think of the transaction hash as a receipt number that lets you retrieve all details about a specific transaction.
Parameters
Parameter | What to Provide |
---|---|
transactionHash | The unique 66-character transaction ID (starts with "0x") |
Need RPC API keys?
Get 12.5M archival requests for free today.
What You'll Get Back
The method returns a transaction object with these important fields:
Field | What It Tells You |
---|---|
blockHash & blockNumber | Which block contains this transaction (null if still pending) |
from | The wallet address that sent the transaction |
to | The receiving wallet or contract address |
value | Amount of ETH transferred (in wei, hex format) |
gas | Maximum gas the sender was willing to use |
gasPrice | Price per unit of gas the sender offered to pay |
maxFeePerGas & maxPriorityFeePerGas | Fee limits for modern (EIP-1559) transactions |
input | Data sent to interact with contracts (empty for simple transfers) |
nonce | Transaction sequence number from the sender's account |
type | Transaction type (0=legacy, 2=modern EIP-1559) |
chainId | Network identifier (8453/0x2105 for Base mainnet) |
v , r , s | Cryptographic signature components that prove who sent the transaction |
How To Use It
POST https://base-mainnet.chainnodes.org/YOUR-API-KEY
Example Request
- HTTPS POST Request with a JSON RPC call in the body
- Replace YOUR-API-KEY with the API key from your Chainnodes.org Dashboard
- You can use a different supported network by replacing
base-mainnet
curl https://base-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params": ["0xf02e0576a830ab37f2eb1c43ed3fbcaa53d84bf5ca985ae60c71f5cac27f4cc3"],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x54751c3cb4f7c95b249ab5ed702a708a6782cc937b1d399f25be4b40d9e0f5d4",
"blockNumber": "0x57e450",
"from": "0xad89a377e302791fb523ffb427f3f480cad3a72c",
"gas": "0x3362",
"gasPrice": "0xe12c5d1dc",
"maxFeePerGas": "0xe12c5d1dc",
"maxPriorityFeePerGas": "0x5f5e100",
"hash": "0xf02e0576a830ab37f2eb1c43ed3fbcaa53d84bf5ca985ae60c71f5cac27f4cc3",
"input": "0x3593564c0000000000000000000000000000000000000000000000000000000000000060",
"nonce": "0x1",
"to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x2",
"accessList": [],
"chainId": "0x2105",
"v": "0x0",
"r": "0x3b4afab91edec37c0cfe9e68f2d65c4c7e9ab23d3453eaa456bdb41e5d22548f",
"s": "0x217ad72b41a611526a45aae9392affba8114c0bd4c25e8ef7f05cda45ef5cee0"
}
}
๐ก Confusing?
Ask our experienced blockchain developers in Telegram
Common Use Cases
โ Check if a Transaction is Confirmed
// A simple way to check if a transaction has been processed
const tx = await getTransactionByHash(txHash);
const isConfirmed = tx.blockNumber !== null;
console.log(isConfirmed ? "Transaction confirmed!" : "Still pending...");
๐งฎ Calculate the Transaction Cost
// Convert hex values to regular numbers to calculate the cost
const gasLimit = parseInt(tx.gas, 16); // Convert hex to decimal
const maxFeePerGas = parseInt(tx.maxFeePerGas, 16); // Convert hex to decimal
const maxCost = gasLimit * maxFeePerGas; // Maximum possible cost in wei
const maxCostInETH = maxCost / 1000000000000000000; // Convert to ETH
๐ Decode a Contract Interaction
// The first 4 bytes of input data identify the contract function being called
const methodSignature = tx.input.substring(0, 10);
console.log(`Contract function called: ${methodSignature}`);
// Example: 0xa9059cbb = transfer function on most tokens
๐ Track a Bridge Transaction
// Get details of a transaction that bridges assets between Ethereum and Base
{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0xYourBridgeTransactionHash"],"id":1}
// Look at the "to" address and "input" data to understand the bridge interaction
Related Methods
- eth_getTransactionReceipt - Get the results of a transaction (success/failure, gas used, events emitted)
- eth_getTransactionByBlockNumberAndIndex - Find a transaction if you know which block it's in
Base Chain Tips
๐ฐ Fees on Base: Transactions on Base are generally cheaper than on Ethereum mainnet, but they include a small fee that goes to Ethereum (L1 data fee) for security.
๐ข Network IDs: When you see
chainId
of0x2105
(8453 in decimal), that's Base mainnet. For Base testnet, you'll see0x14a33
(84531 in decimal).