rindexer
rindexer is an open-source, high-performance EVM indexing tool built in Rust. It allows you to index blockchain events using a simple YAML configuration file, eliminating the need for additional coding. For more advanced requirements, rindexer provides a robust framework to build custom indexing solutions. The Lens API utilizes rindexer for its indexing needs.
Installation
Install rindexer by running the following command in your terminal:
curl -L https://rindexer.xyz/install.sh | bash
After installation, verify it by checking the version:
rindexer --version
Setting Up a New No-Code Project
Navigate to your desired directory and run:
rindexer new no-code
This command generates a rindexer.yaml file, which serves as the core configuration for your project.
Edit the rindexer.yaml file in the generated project to define your contract indexing settings. Below is an example configuration for indexing an event from a demo contract on the Lens Testnet:
rindexer.yaml
name: PingIndexerdescription: Indexer for the Ping contract on Lens Testnetrepository: https://github.com/yourusername/ping-indexerproject_type: no-codenetworks: - name: lensTestnet chain_id: 37111 rpc: https://rpc.testnet.lens.devstorage: postgres: enabled: truecontracts: - name: Ping details: - network: lensTestnet address: 0xb7462EaCd5487514b6b789CF1Fca3081020F4e21 abi: ./abis/ping.abi.json include_events: - Pong
See the YAML Config docs for a complete reference on available fields.
Place the contract ABI file (ping.abi.json in the example) in the directory designated in the rindexer.yaml file.
Once your configuration is set up, run the indexer using:
rindexer start
This will begin indexing based on the configuration defined in rindexer.yaml.
By default, a GraphQL endpoint will be exposed on http://localhost:3001/graphql with a playground UI available at http://localhost:3001/playground.
Data can also be queried by connecting directly to the PostgreSQL database:
docker exec -it rindexer-db psql -U postgres -d rindexer
If your indexing needs extend beyond the no-code mode, you can scaffold a Rust-based indexer using:
rindexer new rust