Blockbook Indexer Services

Purpose

Blockbook Indexer Services address the challenge of efficiently indexing and querying blockchain data for UTXO-based blockchains within the broader Multi-Blockchain Coinstacks architecture. These services provide a robust caching layer and optimized data retrieval mechanisms to support fast transaction history queries, balance lookups, and mempool tracking. They abstract the complexities of raw blockchain data access, enabling API servers to deliver consistent and performant blockchain data to clients.

Unlike daemon nodes that maintain blockchain consensus, Blockbook indexers focus exclusively on indexing blockchain data into a queryable format, supporting REST and WebSocket APIs that serve the API servers. This separation of concerns allows the system to scale indexing workloads independently and offload heavy query operations from blockchain nodes.

Functionality

The Blockbook indexer operates as a specialized service that:

Each blockchain coinstack includes a tailored Blockbook indexer configuration (e.g., `node/coinstacks/litecoin/indexer/config.json`) specifying blockchain-specific parameters such as RPC connection details, address formats, extended public key magic bytes, and caching policies.

Example Configuration Snippet

{
  "rpc_url": "http://localhost:8332",
  "rpc_user": "user",
  "rpc_pass": "password",
  "mempool_workers": 8,
  "mempool_sub_workers": 2,
  "block_addresses_to_keep": 300,
  "fiat_rates": "coingecko",
  "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"litecoin\", \"periodSeconds\": 900}"
}

This configuration directs the indexer to connect to the blockchain RPC node, manage mempool processing with specified concurrency, and enrich data with fiat currency rates updated every 900 seconds.

Integration with Parent Topic and Other Subtopics

Blockbook Indexer Services integrate tightly with other components in the Multi-Blockchain Coinstacks ecosystem:

The Blockbook indexer thus forms a critical middleware layer bridging raw blockchain data and the unified API surface, providing enhanced performance, scalability, and modularity.

Diagram

flowchart TD
    subgraph Blockchain Network
        Blockchain[Blockchain Nodes]
    end

    Daemon[Daemon Node]
    Indexer[Blockbook Indexer Service]
    APIServer[API Server]
    Client[Client Application]

    Blockchain -->|RPC / Message Queue| Daemon
    Daemon -->|Block & Tx Data| Indexer
    Indexer -->|REST / WebSocket API| APIServer
    APIServer -->|REST API Calls| Client
    APIServer -->|WebSocket Events| Client
    Indexer -->|Real-time Events| WebSocketMgr[WebSocket Event Subscription]

    style Blockchain fill:#f9f,stroke:#333,stroke-width:1px
    style Daemon fill:#bbf,stroke:#333,stroke-width:1px
    style Indexer fill:#bfb,stroke:#333,stroke-width:1px
    style APIServer fill:#ffb,stroke:#333,stroke-width:1px
    style Client fill:#fbf,stroke:#333,stroke-width:1px
    style WebSocketMgr fill:#fbb,stroke:#333,stroke-width:1px

This flowchart illustrates the data pipeline from the blockchain network through daemon nodes to the Blockbook indexer service, which serves the API servers. Real-time events from the indexer are propagated to clients via the WebSocket subscription manager, enabling live updates.


By focusing on efficient blockchain data indexing and caching, Blockbook Indexer Services play a pivotal role in delivering fast, reliable, and scalable blockchain data access within the multi-blockchain architecture. Their modular design and configurable parameters allow seamless adaptation to multiple UTXO-based blockchains, complementing daemon nodes and API servers to form a cohesive system.