transaction
API Context — Endpoint: https://api.onesource.io/federation/{'{'}chain{'}'}/graphql | Auth Header: x-bp-token: BP-{YOUR_API_KEY} | Method: POST | Content-Type: application/json
Look up a transaction by its hash.
Returns null if the transaction doesn't exist or is still pending.
Schema Definition
transaction(
hash: TransactionHash!
): Transaction
Arguments
| Argument | Type | Description |
|---|---|---|
hash | The transaction hash to look up (0x-prefixed, 66 characters). |
Return Type
| Type | Description |
|---|---|
Transaction object | A transaction representing a transfer of value or contract interaction. |
Common Use Cases
- Monitor transaction finality and confirmation depth for payment systems, exchanges, and dApps.
- Analyze historical gas costs by inspecting the
gasfield 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
toisnullandcontractCreatedis populated). - Retrieve full block context for a transaction via the nested
blockfield.
Example
Query
Verify Payment Status by Transaction Hash
query VerifyPayment($hash: TransactionHash!) {
transaction(hash: $hash) {
hash
timestamp
status
confirmations
from {
address
}
to {
address
}
value {
raw
formatted
decimals
}
gas {
limit
price
used
feeCap
tipCap
}
block {
number
timestamp
}
}
}
Variables
{
"hash": "0x22e64f2a255bbe709a702fbc22412339e7fa876b422493b6b7e03aa5fcd3b49c"
}
Response
{
"data": {
"transaction": {
"hash": "0x22e64f2a255bbe709a702fbc22412339e7fa876b422493b6b7e03aa5fcd3b49c",
"timestamp": "2025-10-18T10:44:47Z",
"status": "SUCCESS",
"confirmations": 40059,
"from": {
"address": "0x710312405c896cedcaef82cb9105bee07ecbeab8"
},
"to": {
"address": "0x99866915b444637925058a7a9984ab32e2c0714c"
},
"value": {
"raw": "3976740000000000",
"formatted": "0.00397674",
"decimals": 18
},
"gas": {
"limit": 21000,
"price": "1250655772",
"used": 21000,
"feeCap": "1500000000",
"tipCap": "100000000"
},
"block": {
"number": 23602632,
"timestamp": "2025-10-18T10:44:47Z"
}
}
}
}
Implementation Notes
note
- The
transactionquery returnsnullif the transaction doesn't exist or is still pending. Always handle the null case in your application. - The
hashargument is of typeTransactionHash!— a0x-prefixed, 66-character hex string. - The
fromandtofields returnAddressobjects, not plain strings. Usefrom { address }orto { address }to access the hex string. You can also traverse into balances, transaction history, and other address fields. - The
tofield isnullfor contract creation transactions. In that case, use thecontractCreatedfield to access the deployed contract (returned asIContract). - The
valuefield returns aTokenAmountobject withraw(wei string),formatted(human-readable with decimals applied), anddecimalsfields. Useformattedfor display instead of converting manually. - Gas information is nested under the
gasfield as aGasInfoobject. It includeslimit(max gas authorized),price(effective gas price in wei),used(actual gas consumed, ornullif pending),feeCap(EIP-1559 max fee per gas), andtipCap(EIP-1559 priority fee). For legacy transactions,feeCapandtipCapwill benull. - The
blockfield returns aBlockobject containing the blocknumber,timestamp,hash, and other block-level data. It isnullfor pending transactions. - The
confirmationsfield is a top-level integer on theTransactiontype that updates dynamically as new blocks are mined. Higher values indicate greater finality. - The
timestampfield returns an ISO 8601 formatted string (e.g.,"2025-10-18T10:44:47Z"), not a Unix integer. - The
statusfield returns aTransactionStatusenum:SUCCESS,FAILED, orPENDING. - To search and filter across multiple transactions, use the
transactionsquery with pagination and filtering support.