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. | |
`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. | |
`coin_shortcut` | String | Ticker symbol or short identifier for the coin. | `"AVAX"` |
`coin_label` | String | Label used in UI or logs for the coin. | |
`rpc_url` | String | WebSocket URL for the blockchain node's RPC interface to submit queries and listen to events. | |
`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. |
Implementation Details
The file is a static JSON configuration archive, not executable code.
The field
fiat_rates_paramsis a stringified JSON object holding parameters for the fiat rate API call. This requires the application to parse it before usage.The
rpc_urluses a WebSocket protocol (ws://), indicating that the application communicates with the Avalanche node primarily via WebSocket RPC.Mempool handling can be customized via worker counts and timeouts, enabling performance tuning for transaction processing.
Internal transaction processing and address aliasing are optional features toggled via booleans.
External API dependencies include CoinGecko for fiat rates and 4byte.directory for smart contract method signature decoding.
This file likely serves as a template or backup for restoring or auditing previous configurations.
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:
RPC Client Module: Uses
rpc_url,rpc_user,rpc_pass, andrpc_timeoutto connect and communicate with Avalanche blockchain nodes.Mempool Handler: Reads mempool-related parameters to manage transaction processing concurrency and timeouts.
Fiat Rate Fetcher: Utilizes
fiat_rates,fiat_rates_vs_currencies, andfiat_rates_paramsto query external APIs for currency exchange data.Transaction Processor: Uses flags like
processInternalTransactionsto decide transaction parsing behavior.Address Manager: Uses
address_aliasesandblock_addresses_to_keepto manage address-related metadata.Signature Resolver: Queries
fourByteSignaturesservice to decode smart contract method signatures.Message Queue System: If message queues are used,
message_queue_bindingconfigures subscription topics.
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`