config.json


Overview

The `config.json` file serves as a critical configuration descriptor for a Blockbook indexer service instance tailored to the Litecoin blockchain. It defines all the necessary parameters for the indexer to connect to the Litecoin daemon node (RPC), manage caching and concurrency, and enrich blockchain data with fiat currency exchange rates.

This JSON-formatted configuration enables the indexer to:

This config file is typically located within the Litecoin coinstack indexer directory (e.g., `node/coinstacks/litecoin/indexer/config.json`) and is loaded at the startup of the Blockbook indexer service.


Detailed Explanation of Configuration Fields

Field

Type

Description

Example / Notes

`fiat_rates`

string

Specifies the external provider used to fetch fiat currency exchange rates for the coin. Currently supports ["coingecko"](/projects/291/69194).

"coingecko"

`fiat_rates_params`

string

A JSON string encoding parameters for the fiat rates provider API, including the base URL, coin identifier, and update interval in seconds.

"{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"litecoin\", \"periodSeconds\": 900}"

`fiat_rates_vs_currencies`

string

Comma-separated list of fiat and crypto currency codes against which the coin's price is fetched.

`"AED,ARS,AUD,...,USD,BTC,ETH"`

`coin_name`

string

Full human-readable name of the cryptocurrency.

`"Litecoin"`

`coin_shortcut`

string

Short ticker symbol representing the coin.

`"LTC"`

`coin_label`

string

Label used in UI or logging to represent the coin; usually same as `coin_name`.

`"Litecoin"`

`rpc_url`

string

The HTTP URL of the Litecoin daemon node's JSON-RPC endpoint used for blockchain queries.

`"http://localhost:8332"`

`rpc_user`

string

Username for authenticating RPC requests to the daemon.

`"user"`

`rpc_pass`

string

Password for authenticating RPC requests to the daemon.

`"password"`

`rpc_timeout`

integer

Timeout in seconds for RPC requests to the daemon node, ensuring timely failure and retries.

`25`

`parse`

boolean

Flag indicating if the indexer should parse transaction data or just index it raw (affects processing detail and performance).

`true`

`message_queue_binding`

string

The TCP URL for binding to a message queue used for synchronizing blockchain data or distributing indexing workload.

`"tcp://localhost:28332"`

`subversion`

string

Optional string to specify the subversion reported by the daemon node; may be left empty if not needed.

`""`

`address_format`

string

Specifies the address format used in the blockchain (e.g., legacy, segwit). Empty if default or auto-detected.

`""`

`xpub_magic`

integer

Magic number (prefix) used to identify extended public keys (xpub) for legacy addresses.

`27108450`

`xpub_magic_segwit_p2sh`

integer

Magic number for extended public keys of segwit P2SH wrapped addresses.

`28471030`

`xpub_magic_segwit_native`

integer

Magic number for extended public keys of native segwit addresses.

`78792518`

`slip44`

integer

SLIP-0044 coin type index for Litecoin, used in hierarchical deterministic wallets.

`2`

`mempool_workers`

integer

Number of parallel worker threads allocated to handle mempool transaction processing.

`8`

`mempool_sub_workers`

integer

Number of sub-workers per mempool worker for further concurrency in transaction processing.

`2`

`block_addresses_to_keep`

integer

Number of recent blocks' addresses to keep cached for efficient query and balance lookups.

`300`


Usage Example

The `config.json` file is loaded by the Blockbook indexer service at startup. Example pseudo-code for loading and using this configuration:

const fs = require('fs');

function loadIndexerConfig(path) {
  const rawConfig = fs.readFileSync(path, 'utf-8');
  const config = JSON.parse(rawConfig);
  config.fiat_rates_params = JSON.parse(config.fiat_rates_params); // parse nested JSON string

  return config;
}

const indexerConfig = loadIndexerConfig('./config.json');

// Use indexerConfig.rpc_url, indexerConfig.rpc_user, etc. to initialize RPC client
// Use indexerConfig.fiat_rates to set up fiat rate fetcher with parameters
// Set up mempool workers and caching according to config

Important Implementation Details


Interaction with Other System Components


Visual Diagram: Configuration Structure Overview

flowchart TD
    A[config.json] --> B[RPC Connection Settings]
    A --> C[Fiat Rates Settings]
    A --> D[Mempool Processing Settings]
    A --> E[Address & Key Formats]
    A --> F[Caching & Parsing Settings]

    B --> B1[rpc_url: string]
    B --> B2[rpc_user: string]
    B --> B3[rpc_pass: string]
    B --> B4[rpc_timeout: int]

    C --> C1[fiat_rates: string]
    C --> C2[fiat_rates_params: JSON string]
    C --> C3[fiat_rates_vs_currencies: string]

    D --> D1[mempool_workers: int]
    D --> D2[mempool_sub_workers: int]
    D --> D3[message_queue_binding: string]

    E --> E1[xpub_magic: int]
    E --> E2[xpub_magic_segwit_p2sh: int]
    E --> E3[xpub_magic_segwit_native: int]
    E --> E4[address_format: string]
    E --> E5[slip44: int]

    F --> F1[parse: bool]
    F --> F2[block_addresses_to_keep: int]

    subgraph Coin Identification
        G[coin_name: string]
        H[coin_shortcut: string]
        I[coin_label: string]
    end
    A --> G
    A --> H
    A --> I

Summary

The `config.json` file is a concise but comprehensive configuration descriptor for a Litecoin-specific Blockbook indexer service. It defines all parameters required for blockchain data indexing, mempool concurrency, fiat rate enrichment, and key/address parsing. By adjusting values within this file, operators can fine-tune the indexer's behavior to align with their deployment environment, Litecoin network specifics, and performance needs.

This configuration file is a vital piece bridging blockchain daemon nodes, external fiat APIs, and the higher-level API server layers, enabling a performant and adaptable blockchain indexing infrastructure within the Multi-Blockchain Coinstacks ecosystem.