Rarible Protocol Ethereum Indexers
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.
Architecture
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
Running Indexer with Docker Compose
Requirements
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
Get started
-
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.
OpenAPI
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
Suggestions
You are welcome to suggest features and report bugs found!
Contributing
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.
License
GPL v3 license is used for all services and other parts of the indexer.