This monorepo houses two critical microservices designed for blockchain data indexing and analysis: chain-watcher
and assets-indexer
. Both services are tailored for EVM-compatible blockchains, providing real-time monitoring, event processing, and efficient data indexing.
- Chain Watcher: Monitors and indexes blockchain data in real-time, broadcasting relevant transaction logs and events for downstream processing.
- Assets indexer: Processes blockchain events, focusing on identifying and handling ERC721 and ERC1155 assets, and stores transaction data for analysis.
Before setting up the services, ensure you have the following dependencies installed:
- Rust
- PostgreSQL
- Redis
Rust programming language environment includes rustc (the compiler), cargo (the package manager), and standard library documentation. Execute the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
verify
rustc --version
Execute the following command:
sudo apt install postgresql postgresql-contrib
verify
psql --version
After installation, start PostgreSQL service:
brew services start postgresql
Execute the following command:
brew install redis
To have Redis start automatically when your machine starts:
brew services start redis
verify
redis-server --version
To ensure the database schemas are set up correctly for both services, you need to run migrations. We use sqlx for handling migrations smoothly.
First, install sqlx-cli if you haven't already:
cargo install sqlx-cli
if the database does not exist
sqlx database create --database-url postgresql://{username}:${password}@{host}:{host}/{database}
run migrations
$ sqlx migrate run --database-url postgresql://{username}:${password}@{host}:{host}/{database}
Each service can be configured through command-line arguments or environment variables. See the respective service's README for detailed configuration options.
-
Chain Watcher Refer to chain-watcher/README.md for instructions on how to set up and run the Chain Watcher service.
-
Assets indexer Refer to assets-indexer/README.md for setup and usage guidelines for the Assets indexer service.