config.json

Overview

The `config.json` file serves as the primary configuration source for the application’s blockchain interaction and fiat currency rate fetching components. It defines essential parameters such as fiat currency rate providers, blockchain RPC connection details, mempool processing settings, coin-specific metadata, and operational timeouts. This JSON configuration allows the application to dynamically adjust its behavior without changing the codebase, supporting multiple fiat currencies, different coins (specifically Arbitrum in this case), and flexible mempool transaction management.


Detailed Explanation of Configuration Properties

1. fiat_rates

2. fiat_rates_params

3. fiat_rates_vs_currencies

4. mempoolTxTimeoutHours

5. queryBackendOnMempoolResync

6. coin_name

7. coin_shortcut

8. coin_label

9. rpc_url

10. rpc_user

11. rpc_pass

12. rpc_timeout

13. parse

14. message_queue_binding

15. subversion

16. address_format

17. mempool_workers

18. mempool_sub_workers

19. block_addresses_to_keep


Important Implementation Details


Interaction with Other System Components


Usage Example

Suppose the application wants to fetch the fiat exchange rates from CoinGecko every 15 minutes for Ethereum against USD and other currencies:

  1. Parse fiat_rates_params JSON string to extract URL and coin info.

  2. Use fiat_rates_vs_currencies to specify the target currencies for the exchange rates.

  3. Fetch data from CoinGecko API endpoint https://api.coingecko.com/api/v3.

  4. Cache and refresh the data every 900 seconds (15 minutes).

  5. Use rpc_url and credentials to connect to the Arbitrum blockchain for transaction processing.

  6. Use mempool worker settings to handle incoming transactions efficiently.


Mermaid Diagram: Configuration Structure Flowchart

This flowchart illustrates the main configuration categories and their relationships in `config.json`.

flowchart TD
    A[config.json]
    A --> B[Fiat Rate Settings]
    B --> B1[fiat_rates]
    B --> B2[fiat_rates_params (JSON string)]
    B --> B3[fiat_rates_vs_currencies]

    A --> C[Blockchain Node Settings]
    C --> C1[rpc_url]
    C --> C2[rpc_user]
    C --> C3[rpc_pass]
    C --> C4[rpc_timeout]
    C --> C5[subversion]
    C --> C6[address_format]

    A --> D[Mempool Settings]
    D --> D1[mempoolTxTimeoutHours]
    D --> D2[queryBackendOnMempoolResync]
    D --> D3[mempool_workers]
    D --> D4[mempool_sub_workers]
    D --> D5[block_addresses_to_keep]

    A --> E[Coin Info]
    E --> E1[coin_name]
    E --> E2[coin_shortcut]
    E --> E3[coin_label]

    A --> F[Miscellaneous]
    F --> F1[parse]
    F --> F2[message_queue_binding]

Summary

The `config.json` file is a centralized configuration resource that controls the behavior of the fiat currency rate fetching, blockchain RPC communication, mempool processing, and coin metadata for the application. It enables flexible, scalable, and maintainable operation by externalizing key parameters into a single JSON structure. Proper parsing and handling of this configuration ensure efficient integration with external APIs and blockchain nodes, as well as optimized transaction processing workflows.