Ethereum
eth_getTransactionByHash
eth_getTransactionByHash looks up a transaction on Ethereum mainnet (chain ID 1, the network whose gas and transfers are denominated in ETH) by its 32-byte hash and returns the full transaction object: from, to, value in wei, nonce, input calldata, the type, and the EIP-1559 fee fields maxFeePerGas / maxPriorityFeePerGas for type-2 transactions. It describes what was submitted, not how it executed — the receipt holds the outcome. A pending transaction comes back with null for blockHash, blockNumber, and transactionIndex until a validator includes it in a slot. Point the call at https://ethereum.therpc.io/YOUR_API_KEY.
Use cases
- Confirm a transaction you broadcast made it into a block: once
blockNumberflips fromnullto a height, it's been included in a slot. - Decode the
inputfield to see which contract function ran — the first four bytes are the function selector, the rest the ABI-encoded arguments. - Read
fromandvalueto verify an incoming ETH payment, then pair it witheth_getTransactionReceiptto confirm the transfer actually succeeded.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | transactionHash | string (hex) | Yes | The hash of the transaction to retrieve. |
Response
| Type | Description |
|---|---|
| object | null | Transaction object containing: hash, nonce, blockHash, blockNumber, transactionIndex, from, to (null for contract creation), value (hex wei), gas, gasPrice / maxFeePerGas / maxPriorityFeePerGas, input, type, accessList (type-1/2), chainId, v, r, s. Returns null if not found or still pending (blockHa |
Example request
Try it live in the Ethereum playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32602 | Invalid params | Transaction hash is malformed or not 32 bytes. |
Common pitfalls
- Getting an object back does not mean the transaction succeeded. It only says the tx exists; a reverted transaction still returns here. Read
statusoneth_getTransactionReceipt(0x1success,0x0revert) for the real outcome. - A still-pending transaction returns an object with
blockHash,blockNumber, andtransactionIndexallnull. Treat those nulls as "not yet mined," not as an error. - A dropped, replaced, or never-broadcast hash returns plain
null. Null-check the whole response before reaching for.fromor.value, or you'll throw on a tx that the mempool quietly evicted.
Supported networks
- Mainnet — Chain ID: 1
- Sepolia — Chain ID: 11155111
See also
- eth_getTransactionReceipt
- eth_getTransactionByBlockHashAndIndex
- eth_getTransactionByBlockNumberAndIndex
Parameters
0x-prefixed 32-byte transaction hash