config.json

Overview

The `config.json` file serves as the primary configuration resource for a blockchain-related software module, likely a node or service interacting with the Base (Ethereum-based) network. It specifies critical runtime parameters, including fiat currency exchange rate sources, blockchain node connection details, mempool transaction handling, and other operational settings.

This configuration drives how the application interfaces with external services (e.g., CoinGecko for exchange rates), communicates with the blockchain node via RPC, and manages internal processing such as mempool transaction timeouts and worker concurrency.


Detailed Explanation of Configuration Fields

Since `config.json` is a JSON configuration file without classes or functions, the documentation focuses on the purpose and use of each key/value pair:

Key

Type

Description

Example / Notes

`fiat_rates`

string

Defines the service or provider used for fetching fiat currency exchange rates. In this file, ["coingecko"](/projects/291/69194) indicates that the CoinGecko API is the source.

"coingecko"

`fiat_rates_vs_currencies`

string

A comma-separated list of fiat and cryptocurrency symbols for which exchange rates are to be fetched relative to the base currency.

`"AED,ARS,AUD,...,BTC,ETH"` includes many fiat currencies plus Bitcoin and Ethereum.

`fiat_rates_params`

string (JSON encoded)

Contains parameters for the fiat rate fetching API, including API endpoint URL, coin identifier, platform, currency, and refresh period in seconds.

`"{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ethereum\", \"platformIdentifier\": \"ethereum\", \"platformVsCurrency \": \"eth\", \"periodSeconds\": 900}"`
Note: The key `platformVsCurrency ` has a trailing space, which might be a typo.

`mempoolTxTimeoutHours`

integer

Defines how long (in hours) a transaction stays in the mempool before timing out. This helps in cleaning stale transactions from memory pools.

`24` (hours)

queryBackendOnMempoolResync

boolean

Indicates whether to query the backend system when resynchronizing the mempool. This can be used to ensure consistency but may increase load.

`false`

`coin_name`

string

The full name of the blockchain coin or token that this configuration targets.

"Base"

`coin_shortcut`

string

The ticker symbol or shorthand for the coin.

`"ETH"`

`coin_label`

string

A label used within the application to identify the coin.

"Base"

`rpc_url`

string

The WebSocket URL endpoint for connecting to the blockchain node's RPC interface.

`"ws://localhost:8546"`

`rpc_user`

string

Username for RPC authentication (empty if not needed).

`""` (empty)

`rpc_pass`

string

Password for RPC authentication (empty if not needed).

`""` (empty)

`rpc_timeout`

integer

Timeout duration (in seconds) for RPC calls to the blockchain node.

`25` (seconds)

`parse`

boolean

Indicates whether to parse transaction data and blocks. Parsing enables more detailed analysis but potentially requires more resources.

`true`

`message_queue_binding`

string

Configuration related to message queue bindings, possibly for event or data streaming systems. Empty if not configured.

`""` (empty)

`subversion`

string

String to identify the client subversion or build version. Empty if not set.

`""` (empty)

address_format

string

Specifies the address format used by the application (e.g., legacy, bech32). Empty if default or unspecified.

`""` (empty)

`mempool_workers`

integer

Number of worker threads/processes dedicated to mempool transaction processing. This affects concurrency and performance.

`8`

`mempool_sub_workers`

integer

Number of sub-workers for mempool processing, likely a finer granularity for parallelism.

`2`

`block_addresses_to_keep`

integer

The number of blocks for which address data is retained. This might affect how far back address-related information is cached or stored.

`600`


Usage Examples

Since `config.json` is a static JSON file, its usage is primarily by the application loading this file at startup or runtime to configure its behavior.

Example (pseudo-code):

import json

with open('config.json') as f:
    config = json.load(f)

# Connect to blockchain node RPC
rpc = connect_rpc(url=config["rpc_url"], timeout=config["rpc_timeout"])

# Setup fiat rates fetching service
fiat_service = FiatRateService(
    provider=config["fiat_rates"],
    params=json.loads(config["fiat_rates_params"]),
    currencies=config["fiat_rates_vs_currencies"].split(',')
)

# Configure mempool workers
mempool_manager = MempoolManager(
    workers=config["mempool_workers"],
    sub_workers=config["mempool_sub_workers"],
    tx_timeout=config["mempoolTxTimeoutHours"]
)

# Further initialization...

Important Implementation Details and Observations


Interaction with Other System Components


Visual Diagram

Given that `config.json` is a configuration file without classes or functions, the most appropriate visual is a **flowchart** showing how the main configuration groups relate to key system components:

flowchart TD
    A[config.json] --> B[Blockchain Node RPC]
    A --> C[Fiat Rates Service]
    A --> D[Mempool Processing]
    A --> E[Message Queue (optional)]

    B -->|Uses rpc_url, rpc_user, rpc_pass, rpc_timeout| F[Blockchain Node]
    C -->|Uses fiat_rates, fiat_rates_params, fiat_rates_vs_currencies| G[CoinGecko API]
    D -->|Uses mempoolTxTimeoutHours, mempool_workers, mempool_sub_workers| H[Mempool Manager]
    E -->|Uses message_queue_binding| I[Message Queue System]

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style B fill:#bbf,stroke:#333
    style C fill:#bbf,stroke:#333
    style D fill:#bbf,stroke:#333
    style E fill:#bbf,stroke:#333

Summary

`config.json` configures key parameters for:

This file is essential for tailoring the application's runtime behavior to the target blockchain network and external service integrations. Proper setup ensures efficient processing, reliable connectivity, and accurate financial data representation.


**End of `config.json` documentation**