eth_getTransactionByHash - Somnia
Example code for the eth_getTransactionByHash JSON-RPC method. Complete guide on how to use eth_getTransactionByHash JSON-RPC in GetBlock Web3 documentation.
This method returns information about a transaction by its hash on the Somnia network. This is essential for tracking transaction status, debugging, and building transaction explorers. Somnia's sub-second finality means transactions are confirmed rapidly.
Parameters
transactionHash
string
Yes
32-byte transaction hash
Returns
hash
string
Transaction hash
from
string
Sender address
to
string
Recipient address
value
string
Value transferred in wei
gas
string
Gas provided
gasPrice
string
Gas price in wei
input
string
Transaction input data
nonce
string
Sender's nonce
blockHash
string
Block hash (null if pending)
blockNumber
string
Block number (null if pending)
Request Example
cURL
JavaScript (Axios)
Python
Rust
Response Example
Response Parameters
hash
string
32-byte transaction hash
from
string
Sender address
to
string
Recipient address (null for contract creation)
value
string
Value in wei
gas
string
Gas limit
gasPrice
string
Gas price in wei
input
string
Call data
nonce
string
Transaction nonce
blockHash
string
Containing block hash
blockNumber
string
Containing block number
Use Cases
Track transaction status
Verify transaction details
Build transaction explorers
Debug failed transactions
Monitor pending transactions
Error Handling
-32602
Invalid params - malformed hash
-32603
Internal error - node processing issues
null result
Transaction not found
SDK Integration
Last updated
Was this helpful?