transactions
The transactions query retrieves a paginated list of blockchain transactions with comprehensive filtering, sorting, and pagination capabilities.
It returns a TransactionList object containing an array of Transaction objects with detailed transaction data including transaction hashes, block information, gas metrics, sender and recipient addresses, transaction values, and timing information.
Schema Definition
transactions(
first: Int = 10
skip: Int = 0
where: TransactionFilter
orderBy: TransactionOrderBy
orderDirection: Ordering
): TransactionList!
Arguments
| Argument | Type | Description |
|---|---|---|
first | Int = 10 scalar | Maximum number of transactions to retrieve per page. Maximum value is 100. |
skip | Int = 0 scalar | Number of transactions to bypass before assembling the page. Set to the first value from the previous page for offset pagination. |
where | TransactionFilter input | Specifies subsets of transaction data to be retrieved. |
orderBy | TransactionOrderBy enum | Sets how the list of transactions is ordered. |
orderDirection | Ordering enum | Sets the direction in which the list of transactions is ordered. |
Return Type
TransactionList object
Common Use Cases
- Display a user's complete transaction history by filtering on the
fromortoaddress. - Monitor large transactions by filtering with
valueGteandvalueLteparameters. - Track interactions with specific smart contracts by filtering on the
toaddress. - Analyze network congestion and gas price trends by ordering transactions by gas metrics (
orderBy: GASor usinggasPriceGte/gasPriceLtefilters). - Combine filters like
blockNumGte/blockNumLteandtimestampGte/timestampLteto create time-based or block-based transaction views.
Example
Query
Get 5 Most Recent USDT Transactions
query GetRecentUSDTTransactions($where: TransactionFilter, $first: Int, $orderBy: TransactionOrderBy, $orderDirection: Ordering) {
transactions(where: $where, first: $first, orderBy: $orderBy, orderDirection: $orderDirection) {
entries {
from
hash
timestamp
blockNum
gas
gasPrice
}
}
}
Variables
{
"where": {
"to": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
},
"first": 5,
"orderBy": "TIMESTAMP",
"orderDirection": "DESC"
}
Response
{
"data": {
"transactions": {
"entries": [
{
"from": "0x80787af194c33b74a811f5e5c549316269d7ee1a",
"hash": "0x59fb9291481bc4e944928f468ffe6977396bd96cdfb0c28a1438121953c0bfdd",
"timestamp": 1760714651,
"blockNum": 23598257,
"gas": 110000,
"gasPrice": "3000000000"
},
{
"from": "0xe0ca2012c3304e41c9d6e6a0d7f62c33b74356cf",
"hash": "0x7b794f64afb33ed5bf5a6856d3407fd03f89a34b1a0bf27dfc193490e14717b0",
"timestamp": 1760714651,
"blockNum": 23598257,
"gas": 49273,
"gasPrice": "1297332589"
},
{
"from": "0x2df9b935c44057ac240634c7536511d8aa03028d",
"hash": "0x4eada9f9ff04b915ca6273a4ad92635a8fcd592ed7c0807aab7483506d9f906d",
"timestamp": 1760714651,
"blockNum": 23598257,
"gas": 84000,
"gasPrice": "1608773990"
},
{
"from": "0x8e04af7f7c76daa9ab429b1340e0327b5b835748",
"hash": "0xd50760ac010e21f902bca8e961a0de92d3df594205a52443093e6a3651312a4d",
"timestamp": 1760714651,
"blockNum": 23598257,
"gas": 250000,
"gasPrice": "1323416235"
},
{
"from": "0x5fa8139192d8bb5f6684c6d808b7665e02df4833",
"hash": "0xf3ab3a5b91b1365388ef446ecff71f1d95e8a48a0816d8572b9759ac5d5e43cd",
"timestamp": 1760714651,
"blockNum": 23598257,
"gas": 70447,
"gasPrice": "1601480988"
}
]
}
}
}
Implementation Notes
note
- The default
firstvalue is 10 transactions. OneSource enforces a maximumfirstvalue of 100. Adjust based on your UI needs. - Use
skipfor offset-based pagination. To get the next page, use askipvalue equal to the previousfirstvalue. - All range filters use
Gte(greater than or equal to) andLte(less than or equal to) suffixes for inclusive ranges. - The
valuefor each transaction is in wei (1 ETH = 10^18 wei). Convert to ETH for display:value / 10^18. - Gas-related values are also in wei. Remember to convert for display purposes.