On Rarible, we have several types of indexers:
NFT indexer — is used to index all history of NFTs related actions, i.e., mint, transfer, and burn. Indexer gets logs from an Ethereum network, and accordingly creates NFT items in a NoSQL database. Especially, it listens to a change of a state of an NFT item ownership.
ERC-20 indexer — is responsible for tracking user balances. If we mapped it to the Rarible usage, it checks if a user has enough of a given currency to make a bid. It handles all the information about a user's wallet status.
Order indexer — aggregates data about Orders from different platforms. In order to properly display order information (order means intent, e.g., intent to sell, or in simpler words, intent to sell an NFT for a given price), we need an order price in addition to other properties.
Every indexer listens to a specific part of the Ethereum blockchain, users can use these indexers to query data about the blockchain state. Also, indexers emit events when state changes.
Indexers were built using Spring Framework and use these external services:
- MongoDB for main data storage
- Kafka for handling events
The recommended requirements for running the Indexer via Docker Compose are listed below:
- JDK 8
- Maven
- Docker
- After installation, turn on Use Docker Compose V2 in the Settings > General
-
Clone the project:
git clone https://github.com/rarible/ethereum-indexer.git
-
Go to the project folder and run Maven command:
mvn clean package -DskipTests
-
Go to the docker folder and run
build
command:cd docker/ docker-compose build
-
To start docker compose, run
up
command:docker-compose up
Now you can see how the indexer works.
This is convenient for testing. For example, you can deploy a contract in a test node, configure the SDK for it and see how the information in the indexer will be updated after minting.
Indexers use OpenAPI to describe APIs (and events). Clients (Kotlin, TypeScript etc.) and server controller interfaces are generated automatically using YAML OpenAPI files.
See more information on Rarible Ethereum Protocol OpenAPI repository.
Ethereum OpenAPI docs: https://ethereum-api.rarible.org/v0.1/doc
You are welcome to suggest features and report bugs found!
The codebase is maintained using the "contributor workflow" where everyone without exception contributes patch proposals using "pull requests" (PRs). This facilitates social contribution, easy testing, and peer review.
See more information on CONTRIBUTING.md.
GPL v3 license is used for all services and other parts of the indexer.