跨越 Veldra 边界的每一个 reason code、每一个配置项、每一个事件字段。一页尽收。源自 reservegrid-common 中的 Rust 权威类型。
每一次拒绝、每一次降级、每一次内部故障都带有一个稳定的 snake_case 标识符。它们是验证器、网关、传输、share 路径与 Invariant Shield 各自 ReasonCode 的并集。在 minor 版本之间保持稳定;新的 code 只在增量式发布中新增。
启动时校验。非法值会以 config_invalid 触发 fail-closed。Phase 2 的 mempool 配置块需显式启用;默认部署只运行 Phase 1。
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| protocol_version | u16 | 2 | Highest accepted TemplatePropose protocol_version. |
| required_prevhash_len | usize | 64 | Required prev_hash length in hex characters. |
| min_total_fees | u64 | 0 | Minimum sum of fees in a template (sats). |
| max_tx_count | u32 | 10000 | Maximum non-coinbase transactions per template. |
| low_mempool_tx | u64 | 50 | Below this mempool tx count the low fee tier applies. |
| high_mempool_tx | u64 | 500 | At or above this mempool tx count the high fee tier applies. |
| min_avg_fee_lo | u64 | 0 | Minimum average fee per tx, low tier (sats). |
| min_avg_fee_mid | u64 | 0 | Minimum average fee per tx, mid tier (sats). |
| min_avg_fee_hi | u64 | 0 | Minimum average fee per tx, high tier (sats). |
| reject_empty_templates | bool | true | Reject templates with zero non-coinbase transactions. |
| reject_coinbase_zero | bool | false | Reject templates whose coinbase value is zero. |
| unknown_mempool_as_high | bool | true | Treat an unknown mempool size as the high fee tier. |
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| max_weight_ratio | f64 | 0.999 | Maximum template weight as a fraction of the 4M weight cap. |
| enforce_weight_ratio | bool | false | Reject, not just warn, when the weight ratio is exceeded. |
| max_template_age_ms | u64? | unset | Reject templates older than this; unset disables the check. |
| enforce_template_age | bool | false | Reject, not just warn, when a template exceeds max_template_age_ms. |
| warn_sigops_ratio | f64 | 0.95 | Warn above this fraction of the consensus sigops cap. |
| warn_coinbase_sigops_max | u32 | 400 | Warn when coinbase sigops exceed this count. |
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| enforce | bool | false | Gate templates on the Class M mempool check (inline mode only). |
| tolerance_pct | f64 | 4.0 | Max percent of template txs allowed to be unknown to the mempool view. |
| poll_interval_secs | u64 | 10 | Interval between bitcoind getrawmempool polls. |
| max_stale_secs | u64 | 60 | Mempool view age before it degrades and Class M abstains. |
| per_tx_detail | bool | false | Expand rejection detail to list every unknown txid. |
| rpc_url | string | — | bitcoind JSON-RPC URL. |
| rpc_user | string | — | bitcoind RPC username. |
| rpc_pass | string | — | bitcoind RPC password (prefer VELDRA_BITCOIND_RPC_PASS env). |
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| mode | enum | inline | Deployment mode: inline | observe | shadow. |
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| listen_addr | string | 0.0.0.0:3333 | SV2 (Noise NX) miner-facing listener address. |
| health_addr | string | 127.0.0.1:8080 | HTTP health, metrics and events address. |
| noise_keypair_path | string | — | Path to the gateway Noise static keypair. |
| noise_cert_path | string | — | Path to the signed Noise certificate. |
| authority_pubkey | string | — | x-only authority public key miners verify. |
| max_connections | u32 | 1024 | Global concurrent SV2 connection cap. |
| max_connections_per_ip | u32 | 16 | Per-source-IP connection cap (0 = unlimited). |
| max_channels_per_conn | u32 | 256 | Per-connection mining channel cap. |
| noise_cert_validity_secs | u32 | 3600 | Noise certificate validity window. |
| noise_handshake_timeout_ms | u64 | 5000 | Noise NX handshake timeout. |
| template_url | string | — | Template-manager base URL. |
| template_poll_interval_ms | u64 | 3000 | Template-manager poll interval. |
| max_template_age_ms | u64 | 30000 | Reject templates older than this at the gateway. |
| prevhash_verdict_timeout_ms | u64 | 2000 | Max wait for a verifier verdict on a new block; warns below 1000. |
| prevhash_stale_hold_ms | u64 | 5000 | Hold stale work this long before disconnecting miners. |
| upstream_stale_max_ms | u64 | 30000 | Max upstream staleness before the fail policy acts. |
| upstream_failure_policy | enum | fail_closed | fail_closed | fail_open on upstream loss. |
| job_retention_ms | u64 | 300000 | How long jobs are retained for share validation. |
| ntime_elapsed_slack_seconds | u32 | 2 | Tolerance for miner ntime drift (seconds). |
| max_shares_per_second_per_channel | u32 | 0 | Per-channel share rate cap (0 = off). |
| channel_target_hex | string? | unset | Fixed channel difficulty target (regtest); unset = real difficulty. |
| extended_channels_enabled | bool | true | Accept OpenExtendedMiningChannel (0x13). |
| vardiff_enabled | bool | false | Enable variable-difficulty retargeting. |
| vardiff_target_shares_per_min | f64 | 20.0 | Target share submission rate for vardiff. |
| vardiff_retarget_interval_secs | u64 | 90 | Vardiff retarget interval. |
| vardiff_min_difficulty | u64 | 1 | Vardiff difficulty floor. |
| vardiff_max_difficulty | u64 | u64::MAX | Vardiff difficulty ceiling. |
| vardiff_max_adjustment_factor | f64 | 4.0 | Max per-retarget vardiff change factor. |
| noise_keypair_reload_sighup | bool | true | Reload the Noise keypair on SIGHUP. |
| wal_path | string | — | Share write-ahead log path (empty = disabled). |
| wal_compaction_threshold | usize | 1000 | Completed-record count that triggers WAL compaction. |
| gateway_instance_id | string | $HOSTNAME | Stable instance ID for split-brain prevention and share tracing. |
| auto_degrade | bool | true | Auto inline-to-observe degradation on verifier heartbeat loss. |
| auto_degrade_after_ms | u64 | 10000 | Heartbeat-loss window before auto-degrade. |
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| addr | string | — | Pool-verifier NDJSON TCP address. |
| health_probe_staleness_ms | u64 | 10000 | Mark the verifier unhealthy after this silence. |
| reconnect_delay_ms | u64 | 2000 | Delay between verifier reconnect attempts. |
| heartbeat_interval_ms | u64 | 5000 | Verifier heartbeat interval. |
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| url | string | — | Upstream share-receiver endpoint. |
| retries | u32 | 2 | Retry budget per share forward (5xx / timeout only). |
| forward_queue_size | usize | 50000 | Bounded outbound share-forward queue. |
| forward_max_in_flight | usize | 256 | Max concurrent in-flight share forwards. |
网关在 share 本地通过校验的瞬间发出 share_accepted,并在(且仅在)上游矿池确认时发出 share_forward_result。两者均经 HMAC 签名;两者都携带一个稳定的 v7 ULID event_id,供下游做重放安全的去重。
Veldra 的安全性是逐层构建的。任何一层都不信任它下面的一层;每一层都会对自己转发的内容重新推导或重新校验。本页记录的是这份契约;这些边界上的失败模式收录在 Failure Atlas。
Inbound peer is anonymous TCP until the Noise handshake completes. Until then, frames are size-capped, rate-limited per-IP, and subject to handshake timeout.
拒绝:
Past handshake, the miner authenticates via whitelist. Channels open subject to per-connection caps; each job is bound to a template ID and prevhash epoch.
拒绝:
Every template — whether locally generated or upstream — is re-decoded and re-derived. Phase 1 checks structural invariants. Phase 2 (opt-in) cross-checks against bitcoind mempool.
拒绝:
Every share is locally validated, then signed with the gateway's HMAC key and queued to upstream. The WAL persists the queue across crashes; the dedup window catches replays.
拒绝: