Moonbeam

Moonbeam

eth_getTransactionByHash

The eth_getTransactionByHash method returns comprehensive information about a transaction identified by its unique hash. This is one of the most commonly used methods for retrieving transaction details directly.

Use Cases

  • Transaction status confirmation
  • Transaction validation
  • Payment verification
  • Smart contract interaction analysis
  • Transaction monitoring
  • Gas usage analysis
  • Historical transaction data retrieval
  • Transaction debugging

Method Details

This method retrieves detailed transaction data using the transaction's unique hash.

Response Example

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
"blockNumber": "0x11a48cb",
"from": "0x28c6c06298d514db089934071355e5743bf21d60",
"gas": "0x21924",
"gasPrice": "0x1057b28df",
"maxFeePerGas": "0x11986c07a",
"maxPriorityFeePerGas": "0x77359400",
"hash": "0x5d15326cb350e13d19d1618b7534dcad9feac5cce8a877b8e6fdfd963a4889f7",
"input": "0xa9059cbb000000000000000000000000ae2fc483527b8ef99eb5d9b44875f005ba1fae9600000000000000000000000000000000000000000000001158e460913d00000",
"nonce": "0x3b50",
"to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"transactionIndex": "0x4d",
"value": "0x0",
"type": "0x2",
"accessList": [],
"chainId": "0x1",
"v": "0x0",
"r": "0x35707b530856150cec9ef609a724e2eb651f71ed9f0b0f94d9969919dae58387",
"s": "0x7b305ef8f21e889f63d5178e7d2cbb85880ceaae045b0f46aef808c70b3a7a42"
}
}

Identifying Transaction Types

By examining the transaction data, you can identify common transaction patterns:

  1. Simple ETH Transfer:
  • to is a regular address (not a contract)
  • input is "0x" (empty data)
  • value is greater than 0
  1. ERC-20 Token Transfer:
  • to is a token contract address
  • input starts with "0xa9059cbb" (transfer method signature)
  • value is typically 0
  1. Contract Deployment:
  • to is null
  • input contains contract bytecode
  1. Contract Method Call:
  • to is a contract address
  • input starts with function signature (first 4 bytes of keccak256 hash of function name and parameters)
  • May include value if the function is payable
### See also
- <DocLink to="/docs/ref/eth_getTransactionReceipt">eth_getTransactionReceipt</DocLink> - Get transaction receipt with execution results and events
- <DocLink to="/docs/ref/eth_getTransactionByBlockHashAndIndex">eth_getTransactionByBlockHashAndIndex</DocLink> - Look up transactions using a block hash and index position

Parameters

The hash of the transaction

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

Ready to call this in production?

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