Ethereum

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 blockNumber flips from null to a height, it's been included in a slot.
  • Decode the input field to see which contract function ran — the first four bytes are the function selector, the rest the ABI-encoded arguments.
  • Read from and value to verify an incoming ETH payment, then pair it with eth_getTransactionReceipt to confirm the transfer actually succeeded.

Parameters

#NameTypeRequiredDescription
1transactionHashstring (hex)YesThe hash of the transaction to retrieve.

Response

TypeDescription
object | nullTransaction 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

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0x0000000000000000000000000000000000000000000000000000000000000000"],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32602Invalid paramsTransaction 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 status on eth_getTransactionReceipt (0x1 success, 0x0 revert) for the real outcome.
  • A still-pending transaction returns an object with blockHash, blockNumber, and transactionIndex all null. 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 .from or .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

Parameters

0x-prefixed 32-byte transaction hash

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByHash","params":[""]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.