List Events
Query raw blockchain events with filtering, sorting, and pagination.
Query Structureβ
query GetEvents(
$where: events_bool_exp
$order_by: [events_order_by!]
$limit: Int
$offset: Int
) {
events(
where: $where
order_by: $order_by
limit: $limit
offset: $offset
) {
id
type
block_number
block_timestamp
transaction_hash
atom_id
triple_id
sender_id
receiver_id
data
}
}
Variablesβ
{
"where": {
"type": { "_eq": "AtomCreated" }
},
"order_by": [{ "block_number": "desc" }],
"limit": 20
}
Response Fieldsβ
| Field | Type | Description |
|---|---|---|
id | String | Unique event identifier |
type | String | Event type |
block_number | Int | Block number |
block_timestamp | DateTime | Block timestamp |
transaction_hash | String | Transaction hash |
atom_id | String | Related atom ID (if applicable) |
triple_id | String | Related triple ID (if applicable) |
sender_id | String | Sender address |
receiver_id | String | Receiver address |
data | JSON | Event-specific data |
Interactive Exampleβ
Query
query GetEvents($limit: Int!) {
events(
order_by: { block_number: desc }
limit: $limit
) {
id
type
block_number
block_timestamp
transaction_hash
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Use Casesβ
Analytics Dashboardβ
Track protocol activity over time:
async function getEventsByDateRange(
startDate: Date,
endDate: Date,
eventType?: string
) {
const query = `
query GetEventsByDate(
$start: timestamptz!
$end: timestamptz!
$type: String
) {
events(
where: {
block_timestamp: { _gte: $start, _lte: $end }
${eventType ? 'type: { _eq: $type }' : ''}
}
order_by: { block_timestamp: asc }
) {
id
type
block_timestamp
data
}
}
`
return client.request(query, {
start: startDate.toISOString(),
end: endDate.toISOString(),
type: eventType
})
}
Transaction Explorerβ
Look up all events in a transaction:
async function getTransactionEvents(txHash: string) {
const query = `
query GetTransactionEvents($tx: String!) {
events(
where: { transaction_hash: { _eq: $tx } }
order_by: { id: asc }
) {
id
type
atom_id
triple_id
sender_id
data
}
}
`
return client.request(query, { tx: txHash })
}
Filtering Optionsβ
By Event Typeβ
# Atom creations only
events(where: { type: { _eq: "AtomCreated" } })
# Multiple types
events(where: { type: { _in: ["Deposited", "Redeemed"] } })
By Addressβ
# Events from specific sender
events(where: { sender_id: { _eq: "0x..." } })
By Block Rangeβ
events(where: {
block_number: { _gte: 1000000, _lte: 1100000 }
})
Best Practicesβ
- Use specific filters - Events table can be large
- Prefer signals - For user-facing features, use enriched signals
- Paginate results - Always limit event queries
- Cache analytics - Event data is immutable
Relatedβ
- Aggregate Events - Event statistics
- Signals - Enriched event data