Skip to content

πŸ”„ Real-time blockchain token holder tracking and analytics system built with NestJS

License

Notifications You must be signed in to change notification settings

omzi/token-holder-tracking-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c6c94ba Β· Dec 17, 2024

History

8 Commits
Dec 17, 2024
Dec 13, 2024
Dec 17, 2024
Dec 13, 2024
Dec 13, 2024
Dec 13, 2024
Dec 13, 2024
Dec 17, 2024
Dec 13, 2024
Dec 16, 2024
Dec 16, 2024
Dec 13, 2024
Dec 13, 2024

Repository files navigation

Token Holder Tracking API

πŸ”„ Real-time blockchain token holder tracking and analytics system built with NestJS

License: MIT

πŸ“œ About

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.

⚑ Key Features

  • 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

πŸ— Architecture

The system is built around two core modules:

πŸ”„ Sync Module

  • Blockchain event synchronization
  • Balance management
  • Progress tracking (CLI)
  • Automated updates

πŸ“Š Holders Module

  • Paginated data access
  • Percentage analytics
  • Sorting capabilities

πŸ›  Tech Stack

  • Framework: NestJS
  • Database: PostgreSQL
  • ORM: TypeORM
  • RPC: Fraxtal RPC
  • Libraries:
    • BigNumber.js (precision calculations)
    • Ethers (blockchain querying)
    • class-validator (input validation)
    • Swagger (API documentation)

πŸš€ Getting Started

  1. Clone the repository
git clone https://github.com/omzi/token-holder-tracking-api.git
cd token-holder-tracking-api
  1. Install dependencies
npm install
  1. 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
  1. Start the application
# Development
npm run start:dev

# Production
npm run start:prod

πŸ”Œ API Endpoints

GET /holders

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)

POST /sync

Manually trigger blockchain synchronization

πŸ“š API Documentation

Access the Swagger API documentation at /api when running the application.

πŸ§ͺ Testing

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Test coverage
npm run test:cov

πŸ“¦ Project Structure

src/
β”œβ”€β”€ sync/              # Blockchain synchronization module
β”œβ”€β”€ holders/           # Holder management module
β”œβ”€β”€ entities/          # Database entities
└── dto/               # Data transfer objects

πŸ‘₯ Contributors

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for more details.

❌ Disclaimer

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.


Back to Top ⬆️

About

πŸ”„ Real-time blockchain token holder tracking and analytics system built with NestJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published