transaction
The transaction query retrieves information about a specific blockchain transaction by its hash.
It returns a Transaction object containing all transaction metadata, gas fees, sender/receiver information, and associated block data.
Schema Definition
transaction(
hash: String!
): Transaction
Arguments
| Argument | Type | Description |
|---|---|---|
hash | String! non-null scalar | The transaction hash to retrieve. |
Return Type
Transaction object
Common Use Cases
- Monitor transaction finality and confirmation depth for payment systems, exchanges, and dApps.
- Analyze historical gas costs to optimize future transaction pricing and fee strategies.
- Build transaction explorers, wallet dashboards, or audit trails for addresses.
- Verify and debug smart contract calls, including contract deployments (when
tois null).
Example
Query
Verify Payment Status by Transaction Hash
query VerifyPayment($hash: String!) {
transaction(hash: $hash) {
hash
confirmations
blockNum
timestamp
to
from
value
}
}
Variables
{
"hash": "0x22e64f2a255bbe709a702fbc22412339e7fa876b422493b6b7e03aa5fcd3b49c"
}
Response
{
"data": {
"transaction": {
"hash": "0x22e64f2a255bbe709a702fbc22412339e7fa876b422493b6b7e03aa5fcd3b49c",
"confirmations": 40059,
"blockNum": 23602632,
"timestamp": 1760767487,
"to": "0x99866915b444637925058a7a9984ab32e2c0714c",
"from": "0x710312405c896cedcaef82cb9105bee07ecbeab8",
"value": "3976740000000000"
}
}
}
Implementation Notes
note
- The
valuefield returns a wei (1 ETH = 10^18 wei) value. Convert to ETH for display:value / 10^18. - For EIP-1559 transactions, use
gasTipCapandgasFeeCap. For legacy transactions, usegasPrice. - The
tofield will benullfor contract creation transactions. - The
confirmationsfield updates dynamically as new blocks are mined. - Values for
timestampare Unix timestamps in seconds. Convert to local time for user-facing applications.