config.json


Overview

This file, `config.json`, serves as the primary configuration file for a blockchain-related application, likely a node or service interacting with the Gnosis Chain (formerly xDAI). It contains key-value pairs representing runtime parameters and settings used to connect with various services (like RPC endpoints and fiat rate APIs), control operational behavior (mempool settings, timeouts), and define coin-specific metadata.

The configuration enables the application to:

This JSON file is loaded at startup and its values are referenced throughout the system to customize behavior without hardcoding parameters.


Detailed Explanation of Configuration Parameters

Key

Type

Description

Example / Default

`consensusNodeVersion`

string

URL to retrieve the consensus node's version information, typically used for health checks or compatibility validation.

`"http://localhost:5052/eth/v1/node/version"`

`fiat_rates`

string

Identifier for the fiat rates provider service. Currently set to ["coingecko"](/projects/291/69194), implying CoinGecko API is used for currency conversion rates.

"coingecko"

`fiat_rates_params`

string (JSON)

Stringified JSON defining parameters for the fiat rates API call, including base URL, coin identifier, platform, target currency, and update period in seconds.

"{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"xdai\", \"platformIdentifier\": \"xdai\", \"platformVsCurrency\": \"usd\", \"periodSeconds\": 900}"

`fiat_rates_vs_currencies`

string

Comma-separated list of currency codes supported for fiat conversion rates, including fiat currencies and cryptocurrencies like BTC and ETH.

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

`mempoolTxTimeoutHours`

integer

Number of hours after which a transaction in the mempool times out and is discarded if not confirmed.

`24`

`queryBackendOnMempoolResync`

boolean

Flag to determine if the backend should be queried during mempool resynchronization.

`false`

`coin_name`

string

Full name of the coin or token the application is dealing with.

"Gnosis"

`coin_shortcut`

string

Abbreviated shortcut or ticker symbol for the coin.

`"xDAI"`

`coin_label`

string

Label for UI display or logging purposes, often same as coin_name.

"Gnosis"

`rpc_url`

string

WebSocket URL of the RPC server to connect to the blockchain node.

`"ws://localhost:8546"`

`rpc_user`

string

Username for RPC authentication (empty if not required).

`""`

`rpc_pass`

string

Password for RPC authentication (empty if not required).

`""`

`rpc_timeout`

integer

Timeout in seconds for RPC calls before considering them failed.

`25`

`parse`

boolean

Flag indicating if blocks/transactions should be parsed or just indexed.

`true`

`message_queue_binding`

string

Identifier or binding key for message queue integration (empty if not used).

`""`

`subversion`

string

Subversion string for node identification or logging (empty if not set).

`""`

`address_format`

string

Format identifier for blockchain addresses (e.g., hex, bech32) (empty if default).

`""`

`mempool_workers`

integer

Number of worker threads or processes dedicated to mempool transaction processing.

`8`

`mempool_sub_workers`

integer

Number of sub-worker threads for finer-grained concurrency in mempool processing.

`2`

`block_addresses_to_keep`

integer

Number of block addresses to retain in memory or cache for quick access.

`300`


Usage Examples

Since this file is a static JSON configuration, it is typically loaded at application startup. Example usage in a Node.js-like environment might be:

const fs = require('fs');

const config = JSON.parse(fs.readFileSync('config.json', 'utf8'));

console.log('RPC URL:', config.rpc_url);
console.log('Coin Name:', config.coin_name);

// Use config.rpc_url to establish WebSocket connection
// Use config.fiat_rates_params to fetch fiat currency rates at intervals

Important Implementation Details


Interaction with Other System Components


Visual Diagram: Configuration Structure Flowchart

flowchart TD
    A[config.json] --> B[Node Version URL]
    A --> C[Fiat Rates Provider]
    C --> C1[fiat_rates_params (CoinGecko API details)]
    C --> C2[Supported Currencies List]
    A --> D[Coin Metadata]
    D --> D1[coin_name]
    D --> D2[coin_shortcut]
    D --> D3[coin_label]
    A --> E[RPC Connection]
    E --> E1[rpc_url]
    E --> E2[rpc_user]
    E --> E3[rpc_pass]
    E --> E4[rpc_timeout]
    A --> F[Mempool Configuration]
    F --> F1[mempoolTxTimeoutHours]
    F --> F2[queryBackendOnMempoolResync]
    F --> F3[mempool_workers]
    F --> F4[mempool_sub_workers]
    F --> F5[block_addresses_to_keep]
    A --> G[Miscellaneous]
    G --> G1[parse]
    G --> G2[message_queue_binding]
    G --> G3[subversion]
    G --> G4[address_format]

Summary

The `config.json` file is a critical configuration component that governs how the blockchain node or service interacts with external services, manages mempool transactions, connects to blockchain nodes, and handles fiat currency conversions. Its flexible and extensible design enables easy customization of runtime parameters without code changes, supporting scalability and maintainability in a modular blockchain architecture.