Skip to main content

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​

FieldTypeDescription
idStringUnique event identifier
typeStringEvent type
block_numberIntBlock number
block_timestampDateTimeBlock timestamp
transaction_hashStringTransaction hash
atom_idStringRelated atom ID (if applicable)
triple_idStringRelated triple ID (if applicable)
sender_idStringSender address
receiver_idStringReceiver address
dataJSONEvent-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​

  1. Use specific filters - Events table can be large
  2. Prefer signals - For user-facing features, use enriched signals
  3. Paginate results - Always limit event queries
  4. Cache analytics - Event data is immutable