config.json


Overview

The `config.json` file serves as a configuration blueprint for the Blockbook Indexer Service tailored to the **BNB Smart Chain** blockchain within the Multi-Blockchain Coinstacks architecture. This JSON file encapsulates essential parameters that dictate how the indexer connects to blockchain nodes, processes mempool transactions, manages caching, and integrates external fiat currency rates for enriching blockchain data.

By externalizing these settings, the indexer achieves flexibility and adaptability to different blockchain environments without code changes. It enables fine-tuning of performance characteristics (e.g., concurrency levels), external API integration (e.g., CoinGecko fiat rates), and blockchain-specific details (e.g., coin name, RPC endpoints).


Configuration Parameters Detailed Explanation

Key

Type

Description

Example / Default Value

`fiat_rates_vs_currencies`

String

Comma-separated list of fiat and crypto currency codes to fetch exchange rates against the blockchain coin.

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

`fiat_rates_params`

String

JSON string specifying parameters for the fiat rates API request. Includes URL, coin identifier, platform currency, and update period in seconds.

"{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"binancecoin\", \"platformIdentifier\": \"binance-smart-chain\", \"platformVsCurrency\": \"bnb\", \"periodSeconds\": 900}"

`mempoolTxTimeoutHours`

Integer

Number of hours after which unconfirmed mempool transactions are considered stale and discarded.

`24`

`queryBackendOnMempoolResync`

Boolean

Whether to query the backend blockchain node again when resynchronizing mempool transactions.

`false`

`coin_name`

String

Full human-readable name of the blockchain coin.

`"BNB Smart Chain"`

`coin_shortcut`

String

Short ticker symbol or shortcut for the coin.

`"BNB"`

`coin_label`

String

Label used for display or logging purposes.

`"BNB Smart Chain"`

`rpc_url`

String

WebSocket URL of the blockchain RPC node for JSON-RPC communications.

`"ws://localhost:8546"`

`rpc_user`

String

Username for RPC authentication, if applicable.

`""` (empty if no auth)

`rpc_pass`

String

Password for RPC authentication, if applicable.

`""` (empty if no auth)

`rpc_timeout`

Integer

Timeout in seconds for RPC calls before considering them failed.

`25`

`parse`

Boolean

Flag indicating whether to parse blockchain data in detail.

`true`

`message_queue_binding`

String

Name or identifier for message queue binding if used for synchronization or notification.

`""` (empty if not configured)

`subversion`

String

Optional subversion string for client identification or logging.

`""` (empty if not specified)

`address_format`

String

Address format type or encoding used by this blockchain (e.g., bech32, base58).

`""` (empty if default or unspecified)

`mempool_workers`

Integer

Number of concurrent worker threads/processes dedicated to processing mempool transactions.

`8`

`mempool_sub_workers`

Integer

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

`2`

`block_addresses_to_keep`

Integer

Number of recent blocks for which address data is cached and retained in memory.

`300`


Usage and Examples

Typical Usage

The `config.json` file is loaded at the startup of the Blockbook Indexer service instance for BNB Smart Chain. The indexer reads these parameters to:

The configuration ensures the indexer behaves as expected for this specific blockchain environment.


Important Implementation Details


Interaction with Other Components


Visual Diagram

The following **flowchart** presents the role of this configuration file in the overall workflow of the Blockbook Indexer service:

flowchart TD
    Config[config.json] -->|Loads RPC & concurrency settings| Indexer[Blockbook Indexer Service]
    Config -->|Defines fiat rate API params| FiatAPI[Fiat Rate Fetcher]
    Config -->|Sets mempool processing parameters| Mempool[Mempool Processing Workers]
    Indexer -->|Connects via RPC| Daemon[Daemon Node (Blockchain)]
    Indexer -->|Exposes data| API[API Server]
    FiatAPI -->|Fetches rates| CoinGecko[CoinGecko API]
    Mempool -->|Processes transactions| Indexer

Summary


Appendix: Example snippet from config.json

{
  "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
  "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"binancecoin\",\"platformIdentifier\": \"binance-smart-chain\",\"platformVsCurrency\": \"bnb\",\"periodSeconds\": 900}",
  "mempoolTxTimeoutHours": 24,
  "queryBackendOnMempoolResync": false,
  "coin_name": "BNB Smart Chain",
  "coin_shortcut": "BNB",
  "coin_label": "BNB Smart Chain",
  "rpc_url": "ws://localhost:8546",
  "rpc_user": "",
  "rpc_pass": "",
  "rpc_timeout": 25,
  "parse": true,
  "message_queue_binding": "",
  "subversion": "",
  "address_format": "",
  "mempool_workers": 8,
  "mempool_sub_workers": 2,
  "block_addresses_to_keep": 300
}

This completes the comprehensive documentation for the `config.json` file.