Skip to main content

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

ArgumentTypeDescription
hashString! non-null scalarThe 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 to is 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 value field returns a wei (1 ETH = 10^18 wei) value. Convert to ETH for display: value / 10^18.
  • For EIP-1559 transactions, use gasTipCap and gasFeeCap. For legacy transactions, use gasPrice.
  • The to field will be null for contract creation transactions.
  • The confirmations field updates dynamically as new blocks are mined.
  • Values for timestamp are Unix timestamps in seconds. Convert to local time for user-facing applications.