Skip to main content
This page is for app developers who want to index Celo contract events and query them through a GraphQL API. Envio HyperIndex is an indexing framework for real-time and historical blockchain data.

How it works

With HyperIndex, you define the contracts and events to index in config.yaml, write handlers that turn those events into entities, and query the result through a GraphQL API. Handlers are written in TypeScript (the default) or ReScript. You can run an indexer locally, self-host it, or deploy it to Envio Cloud, Envio’s managed hosting. HyperSync is Envio’s data retrieval layer, used as an alternative to JSON-RPC. It is available on Celo mainnet (chain ID 42220) at https://celo.hypersync.xyz, and HyperIndex uses it as the default data source there. For networks without HyperSync, such as Celo Sepolia (chain ID 11142220), HyperIndex uses an RPC data source. Celo Sepolia is not in Envio’s network list, so you must supply the ABI and RPC URL yourself rather than importing from a block explorer. HyperSync is also available as a standalone API through the Node.js, Python, and Rust clients (a community-maintained Go client also exists), or through HyperRPC, its JSON-RPC interface. HyperSync requires an API token.

Prerequisites

Create an indexer from a Celo contract

Run the following command and follow the prompts:
  1. Enter a folder name for the project, or press Enter to use the current directory.
  2. Select Evm as the blockchain ecosystem.
  3. Select From Address - Lookup ABI from block explorer. The other options are From ABI File (use your own ABI file), two templates (ERC20 and Greeter), and two feature examples.
  4. Select celo as the blockchain. You can type to filter the list.
  5. Enter the contract address. If the contract is a proxy, enter the proxy address.
  6. Choose the events to index. All events in the ABI are selected by default.
  7. Select I'm finished, or add another address, network, or contract.
  8. Add an Envio API token to the project’s .env file. You can create a new token or add an existing one.
The command generates the configuration (config.yaml), GraphQL schema (schema.graphql), and event handlers (src/handlers/). To run contract import without prompts, pass the chain and address as flags:
For Celo Sepolia, pass a local ABI file, an RPC URL, and the block to start indexing from:

Run the indexer locally

Make sure Docker is running, then start the indexer from the project folder:
This opens the local Hasura console, where you can query the indexed data with GraphQL. The local admin password is testing.

Resources