config.json
Overview
The `config.json` file serves as the primary configuration source for a Blockbook Indexer Service instance tailored to the Dogecoin blockchain. This JSON configuration file contains all necessary parameters for connecting to the Dogecoin RPC node, managing indexer worker concurrency, setting caching policies, integrating fiat currency exchange rates, and specifying blockchain-specific parameters such as address format and extended public key magic bytes.
This file enables the indexer service to operate correctly by providing connection credentials, runtime options, and external service endpoints. It is critical in customizing the indexer's behavior to the targeted blockchain and its ecosystem.
Detailed Explanation of Configuration Fields
Field | Type | Description | Example / Notes |
|---|---|---|---|
**fiat_rates** | String | Specifies the external provider for fiat currency rates used to enrich blockchain data with exchange rates. | `"coingecko"` — the indexer fetches rates from CoinGecko API. |
**fiat_rates_vs_currencies** | String | A comma-separated list of fiat and crypto currency symbols against which exchange rates are fetched. | `"AED,ARS,AUD,BDT,...,BTC,ETH"` — includes multiple fiat currencies and cryptocurrencies. |
**fiat_rates_params** | String | A JSON-encoded string containing parameters for the fiat rates provider, such as API URL, coin identifier, and update interval in seconds. | {"url": "https://api.coingecko.com/api/v3", "coin": "dogecoin", "periodSeconds": 900} |
**coin_name** | String | The full name of the blockchain coin. | `"Dogecoin"` |
**coin_shortcut** | String | The coin's ticker symbol or shorthand. | `"DOGE"` |
**coin_label** | String | Label used across the indexer and APIs for this blockchain coin. | `"Dogecoin"` |
**rpc_url** | String | The full URL to the blockchain node's RPC endpoint, used for direct blockchain queries such as fetching blocks and transactions. | `"http://localhost:8332"` |
**rpc_user** | String | Username for authenticating with the RPC node. | `"user"` |
**rpc_pass** | String | Password for authenticating with the RPC node. | `"password"` |
**rpc_timeout** | Integer | Timeout in seconds for RPC calls to the blockchain node. | `25` |
**parse** | Boolean | Enables or disables parsing of blockchain data within the indexer. Typically true to allow extraction of addresses, amounts, and other metadata. | `true` |
**message_queue_binding** | String | URI for the message queue broker used to bind and listen for blockchain events or synchronization messages. | `"tcp://localhost:28332"` |
**subversion** | String | Optional field indicating the subversion string of the blockchain node; may be used for compatibility checks or logging. | `""` (empty in this config) |
**address_format** | String | Defines the address format used by this blockchain (e.g., legacy, segwit, bech32). Empty string here indicates default or unspecified format. | `""` |
**xpub_magic** | Integer | Magic bytes used to identify extended public keys (xpubs) for this blockchain, supporting HD wallet compatibility. | `49990397` |
**slip44** | Integer | SLIP-44 coin type index, used in HD wallets to derive coin-specific keypaths. | `3` (Dogecoin's registered SLIP-44 index) |
**mempool_workers** | Integer | Number of concurrent worker threads allocated for mempool transaction processing. | `8` |
**mempool_sub_workers** | Integer | Number of sub-workers per mempool worker for further parallelization of mempool transaction handling. | |
**block_addresses_to_keep** | Integer | Number of recent blocks' addresses to keep cached for efficient querying and quick address balance calculations. | `300` |
Usage and Examples
Loading Configuration in the Indexer
The indexer service loads `config.json` at startup to configure its runtime behavior. For example, in Node.js:
const fs = require('fs');
const config = JSON.parse(fs.readFileSync('config.json', 'utf8'));
console.log(`Connecting to RPC node at ${config.rpc_url} with user ${config.rpc_user}`);
Example: Configuring Fiat Rates Fetching
The indexer uses the `fiat_rates`, `fiat_rates_vs_currencies`, and `fiat_rates_params` to query CoinGecko every 900 seconds for Dogecoin price data:
"fiat_rates": "coingecko",
"fiat_rates_vs_currencies": "USD,EUR,BTC,ETH,...",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"dogecoin\", \"periodSeconds\": 900}"
The indexer's fiat rate module parses `fiat_rates_params` into an object and schedules periodic HTTP GET requests to:
https://api.coingecko.com/api/v3/simple/price?ids=dogecoin&vs_currencies=USD,EUR,BTC,ETH,...
Important Implementation Details
RPC Connection: The indexer authenticates with the Dogecoin RPC node using
rpc_userandrpc_passand makes JSON-RPC calls over HTTP. Therpc_timeoutgoverns the maximum wait time per RPC request.Mempool Workers: The fields
mempool_workersandmempool_sub_workerscontrol the concurrency level for processing unconfirmed transactions. This parallelism helps maintain responsive mempool tracking under high load.Cache Management:
block_addresses_to_keepdefines how many recent blocks’ worth of address data are cached in memory. This parameter balances memory consumption against query performance.Extended Public Key (xpub) Magic: The
xpub_magicvalue is critical for wallet derivation and validation, ensuring that HD wallets are compatible with Dogecoin-specific key versions per SLIP-44 standard.Fiat Rates Integration: The fiat rates configuration allows the indexer to enrich transaction and address data with fiat values, enabling clients and API servers to display current or historical price information alongside blockchain data.
Message Queue Binding: The
message_queue_bindingfield is used to connect the indexer to a message queue (e.g., ZeroMQ or TCP socket) for receiving real-time blockchain updates or synchronizing across distributed indexer instances.
Interaction with Other System Components
Daemon Node: The indexer connects to the Dogecoin daemon node via RPC (
rpc_url) to fetch blockchain data, such as blocks and transactions.Message Queue: Via
message_queue_binding, the indexer subscribes to blockchain event streams, allowing near real-time processing of new blocks and mempool transactions.API Servers: The indexer exposes processed and cached blockchain data to API servers, which serve client applications requesting transaction histories, balances, and mempool status.
Fiat Rate Provider: The indexer periodically queries the external fiat rate provider (CoinGecko) configured in
fiat_rates_paramsto obtain up-to-date exchange rates for Dogecoin against a list of fiat and crypto currencies.Wallets/Clients: Wallet software or clients consuming API data rely on parameters like
address_format,xpub_magic, andslip44to interpret addresses and keys correctly for Dogecoin.
Visual Diagram: Configuration Structure Flowchart
flowchart TD
Config[config.json]
Config --> RPC[RPC Connection]
Config --> Mempool[Mempool Workers]
Config --> Cache[Cache Settings]
Config --> FiatRates[Fiat Rates Integration]
Config --> MsgQueue[Message Queue Binding]
Config --> BlockchainParams[Blockchain Parameters]
RPC -->|Uses| rpc_url
RPC -->|Uses| rpc_user
RPC -->|Uses| rpc_pass
RPC -->|Uses| rpc_timeout
Mempool -->|Controls| mempool_workers
Mempool -->|Controls| mempool_sub_workers
Cache -->|Defines| block_addresses_to_keep
FiatRates -->|Provider| fiat_rates
FiatRates -->|Currencies| fiat_rates_vs_currencies
FiatRates -->|Params| fiat_rates_params
MsgQueue -->|Binding URI| message_queue_binding
BlockchainParams -->|Coin Info| coin_name
BlockchainParams -->|Coin Symbol| coin_shortcut
BlockchainParams -->|Coin Label| coin_label
BlockchainParams -->|Address Format| address_format
BlockchainParams -->|xpub Magic| xpub_magic
BlockchainParams -->|SLIP44 Index| slip44
Summary
The `config.json` file is a foundational configuration artifact for the Dogecoin Blockbook Indexer, specifying how the indexer connects to blockchain nodes, processes mempool transactions, caches address data, and integrates external fiat currency rates. It also defines blockchain-specific parameters that ensure data is interpreted and served correctly downstream to API servers and clients.
The clarity and completeness of this configuration enable the indexer to efficiently and reliably index Dogecoin blockchain data, supporting fast queries, real-time event notifications, and enriched data views for end users.