XChain Platform Indexer: Configuration Reference

Environment Variables

Configuration is loaded from a .env file and environment variables. Copy the .env.example file and configure before running.

Required Variables

Variable Description Example
DECODER_DB_HOST Decoder database hostname 127.0.0.1
DECODER_DB_PORT Decoder database port 3306
DECODER_DB_NAME Decoder database name XChain_BTC_Mainnet_Decoder
DECODER_DB_USER Decoder database username xchain
DECODER_DB_PASS Decoder database password secretpassword
INDEXER_DB_HOST Indexer database hostname 127.0.0.1
INDEXER_DB_PORT Indexer database port 3306
INDEXER_DB_NAME Indexer database name XChain_BTC_Mainnet_Indexer
INDEXER_DB_USER Indexer database username xchain
INDEXER_DB_PASS Indexer database password secretpassword
INDEXER_COIN Blockchain to index. The service requires it; the measurement script bin/measure-batch-execute-cost.js defaults to BTC when it is unset. BTC, LTC, or DOGE
INDEXER_NETWORK Network to index. The service requires it; the measurement script bin/measure-batch-execute-cost.js defaults to regtest when it is unset. mainnet, testnet, or regtest

Optional Variables

Variable Description Default
INDEXER_API_PORT API server listening port 3004
CORS_ORIGIN Allowed CORS origin for API requests http://localhost
INDEXER_RATE_LIMIT_RPM API requests per minute per IP 600
BALANCE_DELTA_MODE How address balances are maintained after each block. off re-sums each touched address’s credit and debit history; verify re-sums too while comparing the collected per-block delta and logging any difference; on applies the collected delta instead of re-summing. A rollback always re-sums. Read case-insensitively; any other value reads as off. off
HUB_API_URL Hub JSON-RPC base URL used by the indexer’s hub client. Falls back to the URL passed in code when unset. (unset)
HUB_API_KEY API key sent with hub calls. Required whenever the hub runs keyed, which is always in validator mode. Treat as a credential. (unset)
HUB_CONFIG_URL Hub API base URL for the config-oracle poll (getallconfigs). The hub keeps that method off its public feed port because the answer carries every service’s DB credentials, so an indexer pointed at a validator’s feed port pushes and mirrors correctly but fails its config poll once a minute forever, silently freezing the hub-supplied params at their startup values. Point this at a private hub API port to separate the two roles. Unset falls back to HUB_API_URL, so a single-hub deployment is unchanged. (unset)
HUB_CONFIG_API_KEY API key sent with the config-oracle poll when HUB_CONFIG_URL is a separately keyed port. Unset falls back to HUB_API_KEY. Treat as a credential. (unset)
HUB_REORG_API_KEY Separate key for the hub’s retraction rails (pushpricereorg, pushxcallreorg, pushdexreorg) when the hub gates them independently. Unset falls back to HUB_API_KEY, which is the legacy single-key behaviour. Treat as a credential. (falls back to HUB_API_KEY)
HUB_CALL_DEADLINE_MS Wall-clock ceiling in milliseconds for a single hub call from the indexer’s hub client. The request’s own timeout option is an idle-socket timer that resets on every byte received, so it bounds a silent socket and nothing else; a hub drip-feeding a body holds the call open forever inside it. A non-finite or non-positive value falls back to the built-in default. 60000
INDEXER_ALLOW_UNAUTHENTICATED Set to true to restore keyless pass-through on the gated methods (validator-reward writes, federation reads, gated exec). With no API key configured those methods otherwise fail closed. This is the explicit escape hatch for single-host and regtest nodes; do not set it on a node reachable beyond its own host. (unset, fails closed)
UTXO_TRACKER_URL UTXO-tracker hostname. Optional overall, but required for the DISPENSER fresh-address check. (unset)
UTXO_TRACKER_API_PORT UTXO-tracker port, paired with UTXO_TRACKER_URL. (unset)
BTC_INDEXER_DB_NAME Name of the BTC indexer database, read by recovery.js when rebuilding state from an anchored checkpoint on a non-BTC chain that needs to resolve BTC-anchored data. (unset)
DB_CONNECT_TIMEOUT MariaDB connection timeout in milliseconds 10000
DB_ACQUIRE_TIMEOUT Time to wait for a free pooled connection, in milliseconds 10000
DB_QUERY_TIMEOUT MariaDB query execution timeout in milliseconds 30000
MIGRATE_QUERY_TIMEOUT Per-statement limit in milliseconds the migration runner sets for each applied migration file, restoring the pool value afterwards; a scoped run with nothing to apply sets nothing. A non-numeric or negative value keeps the default. 3600000
MIGRATION_STRICT_CHECKSUM Set to 1 to make a schema-checksum mismatch fail closed at startup instead of logging and continuing. Off by default so a diverged schema does not cause a surprise fleet-wide boot failure; the operator path (node src/db/migration/migrate.js) fails closed regardless. (unset, non-fatal)
SHUTDOWN_TIMEOUT_MS Hard-exit budget for the SIGTERM/SIGINT drain, in milliseconds. On docker stop the indexer stops reporting itself running on /status, lets the block loop break at its next block boundary (never mid-transaction), drains the API listener, closes its database pools and exits 0; if that has not finished within the budget it logs the overrun and exits 1 instead of lingering until docker’s SIGKILL. Sized under the 30 s stop budget xchain-node gives the indexer, and under the ten seconds docker allows a container created before that budget existed; raise it, keeping it under the stop budget, for a chain whose blocks take longer to apply. When XCHAIN_NODE_MODULE_STOP_TIMEOUT_SECONDS_XCHAIN_INDEXER overrides that budget, xchain-node sets this to the budget less 20 s (half the budget below 40 s) unless the module config sets it. A non-numeric or non-positive value keeps the default. 8000

Migration compatibility harness

bin/check-migration-old-code-compat.js is a standalone maintenance harness (run through bin/check-migration-old-code-compat.sh) that checks an older code ref against a migrated database schema. It reads its own environment, separate from the service configuration above:

Variable Description Default
OLD_REF Git ref of the older indexer code to check the migrated schema against (required)
DB_NAME Database the compatibility checks run against (required)
DB_HOST MariaDB host for that database (required)
DB_PORT MariaDB port (unset)
DB_USER MariaDB user (unset)
DB_PASS MariaDB password. Treat as a credential; pass it through the environment, never on a command line. (unset)
REPO Path to the indexer checkout whose git history holds OLD_REF (the repo containing the script)

Block-processing barriers and health

Variable Description Default
HUB_PRICE_SYNC_TIMEOUT_MS Price-sync barrier timeout. Before processing a block the indexer waits for its local price mirror to reach that block height, so native-coin fee validation is deterministic across operators. On timeout the block is deferred and retried rather than validated against a stale price copy. 60000
INDEXER_HEALTH_STALL_GRACE_MS How long with no committed block before the container reports unhealthy (503). Defaults to comfortably more than one barrier cycle so a single legitimate defer never flaps the healthcheck. A roll-call or capability proof wait (rollcall_proof_unavailable, capability_proof_unavailable) is judged against its own longer window instead: twice HUB_SYNC_BARRIER_HOLD_CEILING_S, never less than this grace. It reports rollcall_proof_wait or capability_proof_wait, then the _stuck class past the ceiling (/ready answers 503), and only then wedged, which buys one container restart. With the ceiling at 0 it falls back to this grace. Operational only, not a consensus parameter. max(2 × HUB_PRICE_SYNC_TIMEOUT_MS, 120000)
INDEXER_POLL_SILENT_MS How long the block-poll loop may go without completing an iteration before the health payload reports it silent and the monitor crits. Deliberately not part of the /status 503 gate: one block can hold a single iteration across several sequential barrier waits, and restarting the container is the wrong answer to a slow block, so the default doubles the stall grace again. Measures loop liveness, never chain progress, so unlike the stall signal it has nothing to do with commits. Operational only, not a consensus parameter. 2 × INDEXER_HEALTH_STALL_GRACE_MS
INDEXER_READY_NO_COMMIT_MS How long the indexer may sit behind a known tip without committing a block before GET /ready, and the ready / notReadyReasons fields on /status, report it not ready (behind_tip_no_commit). Readiness only: the /status 503 liveness gate never reads it. A value that is not a positive integer keeps the default. Operational only, not a consensus parameter. 600000 (10 min)
INDEXER_CHAIN_TIP_TTL_MS How long the coin node tip read from the utxo tracker is cached for the chainLag field on /status. A known tip older than this makes readiness fail with chain_tip_stale. A value that is not a positive integer keeps the default. Health reporting only. 15000
INDEXER_CHAIN_TIP_TIMEOUT_MS Timeout for one coin node tip read from the utxo tracker. A failed or slow refresh keeps the last known tip, and chainTipAt says how old it is. A value that is not a positive integer keeps the default. Health reporting only. 1500
XCALL_DIRECT_PRESENCE_TIMEOUT_MS Call-presence barrier timeout in direct-hub-DB mode. With no HubDbSync mirror the cross-chain-call sync barrier is skipped, but reading the hub’s MariaDB directly does not guarantee an in-flight relay row has landed, so the indexer waits this long for it before the cross-chain-call pass. 10000
CHAIN_TIP_PUSH_MAX_LAG Skip pushing the chain tip to the hub while the indexer is more than this many blocks behind the decoder tip. During a bulk re-index, pushing a tip per historical block floods the hub’s rate limiter with 429s for no value: the hub only cares about the live tip. 100
HUB_SYNC_ANCHOR_ATTEST_GRACE_S Grace margin on the anchor-reward attestation mirror barrier. The BTC indexer only derives an anchor/archive reward once the hub mirror is certified to hold everything produced up to the block being processed; a node that cannot certify that defers the block rather than deriving a partial reward set. Honoured on regtest only: elsewhere it is a consensus input and the frozen value wins. A fast chain must lower this or it cannot make progress. The barrier waits for the mirror watermark to reach block_time + this value, which costs nothing where blocks are minutes apart, because the watermark is long past by the time a block is processed. Where blocks are stamped at about wall clock, and the watermark tracks wall clock too, a freshly mined block can never be this far behind it: the wait cannot be satisfied and every affected block burns the full barrier timeout before proceeding anyway. Measured on a regtest e2e venue at the default: 367 blocks in six hours against 2013 in under two once lowered, with 160 deferrals that were waiting on a condition that could not arrive. Set it to a small fraction of the block interval on any venue that mines quickly. 120
HUB_SYNC_ATTEST_RESPONSE_GRACE_S Grace margin on the attestation-response mirror barrier. Above the response-mirror activation height a finalized attestation response reaches the indexer through the hub mirror rather than as its own transaction, and a node that has not received the row would fire the contract callback at a different block from its peers, which is a fork rather than a lag. So this barrier has no chain-only escape: the block waits until the mirror’s stream watermark reaches the block’s protocol time plus this margin. The margin only has to cover ordinary stream lag, because the real forward margin travels inside the signed row. Honoured on regtest only; elsewhere a differing value is ignored with a startup warning and the frozen protocol value wins, because two nodes resolving it differently would settle blocks differently. 120
XCHAIN_COINPAY_EXPIRATION_S COINPay obligation expiration window, in seconds. Honoured on regtest only; elsewhere a differing value is ignored with a startup warning and the frozen protocol value wins, because the window is a consensus input and two nodes expiring an obligation at different times would settle differently. Exists so a fast regtest venue can expire an obligation inside a few blocks instead of jumping the node clock two hours past the deadline: a block mined under a jumped clock is stamped in the future, and the anchor-attest barrier above then waits real time out for the hub watermark to reach it. Must be a positive integer; an invalid value fails startup. The xchain-node regtest compose forwards it to the indexer by name, so set it once on the node. 7200 (2 hours, the frozen COINPAY_EXPIRATION constant)
DOGE_INDEXER_URL DOGE indexer JSON-RPC URL the BTC indexer uses to re-prove that a mirrored anchor reward’s DOGE anchor was actually mined (getanchorconfirmations), before crediting it. DOGE_INDEXER_API_URL takes precedence when both are set. Required on a BTC indexer once the anchor-reward derive flag-day is armed: unset, no reward can be proven and the block defers. (unset)
DOGE_INDEXER_API_KEY API key sent as x-api-key with that read (getanchorconfirmations is a federation-read method on the DOGE indexer). (unset)
ANCHOR_PROOF_TIMEOUT_MS Per-request timeout for the DOGE anchor proof read, and for the ROLLCALL signer read below. A timeout is treated as “cannot tell”, which defers the block; it is never read as “not mined”. 15000
<COIN>_INDEXER_URL Origin-chain indexer JSON-RPC URL the bridge settle pass uses to fetch the escrow checkpoint proof for an incoming transfer (getbridgeescrowproof), one per origin coin: BTC_INDEXER_URL on a DOGE or LTC indexer that receives XCHAIN, and so on. <COIN>_INDEXER_API_URL takes precedence when both are set, then the config key of the same name. Unset, no proof can be fetched and the settle leg stalls on the proof barrier; it is never applied unproven. (unset)
<COIN>_INDEXER_API_KEY API key sent as x-api-key with that proof read. Falls back to the config key of the same name. (unset)
BRIDGE_PROOF_TIMEOUT_MS Per-request timeout for the escrow proof read. A timeout is treated as “cannot tell”, which stalls the settle leg on the proof barrier; it is never read as “no proof”. 15000
HUB_SYNC_BARRIER_HOLD_CEILING_S How long the block loop may sit deferring at a hub-mirror-completeness barrier before the mirror forces itself to resync: tearing down and reconnecting its hub-DB WebSocket (or, in poll mode, re-kicking the bootstrap directly). A mirror’s stream watermark only advances while its bootstrap drain is flagged complete, and nothing else re-arms that flag once a drain has stalled, so a socket can sit open and heartbeating while the mirror certifies nothing, indefinitely; this bounds that wait by a re-drive instead of leaving it unbounded. Purely operational: it opens no barrier and commits no block early, a genuinely-behind mirror keeps deferring after the resync, and the forced resync is rate-limited to once per ceiling window. Seconds; 0 disables it (no forced resync). 900 (15 min)
HUB_SYNC_WATERMARK_STALL_S How long the hub mirror’s stream watermark may stay frozen while the hub’s own heartbeat tip runs ahead of it before the mirror forces a fresh subscribe-then-bootstrap. This is the mirror’s own bound, distinct from HUB_SYNC_BARRIER_HOLD_CEILING_S, which the block loop drives and only while a block is deferring: heartbeats keep arriving during such a stall, so the transport watchdog stays satisfied while the mirror certifies nothing. Suppressed where a frozen watermark is correct: poll mode, an outstanding hub schema-version mismatch, and a mirror that has not yet certified a first watermark. Operational only: it opens no barrier and commits no block early. Seconds; 0 disables the detector. 180
HUB_SYNC_WATERMARK_STALL_EXIT_S How long after that forced resync the watermark still has to stay frozen before the process logs a named fatal and exits non-zero so its supervisor restarts it (the indexer wires the exit; the explorer’s vendored copy logs and re-drives). Sized above a full re-bootstrap drain, so an ordinary slow drain finishes and moves the watermark inside the window; any real advance cancels it. Seconds; 0 keeps the forced resync but never exits. 300

Bridge proof wiring is directional and required for every two-stack deployment. Every destination indexer crediting a bridged transfer must have the origin chain’s indexer API URL configured as <COIN>_INDEXER_URL or <COIN>_INDEXER_API_URL. Configure each direction independently: for example, a DOGE indexer crediting a transfer from BTC needs the BTC indexer URL, while a BTC indexer crediting a transfer from DOGE needs the DOGE indexer URL. Without either URL, that destination holds silently at the bridge proof barrier until the default 900-second (15-minute) hold ceiling; reaching the ceiling can re-drive the wait but never credits an unproven transfer. This is separate from the DOGE-specific ROLLCALL read below, even when both reads use the same DOGE URL.

The same DOGE wiring is what ROLLCALL runs on, and it becomes required a second time. From ROLLCALL_ACTIVATION onward, every BTC indexer closes each roll-call epoch by asking its DOGE indexer for the epoch’s signers (getrollcallsigners, a federation-read method served off the committed view). It reuses DOGE_INDEXER_API_URL → DOGE_INDEXER_URL → config, the DOGE_INDEXER_API_KEY header, and ANCHOR_PROOF_TIMEOUT_MS; there is no separate env knob for it.

Variable Description Default
XC_ROLLCALL_GATES_REGTEST_ACTIVATION Regtest only. Arms ROLLCALL v1 on this private venue: from the armed epoch height on, roll calls must carry the publisher’s consensus-gate list, the epoch close records each verified signer’s list in rollcall_gates, and the attestation capability set drops a validator whose recorded list lacks a rule active at the request block. Same grammar as XC_ROLLCALL_REGTEST_ACTIVATION; read once at startup; set identically on every hub and BTC indexer in the venue. mainnet and testnet are fixed in source. (unset: inert)
XC_MIRROR_ADMISSION_ACTIVATION Regtest only. Arms the per-coin regtest entries of MIRROR_ADMISSION_ACTIVATION and MIRROR_ADMISSION_CONSUMER_ACTIVATION (the mirror-admission heights) and the regtest entry of ANCHOR_ATTEST_BARRIER_ACTIVATION in the indexer’s activation registry (src/protocol_changes/shared_rows.js), one variable for the whole barrier family. Same grammar and inert default as XC_ROLLCALL_REGTEST_ACTIVATION; the armed form arms at height 0. The indexer’s gate modules snapshot these activation maps when they are loaded, so set the variable before startup and restart the indexer after changing it. Set it identically on every hub, indexer, sync and explorer process in the venue. mainnet and testnet are fixed in source. (unset: inert)
XC_ANCHOR_FOLD_REGTEST_ACTIVATION Regtest only. Arms the regtest entries of both ANCHOR_FOLD_ACTIVATION and ARCHIVE_SECTION_VERDICT_STATE_HASH_ACTIVATION in the indexer’s activation registry, because the section-scoped verdict is armed only with the fold. armed, genesis or on arms at DOGE height 0; a non-negative integer arms at that height. Unset or off leaves both gates inert; anything else is refused with a warning and leaves them inert. (unset: inert)
XC_ROLLCALL_REGTEST_ACTIVATION Regtest only. Arms ROLLCALL on this private venue. armed (or genesis/on/true/yes) activates at BTC height 0; a bare non-negative integer activates at that height, for a venue whose epochs should begin above an already-indexed prefix; off/inert/false and anything unrecognised leave it inert, and an unrecognised value is logged. Read once at startup, so a change needs a restart. mainnet and testnet are fixed in source and cannot be moved from the environment. (unset: inert)

Regtest ships inert on purpose: arming a network commits every BTC indexer on it to a wired DOGE peer, so a hardcoded height wedged every single-coin BTC venue at its first close. Set this on every BTC indexer and hub in a two-chain acceptance venue, alongside DOGE_INDEXER_API_URL. A venue that arms its hubs and forgets its indexer shows up as a consensus-rules digest mismatch, because ROLLCALL_ACTIVATION is one of the shared gates that digest covers.

bin/consensus-identity.js’s selectedPinBlock() also reads both names, from the armed_regtest_venue.env block of bin/pins/at1-consensus-identity.json, to pick between the armed and bare-checkout consensus-identity pin for comparison; that block must be kept in step with whatever the venue actually arms.

A BTC indexer with no DOGE wiring defers every block from the first epoch close onward (epoch height + 144 + 36), with stallReason = 'rollcall_proof_unavailable', rather than judging absences it cannot prove. The same deferral covers an unreachable or malformed answer, a DOGE tip that has not yet buried the window cut by ROLLCALL_DOGE_MATURITY, and a DOGE indexer whose vendored action-manifest hash differs from this indexer’s own. That last case is what turns a DOGE indexer running a decoder too old to know ROLLCALL from a silent evict-the-federation bug into a loud, safe stall: wire the DOGE indexers and deploy their decoder before ROLLCALL_ACTIVATION is reached. A validator with no Dogecoin indexer of its own points DOGE_INDEXER_API_URL at the public explorer instead: https://explorer.xchain.io/TDOGE/api/ on testnet, https://explorer.xchain.io/DOGE/api/ on mainnet, with no DOGE_INDEXER_API_KEY (the explorer answers these reads to anyone, like the rest of its API). That answer comes from the explorer’s own replicated indexer database, so a replica that has fallen behind makes the epoch close wait longer rather than judge the roll call on stale data.

Capability snapshot proof trust pin

The capability snapshot proof is unarmed until the train cut; when armed, these variables pin its validator trust set.

Variable Description Default
CHECKPOINT_VALIDATORS_BTC_<NETWORK> Static trust pin used by an LTC or DOGE indexer to judge hub-mirrored capability_snapshots rows, never derived from those mirrored rows. Replace <NETWORK> with the upper-cased network name, as in CHECKPOINT_VALIDATORS_BTC_REGTEST. The value is a non-empty JSON array of {pubkey, weight, source} entries: pubkey is a 64-hex Ed25519 public key, weight and source are strings, and the array must have positive total stake. With no pin, testnet and mainnet hold the row while regtest takes first use. (unset)
CHECKPOINT_VALIDATORS_BTC_<NETWORK>_NEXT Second trust pin in the same format, used for rows whose snapshot_block is at or above _FROM. This lets an operator re-pin after validator rotation without re-judging rows already applied. If _NEXT is set while _FROM is unset or malformed, every row is held instead of being judged under the old pin. (unset)
CHECKPOINT_VALIDATORS_BTC_<NETWORK>_FROM Rotation cutoff, written as decimal digits that give a safe integer. _FROM alone is ignored. (unset)

Hub push queue and mirror

Variable Description Default
HUB_CONFIG_POLL_INTERVAL_MS Interval between hub config refresh polls 60000
HUB_DB_SYNC_POLL_INTERVAL Interval between hub-mirror table sync polls (used when HUB_DB_SYNC_ENABLED=true) 30000
HUB_DB_SYNC_HTTP_DEADLINE Total wall-clock budget for one hub-mirror snapshot GET. The request’s own timeout option is an idle-socket timer that resets on every byte received, so a hub drip-feeding a body would otherwise hold the request, and the whole mirror bootstrap, open indefinitely; set to four times that idle timer so a large snapshot page has room to stream and only a wedged request reaches the ceiling. 120000
HUB_SYNC_WATERMARK_INTERVAL_MS Interval at which the hub-mirror sync persists its progress watermark 10000
HUB_SYNC_BATCH_APPLY Set to false to disable batched multi-row upserts when applying price_snapshots rows during a hub-mirror bootstrap drain, falling back to applying rows one at a time. Throughput only: no barrier, floor, or mirrored row depends on it. true
HUB_SYNC_BATCH_APPLY_ROWS Number of buffered price_snapshots rows a hub-mirror bootstrap drain collects before flushing them as one multi-row upsert statement. Values below 2 fall back to the default. 2500
HUB_SYNC_BOOTSTRAP_PROGRESS_MS Minimum interval between the “bootstrapping <table>: N row(s) fetched…” progress lines a hub-mirror table drain logs on startup, so a cold start shows the drain moving rather than only its final result. 0 silences the periodic line entirely (the drain still logs when it starts and finishes). 15000 (15s)
HUB_PUSH_RETRY_INTERVAL_MS How often the push-queue poller wakes to drain due rows 30000
HUB_PUSH_RETRY_BASE_MS Base backoff for a failed push. The wait grows as base × 2^(attempts-1), capped at HUB_PUSH_RETRY_MAX_MS. 30000
HUB_PUSH_RETRY_MAX_MS Backoff ceiling for push retries 600000 (10 min)
HUB_PUSH_MAX_ATTEMPTS Attempts before a push row is abandoned (about 30 minutes at the default backoff) 10
HUB_PUSH_FAILED_RETENTION_SECONDS How long an abandoned push row is kept before the sweep drops it. Without the sweep a long hub outage grows the queue table with no ceiling. Set to 0 to keep terminal rows forever. 604800 (7 days)
HUB_PUSH_PRUNE_INTERVAL_MS How often the queue prunes abandoned rows older than the retention window 3600000 (1 hour)

Fee quote and pre-flight

Variable Description Default
INDEXER_FEEQUOTE_MAX_PENDING Maximum concurrent in-flight feequote evaluations before new ones are rejected 8
INDEXER_FEEQUOTE_TIMEOUT_MS Per-request timeout for a feequote evaluation, measured from the moment the dry-run holds the transaction mutex 10000
INDEXER_FEEQUOTE_ACQUIRE_TIMEOUT_MS How long a feequote / preflight dry-run waits for the block-processing transaction mutex before answering busy: true, retryable: true. Keep it below the explorer’s INDEXER_API_TIMEOUT_MS, or the busy answer loses the race to a proxy timeout and the caller sees a 502 instead 2000
INDEXER_PREFLIGHT_MEMO_MAX Maximum memo length accepted by the read-only preflight endpoint 256

State-tree metrics

Variable Description Default
STATE_TREE_METRIC_INTERVAL_MS Interval for the state-tree orphan-statistics sweep. Set 0 to disable. 14400000 (4 h)
STATE_TREE_METRIC_MAX_NODES Node ceiling for a single metric pass, bounding the sweep’s cost on a large tree 2000000
INDEXER_SMT_TOUCH_AUDIT Set to 1 to audit, per block, the set of keys the state-commitment pass actually touched against the set the ledger rows say it should have, reporting the difference in both directions with the exact keys. That evidence cannot be recovered once the block is committed, which is why it is a flag rather than a post-hoc probe. Diagnostic only; off in normal operation. (unset, audit off)
INDEXER_TOUCH_GUARD Behaviour when the balances touched-set guard fails, meaning the ledger moved keys the commitment did not apply and balances_root would be committed incomplete. The default throws and stops the block. Set to warn to log and commit anyway; the node then diverges from any node that full-rebuilds, so this is a deliberate, temporary escape hatch rather than an operational setting. (unset, fails closed)

Genesis

Genesis is pinned per network in the coin registry and the bundled dumps ship inside the Docker image, so a stock install needs none of these. They exist for regenerating or relocating the genesis inputs, and for drilling the genesis path on regtest. See XCHAIN Genesis.

Variable Description Default
GENESIS_LEDGER_PATH Path to the canonical genesis ledger CSV data/genesis/<coin>-ledger.csv
GENESIS_DUMP_PATH Path to the pre-derived genesis state dump. When present, the dump-import path runs and is verified against XCHAIN_GENESIS_DUMP_HASH (sha256 of the uncompressed content) plus a recheck of the genesis block hashes; absent, the canonical CSV derivation runs instead. data/genesis/<coin>-<network>-genesis-dump.ndjson.gz
GENESIS_BLOCK_TIMEOUT_MS Watchdog for the genesis block on the CSV-derivation path, which is the slow one 14400000 (4 h)
GENESIS_DUMP_TIMEOUT_MS Watchdog for the genesis block on the dump-import path. Kept tight (BTC measures around 15 s) so a wedged import is caught fast. 600000 (10 min)
XCHAIN_GENESIS_BLOCK Genesis height bin/generate-genesis-dump.js seeds its scratch decoder and indexer at when it regenerates a dump. Read only by that tool, never by the service. 100
GENESIS_AIRDROP_PATHS Regtest only. Comma-separated airdrop snapshot files to replay at genesis (none)
GENESIS_AIRDROP_HASHES Regtest only. Comma-separated sha256 digests pinning each GENESIS_AIRDROP_PATHS entry, index-aligned (an empty entry leaves that bucket unpinned) (none)
GENESIS_AIRDROP_AMOUNTS Regtest only. Comma-separated per-file airdrop amounts, index-aligned with GENESIS_AIRDROP_PATHS (none)
GENESIS_AIRDROP_SNAPSHOT_BLOCK Regtest only. Block height the airdrop snapshot was taken at (none)
GENESIS_AIRDROP_SET_HASH Regtest only. sha256 over the canonical NAME:hash:amount line per bucket, newline-joined in name byte-order. Pins the airdrop SET (which buckets exist, what each is funded with, and the order their actions are derived in), which the per-file hashes above do not. Verified before the first credit; a mismatch halts the node, and a mainnet bucket set without this pin is refused. (none)

On mainnet and testnet the five airdrop variables are ignored. The armed bucket set is part of the pinned coin bundle (src/coins/<COIN>.js, genesis.airdropPaths / airdropHashes / airdropAmounts / airdropSnapshotBlock / airdropSetHash), because it decides how much XCHAIN each snapshot holder mints and which synthetic transaction hash carries the credit. Arming the leg is an edit to that bundle plus a xchain-hub/bin/sync-coins.sh re-vendoring wave, never a per-node export. | CROSS_CHAIN_ROYALTY_REGTEST_TIME | Regtest only. Override the cross-chain royalty activation time so the OFF/deny path stays drillable on a single-node stack. Deliberately regtest-scoped: two nodes with different values would disagree on consensus. | 0 (activate at genesis) | | CONTROLLER_CUSTODY_GUARD_REGTEST_TIME | Regtest only. Override the controller custody guard activation time so the pre-activation bypass and the guarded path stay drillable on a single-node stack. Deliberately regtest-scoped: two nodes with different values would disagree on consensus. | 0 (activate at genesis) | | EXACT_INTEGER_WIRE_FIELDS_REGTEST_TIME | Regtest only. Arm the exact-integer wire fields activation at this time so a regtest venue can drive the strict wire parsing; a set non-negative integer arms it at that time, unset or empty arms it from genesis (0), and off keeps the venue inert. Deliberately regtest-scoped: testnet and mainnet read their pinned activation times. | unset (armed from genesis) |

A7 replay-equivalence harness

Read only by bin/verify-batch-limits-replay-equivalence.js (the below-the-flag replay-equivalence drill); never by the indexer service itself.

Variable Description Example
A7_SIDE_ROOT Harness only. Repo root the forked side-process replays from /path/to/xchain-indexer
A7_SIDE_GATE Harness only. Side-process gate mode: natural replays with the registered activation instant; off moves the instant forward so the flag reads disabled on the replayed range off
TEST_DB_HOST Harness only. Test database hostname; falls back to INDEXER_DB_HOST, then 127.0.0.1 127.0.0.1
TEST_DB_PORT Harness only. Test database port; falls back to INDEXER_DB_PORT, then 3306 3306
TEST_DB_USER Harness only. Test database username; falls back to INDEXER_DB_USER, then root root
TEST_DB_PASS Harness only. Test database password; falls back to INDEXER_DB_PASS, then empty (none)
TEST_DB_NS Harness only. Namespace prefix for the harness’s scratch databases (<ns>_dec, <ns>_old, <ns>_off, <ns>_on) xchain_test_a7
TEST_DECODER_DB Harness only. Decoder-side scratch database name the replay reads; set by the harness itself for child processes xchain_test_a7_dec

A6 replay-equivalence harness (cost weighting)

Read only by bin/verify-batch-cost-weighting-replay-equivalence.js (the below-the-flag replay-equivalence drill for the weighted BATCH budget); never by the indexer service itself. It shares the TEST_DB_* variables documented for the A7 harness above.

Variable Description Example
A6_SIDE_ROOT Harness only. Repo root the forked side-process replays from /path/to/xchain-indexer
A6_SIDE_GATE Harness only. Side-process gate mode: natural replays with the registered activation instant, off moves the instant to the unarmed sentinel so the flag reads disabled across the replayed range, and on forces it active from genesis to produce the negative control off

LAP replay-equivalence harness (ledger amount precision)

Read only by bin/verify-ledger-amount-precision-replay-equivalence.js (the below-the-flag replay-equivalence drill for the ledger amount-precision flag); never by the indexer service itself. It shares the TEST_DB_* variables documented for the A7 harness above (its namespace default is xchain_test_lap).

Variable Description Example
LAP_SIDE_ROOT Harness only. Repo root the forked side-process replays from /path/to/xchain-indexer
LAP_SIDE_GATE Harness only. Side-process gate mode: legacy replays the pre-flag code (no flag module to move, its absence is reported as data), off moves the registered heights to the unarmed sentinel so the flag reads disabled across the replayed range, and on arms it from genesis off
LAP_FIRST_BLOCK Harness only. First block of the replayed range, set by the parent for its side-processes 100
LAP_LAST_BLOCK Harness only. Last block of the replayed range, set by the parent for its side-processes 250

Genesis-arm replay witness

Read only by bin/verify-genesis-arm-replay-equivalence.js (the from-genesis OLD-vs-ON replay witness for the mainnet genesis arm, which replays a mainnet corpus through the pre-arm tree and the armed tree and compares the consensus hash chain); never by the indexer service itself. It shares the TEST_DB_* variables documented for the A7 harness above (its namespace default is ga_witness_replay_<coin>), and it sets GENESIS_DUMP_PATH to a file that does not exist for its side-processes so genesis is derived through the action pipeline rather than imported.

Variable Description Example
GA_SIDE_ROOT Harness only. Materialized tree the forked side-process replays from (the HEAD archive, or the HEAD archive with the arm commit reverted) /tmp/xchain-ga-witness-btc/indexer-old
GA_SIDE_KEY Harness only. Side label the side-process reports under and prefixes its progress lines with: OLD or ON ON

Mirror-admission replay witness

Read only by bin/verify-mirror-admission-replay-equivalence.js (the below-the-flag replay witness for the mirror-admission barrier family, which replays one two-schema corpus with the lever OFF, armed at the boundary height and armed at genesis, and compares the consensus hash chain); never by the indexer service itself. The corpus consists of the schema named by the required --decoder-db <schema> option and a hub-mirror schema named by the required --mirror-db <schema> option. The mirror schema must be on the same database server; every replay side copies its hub-mirror rows before processing blocks, and the harness refuses a run without it so a decoder-only corpus cannot produce a vacuous result. The harness takes its database coordinates from --db-host, --db-port and --db-user or from the TEST_DB_* variables documented for the A7 harness above, and it never falls back to .env. The password comes from the variable NAMED by --db-pass-env (for example MA_DB_PASS), or from TEST_DB_PASS when that option is absent, so it never reaches a process list. For each side-process the parent sets INDEXER_COIN, INDEXER_NETWORK, TEST_DECODER_DB, TEST_INDEXER_DB and XC_MIRROR_ADMISSION_ACTIVATION (unset, the boundary height, or 0), and the side-process reads the lever back to prove the era it actually resolved.

Variable Description Example
MA_SIDE_KEY Harness only. Side label the side-process reports its hash chain under, set by the parent for its side-processes: off, boundary or on boundary

List-owner replay witness

Read only by bin/verify-list-owner-replay-equivalence.js (the below-the-flag replay witness for LIST_OWNER_ACTIVATION, which replays one testnet corpus through a LEGACY tree with the general list-owner check removed and the OFF tree with its natural inert gate, and compares the resolved four-hash chain at every block; mainnet and regtest are refused because their gate is active from height zero); never by the indexer service itself. Database credentials are loaded by dotenv from the project .env and read through src/config.js, never from argv. For each side-process the parent sets INDEXER_COIN, INDEXER_NETWORK, TEST_DECODER_DB, TEST_INDEXER_DB and the TEST_DB_* coordinates documented for the A7 harness above.

Variable Description Example
LO_SIDE_ROOT Harness only. Materialized tree the forked side-process replays from (the LEGACY tree or the OFF tree under the harness workdir) /tmp/xchain-lo-witness-btc/off
LO_SIDE_KEY Harness only. Side label the side-process reports its hash chain under, set by the parent for its side-processes: legacy or off off

BATCH cost-measurement harness

Read only by bin/measure-batch-execute-cost.js, which measures the block-loop cost of EXECUTE and DEPLOY sub-commands against an ordinary sub-command baseline; never by the indexer service itself. The harness also reads the TEST_DB_* variables documented above.

Variable Description Example
XCHAIN_DECODER_SQL_PATH Harness only. Path to the decoder’s SQL schema directory, used to build the scratch decoder database the measured blocks are read from. The harness refuses to run when it is unset rather than measuring against a schema it guessed at /path/to/xchain-decoder/src/sql

Diagnostic Scripts (bin/)

Read-only operator tools; neither broadcasts nor writes anything and neither is read by the running indexer process itself.

Variable Description Default
XCHAIN_INDEXER_DIR Sibling-checkout override bin/lib/carrier_logic_pin.js’s siblingDir() resolves for cross-repo carrier-logic comparison; the repo_guards twin test points it at a second checkout with XCHAIN_REQUIRE_SIBLINGS=1. Never read by the running indexer process. ../xchain-indexer
XCHAIN_SYNC_DIR Sibling-checkout override for the xchain-sync tree the same siblingDir() resolves when the pin tool compares against sync’s copy; read by literal name so the coverage gate can see it. Never read by the running indexer process. ../xchain-sync
XCHAIN_HUB_DIR Sibling-checkout override for the xchain-hub tree the same siblingDir() resolves when the pin tool compares against the hub’s copy; read by literal name so the coverage gate can see it. Never read by the running indexer process. ../xchain-hub
PROM_CI_BASE_SHA Diff base commit for bin/ci_fast_select.js’s fast CI test selection: the CI venue’s gate exports the target ref’s value before the push, and the selector diffs HEAD against it to pick which test groups to run. Falls back to git merge-base HEAD origin/develop when unset or when the value is not a resolvable commit. Never read by the running indexer process. (unset: falls back to the merge-base with origin/develop)
CI_COMPANIONS Companion refs for a cross-repo landing, as space- or comma-separated <repo>=<ref> tokens (*=<ref> names every sibling). bin/check-hub-db-sync-explorer-twins.js compares changed canonical src/hub/hub_db_sync files against the xchain-explorer token’s committed ref instead of the explorer working tree, so the indexer can land first against a committed explorer companion branch; bin/sync-hub-mirror-client.sh --landing-order <branch> prints the full order. A ref that does not resolve in the explorer checkout fails the check. Never read by the running indexer process. (unset: compares against the explorer working tree)
CI_SIBLING_PINS The sibling SHAs the CI venue’s gate exports for the checkouts it shipped, in the same <repo>=<ref> form; the twin check reads the xchain-explorer pin ahead of CI_COMPANIONS, so on the venue the explorer copy is compared at the exact commit the dispatcher shipped. Never read by the running indexer process. (unset: falls back to CI_COMPANIONS)
CI_SHARDS Process count bin/ci_shard.js splits the ci chain’s main mocha step across in the siblings STRICT tier; 1 runs the step unsharded as before. A value that is not a positive integer falls back to the default. Never read by the running indexer process. half the CPU cores, at most 4
PATH Read by bin/ci_shard.js only to put the package’s node_modules/.bin in front of it for the chain steps it runs, as npm run does. Never read by the running indexer process. the caller’s PATH

Hub DB Price Source

Native-coin fee validation and FIAT settlement read the oracle tables (price_snapshots, oracle_prices) from the hub. There are two valid topologies:

  • Distributed (production default): the indexer runs on a different host from the hub. Set HUB_DB_HOST / HUB_DB_NAME (plus HUB_DB_PORT / HUB_DB_USER / HUB_DB_PASS) so price reads hit the hub’s data, optionally mirrored locally via HUB_DB_SYNC_ENABLED=true.
  • Single-host: the indexer’s own database already holds the synced hub copy, so no separate hub DB connection is needed and the oracle tables are read locally.

That price-source choice does not cover the finalized ATTEST response mirror controlled by ATTEST_RESPONSE_MIRROR_ACTIVATION. The attestation_responses table is an off-chain consensus input that settles request fees, and AnchorRecovery cannot reconstruct it. BTC testnet refuses to boot without a hub database source. BTC regtest warns and continues without one, although regtest deployments exercising the response mirror should configure the hub database source. The gate remains unpinned on BTC mainnet. INDEXER_ALLOW_LOCAL_PRICE_SOURCE=true acknowledges only the local oracle-price topology and cannot bypass the BTC testnet response-mirror requirement.

The two are indistinguishable from config alone: a node with no hub DB looks the same whether that is intentional (single-host) or an operator forgot HUB_DB_HOST / HUB_DB_NAME on a distributed node. In the latter case the indexer would silently value native-coin fees against stale or empty local price data, which on mainnet can diverge from the canonical fleet and fork the ledger.

To make the intent explicit, a mainnet indexer fails closed at startup when no hub DB is configured, unless INDEXER_ALLOW_LOCAL_PRICE_SOURCE=true is set to confirm an intentional single-host node. On testnet and regtest the local-price acknowledgement is ignored. The armed response-mirror guard refuses BTC testnet startup, while BTC regtest logs its response-mirror warning and continues.

Variable Description Default
INDEXER_ALLOW_LOCAL_PRICE_SOURCE Acknowledge an intentional single-host setup (read oracle tables from the local indexer DB). Required to boot a mainnet node that has no HUB_DB_HOST / HUB_DB_NAME; ignored on testnet/regtest. This does not bypass the armed BTC response-mirror hub database requirement above. unset (mainnet fails closed)

Coin-Specific Configuration

Each supported blockchain has a configuration file at src/coins/<COIN>.js (BTC.js, LTC.js, DOGE.js) that defines:

Parameter Description Example (BTC)
ISSUANCE_FEE_TOKEN XCHAIN fee for token issuance 1.00000000
ISSUANCE_FEE_SUBTOKEN XCHAIN fee for sub-token issuance 0.50000000
EXPIRATION_FEE_DEFAULT_DAYS Default listing duration 90 (3 months)
EXPIRATION_FEE_FREE_DAYS Free listing duration 182 (6 months)
EXPIRATION_FEE_PER_DAY XCHAIN fee per day beyond free period 0.00547945
ADDRESS.BURN Burn address (per network) 1Muhahahahhahahahahahhahahauxh9QX
ADDRESS.GAS Gas token issuer address (per network) 1BTNSGASK5En7rFurDJ79LQ8CVYo2ecLC8
ADDRESS.DONATE1 Protocol development donation address 1BTNSGASK5En7rFurDJ79LQ8CVYo2ecLC8
ADDRESS.DONATE2 Community development donation address 1BTNSGASK5En7rFurDJ79LQ8CVYo2ecLC8
ADDRESS.FEE_DESTINATION Native-coin fee collection address (per network), pinned in the bundled coin registry. Overridable at runtime via the XCHAIN_FEE_DESTINATION_<COIN>_<NETWORK> env var (e.g. XCHAIN_FEE_DESTINATION_BTC_REGTEST) on testnet/regtest only; a mainnet override is ignored with a warning, because fee acceptance is consensus and must not depend on operator environment. (coin registry)
ADDRESS.REWARD Validator reward pool: pre-funded, manually topped up, drained by COLLECT (BTC only; XCHAIN/COLLECT do not exist on LTC/DOGE, where the slot is unused) (set pre-launch)

Unified Gas Fee Schedule

After the activation block, fees for VM and staking actions are calculated using a gas-based schedule rather than the legacy flat fee constants. The following parameters are defined in each coin config file (src/coins/<COIN>.js) and are only applied to blocks at or after the activation height:

Parameter Description Example (BTC)
GAS_PRICE Base XCHAIN cost per unit of gas 0.00001
GAS_SCHEDULE Object mapping fee keys to their gas cost in gas units. The full table is in src/coins/<COIN>.js; see Gas for what each key prices { ISSUE: 100000, SWEEP_BASE: 5000, VM_DEPLOY_BASE: 100000, VM_EXECUTE_BASE: 1000, VM_STATE_WRITE: 200, ... }
UNIFIED_EXPIRATION_FEE_FREE_DAYS Free listing duration under the unified schedule (replaces EXPIRATION_FEE_FREE_DAYS post-activation) 90 (3 months)
FEE_PAYMENT_MODE Reserved key indicating intended fee denomination per chain ('xchain' on BTC, 'native' on LTC/DOGE). Not currently read at runtime: see note below. 'xchain' (BTC)

Note on FEE_PAYMENT_MODE: This key is currently informational only and is not read by the fee-processing code. Fee payment mode is detected implicitly at runtime by detectFeePaymentMode() in src/utility.js, which derives the mode from the transaction itself: if a native-coin fee output to the configured fee destination is present it returns 'native'; if absent it returns 'xchain' on BTC (XCHAIN balance deduction is allowed as a fallback) and 'rejected' on LTC/DOGE (native coin is the only accepted fee on those chains). The FEE_PAYMENT_MODE config value is reserved for a future change that makes this detection explicit/config-driven; until then its value must mirror the implicit per-chain behavior to avoid surprising a later refactor.

The legacy flat fee constants (ISSUANCE_FEE_TOKEN, ISSUANCE_FEE_SUBTOKEN, EXPIRATION_FEE_PER_DAY, EXPIRATION_FEE_FREE_DAYS) remain in the coin config files and continue to apply for blocks before the activation height.

Indexer Constants

These values are defined in src/config.js and apply to all chains:

Token Rules

Parameter Value Description
GAS XCHAIN Gas token ticker name
NATIVE_TICK_DECIMALS 8 Decimal places for native coin amounts
MIN_TICK_LENGTH 1 Minimum ticker name length
MAX_TICK_LENGTH 250 Maximum ticker name length
TICK_CHARACTERS a-zA-Z0-9~!@#$%^&*()_+-={}[]:<>.? Allowed characters in ticker names
RESERVED_TICKS ['BTC','LTC','DOGE','XCHAIN'] Ticker names reserved by the protocol
MIN_TOKEN_DECIMALS 0 Minimum token decimal places
MAX_TOKEN_DECIMALS 18 Maximum token decimal places
MIN_TOKEN_SUPPLY 0.000000000000000001 Minimum token supply (10^-18)
MAX_TOKEN_SUPPLY 1000000000000000000000 Maximum token supply (10^21)

COINPay

Parameter Value Description
COIN_DECIMALS 8 Native coin decimal places (BTC/LTC/DOGE all use 8)
COINPAY_EXPIRATION 7200 COINPay obligation expiration in seconds (2 hours)

Field Limits

Parameter Value Description
MAX_TOKEN_DESCRIPTION 250 Maximum description length in characters
MAX_MEMO_LENGTH 250 Maximum memo length in characters
MAX_FILE_NAME_LENGTH 250 Maximum file name length
MAX_FILE_TYPE_LENGTH 255 Maximum MIME type length (per RFC 4288)
MAX_FILE_TITLE_LENGTH 250 Maximum file title length
MAX_BROADCAST_MESSAGE_LENGTH 250 Maximum broadcast message length
MAX_BROADCAST_VALUE_LENGTH 25 Maximum broadcast value length
MAX_MESSAGE_LENGTH 1048576 Maximum message content (1 MB)
MAX_MESSAGE_KEY_LENGTH 1048576 Maximum encryption key length (1 MB)
MAX_DISPENSES 1000 Maximum dispenses per dispenser fill (a refill resets the count)
MAX_REFILLS 5 Maximum refills per dispenser (the 6th is rejected), so 6 fills x MAX_DISPENSES lifetime

Timing and Delays

Parameter Value Description
BLOCK_CHECK_INTERVAL 5000 Milliseconds between block polling cycles
BLOCK_PROCESS_TIMEOUT 300000 Maximum milliseconds to process a single block
DISPENSER_LIST_DELAY 3600 Seconds before dispenser list updates take effect
DISPENSER_CLOSE_DELAY 3600 Seconds before dispenser close takes effect

Protocol Constants

Parameter Value Description
MESSAGE_ENCRYPTION_METHODS [1, 2, 3] 1 = ECIES, 2 = ECDH, 3 = AES
SLEEP_IMMEDIATE_METHODS [-1, 0] -1 = sleep indefinitely, 0 = resume immediately

Copyright © 2025–2026 Dankest, LLC

Based on XChain Platform by Dankest, LLC – https://dankest.llc

Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0-or-later) with a commercial license available for proprietary use.

You may use, modify, and distribute this material under the terms of the License. See LICENSE and NOTICE for full terms. See the licensing overview.

Edit this page on GitHub ↗