eth-tracker/README.md

94 lines
2.4 KiB
Markdown
Raw Normal View History

2024-05-23 09:21:42 +02:00
# celo-tracker
![GitHub Tag](https://img.shields.io/github/v/tag/grassrootseconomics/celo-tracker)
A fast and lightweight tracker designed to monitor the Celo blockchain for live and historical transaction events, including reverted transactions. It filters these events and publishes them to NATS for further processing.
It applies deduplication at the NATS level, making it safe to run in a distributed fashion, thus allowing for high availability.
## Getting Started
2024-05-27 11:41:55 +02:00
### Prerequisites
* Git
* Docker
* NATS server
* Access to a Celo RPC node
2024-05-27 12:32:24 +02:00
See [docker-compose.yaml](dev/docker-compose.yaml) for an example on how to run and deploy a single instance.
2024-05-27 11:41:55 +02:00
### 1. Build the Docker image
We provide pre-built images for `linux/amd64`. See the packages tab on Github.
If you are on any other platform:
```bash
git clone https://github.com/grassrootseconomics/celo-tracker.git
cd celo-tracker
docker buildx build --build-arg BUILD=$(git rev-parse --short HEAD) --tag celo-tracker:$(git rev-parse --short HEAD) --tag celo-tracker:latest .
docker images
```
### 2. Run NATS
For an example, see `dev/docker-compose.nats.yaml`.
2024-05-27 11:41:55 +02:00
### 3. Update config values
2024-05-27 11:44:00 +02:00
See `.env.example` on how to override default values defined in `config.toml` using env variables. Alternatively, mount your own config.toml either during build time or Docker runtime.
2024-05-27 11:41:55 +02:00
```bash
# Override only specific config values
nano .env.example
mv .env.example .env
```
2024-05-27 12:05:58 +02:00
Special env variables:
* DEV=*
* FORCE_BACKFILL=*
2024-05-27 11:41:55 +02:00
Refer to [`config.toml`](config.toml) to understand different config value settings.
### 4. Run the tracker
```bash
2024-05-27 12:32:24 +02:00
cd dev
docker compose up
2024-05-27 11:41:55 +02:00
```
2024-05-27 12:05:58 +02:00
## Processing NATS messages
### JSON structure
```js
{
"block": Number,
"contractAddress": String,
"success": Boolean,
"timetamp" Number,
"transactionHash": String,
"transactionType": String,
"payload": Object
}
```
### Monitoring with NATS CLI
Install NATS CLI from [here](https://github.com/nats-io/natscli?tab=readme-ov-file#installation).
```bash
nats subscribe "TRACKER.*"
```
2024-05-23 09:21:42 +02:00
## Caveats
* Reverted transactions older than 10 minutes will be skipped due to the trie potentially missing. To override this behavior, use an archive node and set `chain.archive_node` to `true`.
* The backfiller will only re-queue an epoch's (17,280 blocks) worth of missing blocks. To override this behavior, pass an environment variable `FORCE_BACKFILL=*`. This may lead to degraded RPC performance.
## License
[AGPL-3.0](LICENSE).