Enable Indexing on your rollup
Conduit Indexing simplifies the process of indexing your chain and querying events, simplifying the development experience for your projects and users. This guide will walk you through enabling Indexing and sending your first query.
Sign in
Log into the Conduit app and head to the Indexing
tab. There you will find your rollups and all the chains that are currently available to be queried on Conduit Indexing.
Select a Rollup
Click Enable Indexing
on the rollup you’d like to enable Conduit Indexing for and click Enable
.
Set up billing
Enter your billing details and subscribe to the Testnet or Mainnet Indexing plan. For pricing details, check out Pricing & Costs.
How To Query Events
Once you’ve finished setting up billing your rollup will immediately begin indexing from genesis. It will then show up on the Query builder on the Query
tab and you can begin querying events with your newly created API key (found on the API keys
tab).
There are two ways to query; with the Query builder on the Query
tab, or directly via the API.
Using the Indexing API directly
The base API url to use is https://indexing.conduit.xyz/v2/query
.
To use your API key you can either;
- Append the API key directly in a query parameter
?api-key=KEY
- Add a field to the request body
{ "api-key": "KEY", ... }
using aPOST
request - Submit an
api-key
input value as part of a multipart form request to the above base url.
You can copy the API url with your key appended in the API keys section at the bottom of the Indexing page in the Conduit app.
An example query is:
curl 'https://indexing.conduit.xyz/v2/query?api-key=SECRET_KEY' \
-G \
--data-urlencode 'query=select "from", "to", tokens from transfer where chain = 8453 limit 1' \
--data-urlencode 'signatures=Transfer(address indexed from, address indexed to, uint tokens)' | jq .
The response would look like:
[
{
"cursor": "8453-30138481",
"columns": [
{
"name": "from",
"pgtype": "bytea"
},
{
"name": "to",
"pgtype": "bytea"
},
{
"name": "tokens",
"pgtype": "numeric"
}
],
"rows": [
[
"0x0000000000000000000000000000000000000000",
"0x0cf966857325db9a9b4dada66e80ce581c18aca1",
"0"
]
]
}
]
There is also an official Typescript SDK for Index Supply, which you can find here .
EVM Tables and Columns
When requests include a signature and a query, it is assumed that the query is operating on a virtual table of event logs or transaction inputs (depending on the event
or function
prefix). However, it is also possible to query the base tables directly.
EVM Tables
Table |
---|
blocks |
txs |
logs |
Blocks
Table name: blocks
Column | Type |
---|---|
chain | int8 |
num | int8 |
timestamp | timestamptz |
gas_limit | numeric |
gas_used | numeric |
nonce | bytea |
hash | bytea |
receipts_root | bytea |
state_root | bytea |
extra_data | bytea |
miner | bytea |
Transactions
Table name: txs
Column | Type |
---|---|
chain | int8 |
block_num | int8 |
block_timestamp | timestamptz |
idx | int4 |
type | int2 |
gas | numeric |
gas_price | numeric |
nonce | bytea |
hash | bytea |
from | bytea |
to | bytea |
input | bytea |
value | numeric |
Logs
Table name: logs
Column | Type |
---|---|
chain | int8 |
block_num | int8 |
block_timestamp | timestamptz |
log_idx | int4 |
tx_hash | bytea |
address | bytea |
topics | bytea[] |
data | bytea |