The tracker reads CAT token transactions from the blockchain, stores them in Postgres in a structured way, which can be quickly retrieved via RESTful APIs. The Swagger documentation for all the APIs can be found at http://127.0.0.1:3000 after running.
yarn install && yarn buildThe tracker needs a full node and Postgres. We use Fractal node as an example here.
Make sure you have docker installed, or follow this guide to install it.
-
Update
.envfile with your own configuration. -
Update directory permission to avoid
dockerdoesn't have rights to write data.
sudo chmod o+w docker/data- Run
postgresqlandbitcoind.
docker compose up -dRun the following command to initialize database when run for the first time, or migrate data when upgrading from a previous version.
yarn migration:runNote: When upgrading tracker from a previous version, migrating the database may take a few hours. Make a database backup before migration.
The tracker consists of two modules:
worker, reads CAT token transactions from the blockchain and stores them in a database.api, reads data from the database and serves the RESTful APIs.
To run the worker module:
# development
yarn start:worker
# production mode
yarn start:worker:prodTo run the api module:
# development
yarn start:api
# production mode
yarn start:api:prodNote: Make sure the tracker syncs to the latest block before you run CLI over it. The sync-up progress can be found at http://127.0.0.1:3000/api after running.