config.json

Overview

`config.json` is a configuration file used by the Blockbook Indexer Service for the Bitcoin Cash (BCH) blockchain network. It defines essential parameters that govern how the indexer connects to the blockchain node, manages data indexing, processes mempool transactions, formats addresses, and integrates external services such as fiat currency rate providers.

The file’s primary role is to supply the indexer with blockchain-specific settings, RPC connection details, concurrency options, and fiat rate update configurations. This enables the Blockbook indexer to efficiently track blockchain state changes, cache relevant data, and enrich blockchain data with up-to-date fiat currency values.


Configuration Properties and Their Descriptions

Property

Type

Description

Example Value

`fiat_rates`

string

Specifies the external fiat currency rate provider used to fetch exchange rates for the cryptocurrency.

`"coingecko"`

`fiat_rates_params`

string

JSON string containing parameters specific to the fiat rate provider, such as API URL, coin id, and refresh period in seconds.

`"{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin-cash\", \"periodSeconds\": 900}"`

`fiat_rates_vs_currencies`

string

Comma-separated list of fiat and crypto currency codes against which the coin’s rates are fetched.

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

`coin_name`

string

Human-readable short name of the coin used internally within the indexer.

`"Bcash"`

`coin_shortcut`

string

Short ticker symbol of the coin.

`"BCH"`

`coin_label`

string

Full display label of the coin.

`"Bitcoin Cash"`

`rpc_url`

string

URL of the blockchain RPC node to which the indexer connects for blockchain data access.

`"http://localhost:8332"`

`rpc_user`

string

Username for RPC node authentication.

`"user"`

`rpc_pass`

string

Password for RPC node authentication.

`"password"`

`rpc_timeout`

number

Timeout in seconds for RPC requests to the blockchain node.

`25`

`parse`

boolean

Flag indicating whether to parse transactions and blocks for indexing.

`true`

`message_queue_binding`

string

Endpoint URL for the message queue used to synchronize blockchain events or distribute workload among indexer instances.

`"tcp://localhost:28332"`

`subversion`

string

Optional version string identifying the subversion of the blockchain node or indexer.

`""` (empty string in this config)

`address_format`

string

The address format used by the blockchain (e.g., `cashaddr` for Bitcoin Cash).

`"cashaddr"`

`xpub_magic`

number

Magic number for extended public keys used in HD wallets specific to the blockchain.

`76067358`

`slip44`

number

SLIP-0044 coin type number identifying the blockchain in HD wallets and related libraries.

`145`

`mempool_workers`

number

Number of worker threads for processing mempool (unconfirmed) transactions concurrently.

`8`

`mempool_sub_workers`

number

Number of sub-worker threads per mempool worker to further parallelize mempool transaction processing.

`2`

`block_addresses_to_keep`

number

Number of recent blocks' worth of addresses to retain in memory/cache for efficient address lookups.

`300`


Detailed Explanation of Key Parameters

Fiat Rate Integration Parameters

Usage Example:

{
  "fiat_rates": "coingecko",
  "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin-cash\", \"periodSeconds\": 900}",
  "fiat_rates_vs_currencies": "USD,EUR,BTC,ETH"
}

The indexer uses these parameters to periodically send requests to CoinGecko’s API, retrieve up-to-date price data for Bitcoin Cash against the listed currencies, and store this data to enrich client responses.


RPC Node Connection

Example:

{
  "rpc_url": "http://localhost:8332",
  "rpc_user": "user",
  "rpc_pass": "password",
  "rpc_timeout": 25
}

The indexer authenticates with the node and performs calls within the timeout window to ensure responsiveness.


Blockchain Identification and Addressing

These parameters ensure the indexer correctly interprets blockchain data and formats addresses and keys in a consistent manner.


Mempool Processing


Miscellaneous


Usage Example in Context

Suppose you want to run the Blockbook indexer for Bitcoin Cash using this configuration. The indexer will:

  1. Connect to the Bitcoin Cash full node at http://localhost:8332 with the provided user credentials.

  2. Parse incoming blocks and transactions, processing them with up to 8 mempool worker threads and 2 sub-workers each.

  3. Cache addresses from the last 300 blocks for fast lookup.

  4. Format addresses in cashaddr format, using the SLIP44 coin type 145.

  5. Periodically query CoinGecko every 15 minutes for Bitcoin Cash exchange rates against a wide range of fiat and crypto currencies.

  6. Bind to the message queue at tcp://localhost:28332 to receive blockchain event notifications or to share workload.


Implementation Details and Algorithms


Interaction with Other Components


Visual Diagram: Flowchart of Configuration Role in Indexer Workflow

flowchart TD
    Config[config.json]
    RPC[Blockchain RPC Node]
    MQ[Message Queue]
    Indexer[Blockbook Indexer Service]
    FiatAPI[Fiat Rate Provider API]
    Cache[Address & Fiat Rate Cache]
    Workers[Mempool Workers]

    Config -->|RPC params| RPC
    Config -->|MQ endpoint| MQ
    Config -->|Fiat rate params| FiatAPI
    Config -->|Concurrency settings| Workers
    Indexer -->|Fetch blockchain data| RPC
    Indexer -->|Subscribe events| MQ
    Indexer -->|Fetch fiat rates| FiatAPI
    Indexer -->|Cache data| Cache
    Workers -->|Process mempool txs| Indexer

**Diagram Explanation:** This flowchart shows how the `config.json` file provides key parameters to the Blockbook Indexer Service. The indexer uses RPC details to fetch blockchain data, connects to a message queue for event-driven updates, polls an external fiat rate API, and manages concurrency through worker threads. All processed and enriched data is cached for fast access by API servers and clients.


Summary

The `config.json` file is a critical piece of the Blockbook Indexer’s deployment, encapsulating all necessary parameters for:

By properly setting these parameters, the indexer can deliver performant, accurate, and enriched blockchain data to the broader Multi-Blockchain Coinstacks ecosystem, supporting wallet services, analytics, and client applications.