π Real-time blockchain token holder tracking and analytics system built with NestJS
A robust NestJS application that synchronizes with the Fraxtal blockchain to track token holders and their balances in real-time. Features automatic synchronization, high-precision balance tracking, and holder analytics.
- Real-time blockchain synchronization
- High-precision balance tracking
- Automatic periodic updates (10-second intervals)
- Paginated holder data access
- Flexible sorting and filtering
- Percentage holdings calculation
- RESTful API endpoints
- Swagger API documentation
The system is built around two core modules:
- Blockchain event synchronization
- Balance management
- Progress tracking (CLI)
- Automated updates
- Paginated data access
- Percentage analytics
- Sorting capabilities
- Framework: NestJS
- Database: PostgreSQL
- ORM: TypeORM
- RPC: Fraxtal RPC
- Libraries:
- BigNumber.js (precision calculations)
- Ethers (blockchain querying)
- class-validator (input validation)
- Swagger (API documentation)
- Clone the repository
git clone https://github.com/omzi/token-holder-tracking-api.git
cd token-holder-tracking-api
- Install dependencies
npm install
- Configure environment variables
Create a
.env
file in the root directory (or rename the.env.example
file to.env
):
DATABASE_URL = # Your PostgreSQL connection string
TOKEN_ADDRESS = # The token's contact address
FRAXTAL_RPC_URL = https://rpc.frax.com
PORT = 3000
- Start the application
# Development
npm run start:dev
# Production
npm run start:prod
Retrieve paginated list of token holders
- Query Parameters:
page
(default: 1)limit
(default: 10, max: 100)sortBy
(options: balance, address, percentage)order
(options: asc, desc)
Manually trigger blockchain synchronization
Access the Swagger API documentation at /api
when running the application.
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
src/
βββ sync/ # Blockchain synchronization module
βββ holders/ # Holder management module
βββ entities/ # Database entities
βββ dto/ # Data transfer objects
- Omezibe Obioha (@0xOmzi)
This project is licensed under the MIT License. See the LICENSE
file for more details.
You may experience rate limits, errors and/or bugs while testing out the application. Feel free to reach to me on Twitter/X (@0xOmzi) regarding any issue you might be facing.