A specialized indexer for tracking and analyzing Bitcoin transactions related to the Babylon Protocol staking system. This service monitors Bitcoin blocks for staking transactions, validates them according to protocol rules, and provides detailed analytics through a REST API.
- Real-time indexing of Babylon Protocol staking transactions
- Multi-phase staking support (Phase 1, 2, and 3)
- Comprehensive transaction validation based on protocol parameters (In development)
- REST API for querying staking data and analytics
- Support for tracking finality providers and stakers
- Configurable indexing parameters via environment variables
- Node.js (v16 or higher)
- TypeScript
- MongoDB
- Bitcoin Node RPC access
- Clone the repository:
git clone https://github.com/hoodrunio/babylon-staker-indexer.git
cd babylon-staker-indexer
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env
Edit the .env
file with your configuration:
BTC_RPC_URL
: Your Bitcoin node RPC URLMONGODB_URI
: MongoDB connection stringPORT
: API server port (default: 3000)- Other phase-specific configuration options
- Build the project:
npm run build
- Set up the database:
npm run db:setup
- Start the indexer:
npm start
For development:
npm run dev
GET /api/finality-providers
: List all finality providersGET /api/finality-providers/top
: Get top finality providersGET /api/finality-providers/:address
: Get specific finality provider stats
GET /api/stakers
: List all stakersGET /api/stakers/top
: Get top stakers by stake amount
GET /api/stats
: Get global statsGET /api/versions/:version
: Get stats for a specific versionGET /api/phases
: Get all phase statsGET /api/phases/:phase
: Get stats for a specific phase
The indexer supports different phases of the Babylon Protocol:
-
Phase 1: Initial staking phase
- Start Height: 857910
- Target Stake: 1000 BTC
- Min Stake: 0.005 BTC
- Max Stake: 0.05 BTC
-
Phase 2: Intermediate phase
- Start Height: 864790
- End Height: 864799
- Max Stake: 500 BTC
-
Phase 3: Final phase
- Start Height: 874088
- End Height: 875087
- Max Stake: 500 BTC
Run tests:
npm test
Run linting:
npm run lint
Type checking:
npm run typecheck
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request