config-archive.json


Overview

`config-archive.json` is a configuration file that defines critical parameters and settings used by an Avalanche blockchain-related application. This JSON file primarily serves to configure network connections, fiat currency rate sources, mempool processing behavior, and other blockchain-specific options. It encapsulates static configuration values that influence how the system interacts with external APIs, manages transactions, and processes blockchain data.

This file is intended to be loaded at runtime by the application to customize its behavior without recompilation. It centralizes all adjustable parameters for blockchain communication and auxiliary services, enabling easy modification and archival of past configurations.


Configuration Fields and Their Purpose

Field Name

Type

Description

Example / Default Value

`fiat_rates`

String

Source of fiat exchange rates for cryptocurrencies. Usually an API provider or service name.

"coingecko"

`fiat_rates_vs_currencies`

String

Comma-separated list of fiat and crypto currencies against which rates are fetched.

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

`fiat_rates_params`

String

JSON string containing parameters for the fiat rates API such as URL, coin name, platform identifier, and period.

"{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"avalanche-2\", ...}"

`mempoolTxTimeoutHours`

Number

Timeout limit (in hours) for transactions remaining in the mempool before being discarded or flagged.

`24`

`queryBackendOnMempoolResync`

Boolean

Whether to re-query backend services during mempool resynchronization to update transaction data.

`false`

`coin_name`

String

Full name of the blockchain coin.

"Avalanche"

`coin_shortcut`

String

Ticker symbol or short identifier for the coin.

`"AVAX"`

`coin_label`

String

Label used in UI or logs for the coin.

"Avalanche"

`rpc_url`

String

WebSocket URL for the blockchain node's RPC interface to submit queries and listen to events.

"ws://localhost:9650/ext/bc/C/ws"

`rpc_user`

String

RPC username for authentication (if required).

`""` (empty string means no authentication)

`rpc_pass`

String

RPC password for authentication (if required).

`""`

`rpc_timeout`

Number

Timeout (in seconds) for RPC calls before considering them failed.

`60`

`parse`

Boolean

Flag to enable or disable parsing of certain data (context-dependent).

`true`

`message_queue_binding`

String

Binding key or topic name for message queue subscriptions (if used).

`""` (empty means no binding specified)

`subversion`

String

Subversion string for node identification or compatibility checks.

`""`

`address_format`

String

Specifies the address format used by the blockchain (if applicable).

`""`

`mempool_workers`

Number

Number of parallel worker threads/processes to handle mempool transactions.

`8`

`mempool_sub_workers`

Number

Number of sub-workers per mempool worker for finer-grained parallelism.

`2`

`block_addresses_to_keep`

Number

Number of recent blocks' addresses to retain for indexing or analysis.

`600`

`address_aliases`

Boolean

Whether to enable aliasing of addresses (e.g., human-readable names).

`true`

`processInternalTransactions`

Boolean

Whether to process internal transactions within the blockchain (e.g., contract internal calls).

`true`

`fourByteSignatures`

String

URL endpoint for resolving 4-byte Ethereum method signatures to human-readable function names.

"https://www.4byte.directory/api/v1/signatures/"


Implementation Details


Usage Examples

Loading the Configuration in JavaScript

const fs = require('fs');

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

// Access RPC URL
const rpcUrl = config.rpc_url;

// Parse fiat_rates_params JSON string
const fiatParams = JSON.parse(config.fiat_rates_params);

console.log(`Connecting to RPC at ${rpcUrl}`);
console.log(`Using fiat API URL: ${fiatParams.url}`);

Applying Mempool Worker Settings

Assuming a mempool processing module accepts worker counts:

mempoolProcessor.setWorkerCount(config.mempool_workers);
mempoolProcessor.setSubWorkerCount(config.mempool_sub_workers);

Fetching Fiat Rates

Pseudocode to fetch fiat rates from CoinGecko:

apiUrl = config.fiat_rates_params.url + "/simple/price"
params = {
  ids: config.fiat_rates_params.coin,
  vs_currencies: config.fiat_rates_vs_currencies,
  platform: config.fiat_rates_params.platformIdentifier
}

response = fetch(apiUrl, params)

Interaction with Other System Components

`config-archive.json` is a foundational configuration file that interacts indirectly with multiple parts of the system:

This configuration file is typically loaded once during startup and may be reloaded or changed for upgrades or debugging.


Visual Diagram: Configuration Structure Flowchart

flowchart TD
    A[config-archive.json] --> B[RPC Settings]
    A --> C[Fiat Rate Settings]
    A --> D[Mempool Settings]
    A --> E[Coin Info]
    A --> F[Transaction Processing Flags]
    A --> G[External API Endpoints]
    A --> H[Miscellaneous Settings]

    B --> B1[rpc_url]
    B --> B2[rpc_user]
    B --> B3[rpc_pass]
    B --> B4[rpc_timeout]

    C --> C1[fiat_rates]
    C --> C2[fiat_rates_vs_currencies]
    C --> C3[fiat_rates_params]

    D --> D1[mempoolTxTimeoutHours]
    D --> D2[mempool_workers]
    D --> D3[mempool_sub_workers]
    D --> D4[queryBackendOnMempoolResync]

    E --> E1[coin_name]
    E --> E2[coin_shortcut]
    E --> E3[coin_label]

    F --> F1[parse]
    F --> F2[address_aliases]
    F --> F3[processInternalTransactions]

    G --> G1[fourByteSignatures]

    H --> H1[message_queue_binding]
    H --> H2[subversion]
    H --> H3[address_format]
    H --> H4[block_addresses_to_keep]

Summary

`config-archive.json` is a critical JSON configuration file for an Avalanche blockchain application. It defines network connection parameters, fiat currency exchange sources, mempool transaction processing behavior, coin metadata, and external service endpoints. This file enables flexible and centralized configuration management, allowing the application to adjust its runtime behavior without code changes.

By separating configuration data from application logic, it supports easier upgrades, environment-specific setups, and archival of previous configurations for auditing or rollback purposes.


*End of documentation for* `config-archive.json`