A high-performance Rust-based indexer for the Solana blockchain that provides real-time transaction indexing and querying capabilities.
This project consists of two main components:
- Indexer: Connects to Solana via WebSocket and indexes confirmed transactions in real-time
- API Server: Provides REST endpoints to query indexed blockchain data
- Real-time transaction indexing via WebSocket subscription
- Efficient in-memory storage with configurable capacity
- RESTful API for querying blockchain data
- Account balance and token information retrieval
- Transaction lookup by signature
- Recent transactions query with pagination
┌─────────────────┐ ┌──────────────────┐
│ Solana Node │ │ API Server │
│ (WebSocket) │ │ (Port 3000) │
└────────┬────────┘ └────────▲─────────┘
│ │
│ New Blocks │ Query Data
│ │
▼ │
┌─────────────────┐ ┌────────┴─────────┐
│ Indexer │◄───────►│ In-Memory Store │
│ (WSS Listener) │ │ (Transactions) │
└─────────────────┘ └──────────────────┘
Returns current blockchain metadata and indexer status.
Response:
{
"previous_blockhash": "...",
"blockhash": "...",
"slot": 123456789,
"parent_slot": 123456788,
"block_time": 1635724800,
"block_height": 100000000,
"transaction_count": 150
}
Retrieves SOL balance and token balances for a given account.\
Parameters:
{ address: "Solana account address" }
Response:
{
"balance": 1.5,
"tokens": [
{
"mint": "...",
"balance": 100.0
}
]
}
Fetches transaction details by signature hash.
Parameters:
{ signature: "Transaction signature hash" }
Response:
{
"signature": "...",
"messages": [...],
"status": "confirmed"
}
Returns the most recent transactions. Query Parameters:
{ limit: "Number of transactions to return (required)" }
Response:
[
{
"signature": "...",
"block_time": 1635724800,
"slot": 123456789
}
]
- Ensure you have Rust installed (latest stable version)
- Clone the repository
- Install dependencies:
cargo build --release
Configure the following environment variables:
SOLANA_RPC_URL=wss://something.com # see .env.example
RUST_LOG=INFO
Start the indexer and API server:
./target/release/server
The API server will be available at http://localhost:3000
Indexes transactions in real-time with minimal latency Maintains a sliding window of recent transactions for efficient memory usage Handles high throughput with concurrent processing O(1) lookups for transaction queries
- Fork the repository
- Create your feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add some amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details