Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ struct Params {
int OdoHeight = 9112320; // Odocrypt activation (BuriedDeployment)

// DigiDollar / Oracle
int nDDActivationHeight{0}; // BIP9 alignment height
int nDDActivationHeight{0}; // Static DD floor gate (historical BIP9 floor)
int nOracleActivationHeight{std::numeric_limits<int>::max()}; // Live-feed activation height
int nOracleEpochLength{1440}; // Blocks per oracle epoch (default: 1440 = 24 hours)
int nOracleRequiredMessages{1}; // Off-chain quorum threshold
Expand All @@ -253,7 +253,7 @@ struct Params {
};
```

`Consensus::DEPLOYMENT_DIGIDOLLAR` (bit 23) is the BIP9 deployment that gates `SCRIPT_VERIFY_DIGIDOLLAR`; production `min_activation_height`, `nDDActivationHeight`, `nOracleActivationHeight`, and `nDigiDollarMuSig2Height` are aligned in `src/kernel/chainparams.cpp` (mainnet 23627520, testnet26 600). Testnet26 uses default P2P port 12033, data directory `testnet26`, reset genesis timestamp 1780156800, and the same timestamp as its BIP9 start. Default regtest uses BIP9 `ALWAYS_ACTIVE` / `min_activation_height=0` with DD/oracle height gates at 650; `nDigiDollarMuSig2Height` follows the effective BIP9 boundary (`0`) so v0x03 quotes are valid whenever DigiDollar is active. The direct `-digidollaractivationheight=N` knob retargets both BIP9 and the DD/oracle/MuSig2 gates. Startup oracle-price cache reconstruction follows the BIP9 predicate used by block connection so regtest BIP9-active oracle bundles below 650 are not skipped on restart/reindex. MuSig2 v0x03 oracle bundles are required as soon as DigiDollar is active, not before the DD/oracle activation height.
(v9.26.5 burial) `Consensus::DEPLOYMENT_DIGIDOLLAR` is now a **buried deployment** (BIP90; historically BIP9 bit 23) that gates `SCRIPT_VERIFY_DIGIDOLLAR` at `Consensus::Params::DigiDollarHeight` (mainnet 23869440, testnet26 600, signet/regtest 0 — the verified BIP9 `since` heights; `TaprootHeight`/`AlgoLockHeight` are buried alongside). The static gates `nDDActivationHeight`, `nOracleActivationHeight`, and `nDigiDollarMuSig2Height` remain aligned at the historical floor in `src/kernel/chainparams.cpp` (mainnet 23627520, testnet26 600). Testnet26 uses default P2P port 12033, data directory `testnet26`, and reset genesis timestamp 1780156800. Default regtest buries DigiDollar at height 0 with DD/oracle height gates at 650; `nDigiDollarMuSig2Height = min(nDDActivationHeight, DigiDollarHeight) = 0` so v0x03 quotes are valid whenever DigiDollar is active. The direct `-digidollaractivationheight=N` knob retargets the buried height and the DD/oracle/MuSig2 gates together (DD activates at exactly N); `-testactivationheight=digidollar@H` moves only the buried height, and `-vbparams=digidollar:...` is a startup error. Startup oracle-price cache reconstruction follows the same buried predicate used by block connection so regtest DD-active oracle bundles below 650 are not skipped on restart/reindex. MuSig2 v0x03 oracle bundles are required as soon as DigiDollar is active, not before the DD/oracle activation height.

### 3.3 Block Validation Results

Expand Down Expand Up @@ -686,7 +686,7 @@ enum class SigVersion {
| `SCRIPT_VERIFY_CHECKSEQUENCEVERIFY` | BIP112 CSV |
| `SCRIPT_VERIFY_WITNESS` | BIP141 SegWit |
| `SCRIPT_VERIFY_TAPROOT` | BIP341/342 Taproot |
| `SCRIPT_VERIFY_DIGIDOLLAR` | DigiDollar opcodes (`OP_DIGIDOLLAR`/`OP_DDVERIFY`/`OP_CHECKPRICE`/`OP_CHECKCOLLATERAL`/`OP_ORACLE`); set in `GetBlockScriptFlags()` (`validation.cpp:2755, 2796-2797`) only when BIP9 `DEPLOYMENT_DIGIDOLLAR` is active. |
| `SCRIPT_VERIFY_DIGIDOLLAR` | DigiDollar opcodes (`OP_DIGIDOLLAR`/`OP_DDVERIFY`/`OP_CHECKPRICE`/`OP_CHECKCOLLATERAL`/`OP_ORACLE`); set in `GetBlockScriptFlags()` (`validation.cpp:2755, 2796-2797`) only when the buried `DEPLOYMENT_DIGIDOLLAR` deployment is active (BIP90 since v9.26.5). |

### 8.4 DigiDollar Opcodes

Expand Down Expand Up @@ -1183,9 +1183,9 @@ Aggregate Schnorr signature + participation bitmap → Coinbase OP_RETURN
|---------|--------------------------------------|----------------------------------------------|-----------------------------------|-----------------|
| Mainnet | 23,627,520 | 23,627,520 (= DD) | 23,627,520 (= DD) | 7 signatures from 35 configured active keys |
| Testnet26 | 600 | 600 (= DD) | 600 (= DD) | 7 signatures from 35 configured active keys |
| Regtest | 650 | 650 (= DD) | 0 (= BIP9 ALWAYS_ACTIVE boundary) | 4-of-7 |
| Regtest | 650 | 650 (= DD) | 0 (= buried `DigiDollarHeight`) | 4-of-7 |

`nDigiDollarMuSig2Height` now collapses to the effective DigiDollar activation boundary: `nDDActivationHeight` on mainnet/testnet, and BIP9 `min_activation_height=0` on default regtest where DigiDollar is `ALWAYS_ACTIVE`. The legacy `nDigiDollarPhase2Height` / `nDigiDollarPhase3Height` fields no longer exist.
`nDigiDollarMuSig2Height` now collapses to the effective DigiDollar activation boundary: `nDDActivationHeight` on mainnet/testnet, and the buried `DigiDollarHeight = 0` on default regtest (v9.26.5 burial; formerly the BIP9 `ALWAYS_ACTIVE` boundary). The legacy `nDigiDollarPhase2Height` / `nDigiDollarPhase3Height` fields no longer exist.

### 13.2 Price Message Structure

Expand Down Expand Up @@ -1461,7 +1461,7 @@ This architecture document has been spot-validated against the active DigiByte C
| OdoHeight | 9,112,320 | kernel/chainparams.cpp:126 |
| DD_TX_VERSION | 0x0D1D0770 | primitives/transaction.h:47 |
| OP_DIGIDOLLAR..OP_ORACLE | 0xbb..0xbf | script/script.h:210-214 |
| DEPLOYMENT_DIGIDOLLAR bit | 23 | kernel/chainparams.cpp:177,517,969,1099 |
| DigiDollarHeight (buried deployment, v9.26.5; historically BIP9 bit 23) | mainnet 23,869,440; testnet26 600; signet/regtest 0 | kernel/chainparams.cpp |
| nDigiDollarMuSig2Height | equals effective DigiDollar activation boundary (mainnet 23,627,520; testnet26 600; default regtest 0) | kernel/chainparams.cpp |

### Verified Algorithm Implementations
Expand Down
24 changes: 15 additions & 9 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Working directory: `/home/jared/Code/digibyte`. Current DigiDollar v1 campaign b
7. `REPO_MAP_DIGIDOLLAR.md` — DigiDollar/oracle file index (production, wallet, RPC, Qt, tests, fuzz)
8. `DIGIDOLLAR_EXPLAINER.md` — User-facing DigiDollar V1 protocol summary
9. `DIGIDOLLAR_ORACLE_EXPLAINER.md` — User-facing oracle/MuSig2 summary
10. `DIGIDOLLAR_ACTIVATION_EXPLAINER.md` — BIP9 gating of DD/oracle surface
10. `DIGIDOLLAR_ACTIVATION_EXPLAINER.md` — Activation gating of DD/oracle surface (v9.26.5 BIP90 burial + BIP9 history)
11. `DIGIDOLLAR_WALLET_INTEGRATION.md` — Wallet/RPC integration guide
12. `DIGIDOLLAR_EXCHANGE_INTEGRATION.md` — Exchange/custody integration guide
13. `ORACLE_DISCOVERY_ARCHITECTURE.md` — Oracle endpoint discovery design
Expand Down Expand Up @@ -62,17 +62,23 @@ Defined in `src/script/script.h:209-220`:
- `OP_CHECKCOLLATERAL = 0xbe` — compares stack ratio to threshold; consumes `<ratio> <threshold>` and pushes `ratio>=threshold`
- `OP_ORACLE = 0xbf` — coinbase oracle bundle marker

These are OP_SUCCESSx-class opcodes that become functional only when `SCRIPT_VERIFY_DIGIDOLLAR` is set, which only happens when BIP9 `DEPLOYMENT_DIGIDOLLAR` is ACTIVE (bit 23). See `IsDigiDollarOpcode` / `IsOpSuccessForFlags` at `src/script/interpreter.cpp:439-453`.
These are OP_SUCCESSx-class opcodes that become functional only when `SCRIPT_VERIFY_DIGIDOLLAR` is set, which only happens when the buried `DEPLOYMENT_DIGIDOLLAR` deployment is active (BIP90 as of v9.26.5; historically BIP9 bit 23). See `IsDigiDollarOpcode` / `IsOpSuccessForFlags` at `src/script/interpreter.cpp:439-453`.

## Activation summary (BIP9 bit 23)
## Activation summary (buried deployment — BIP90, v9.26.5)

| Network | Start | Min activation height | Window | Threshold | Status |
|---------|-------|----------------------|--------|-----------|--------|
| Mainnet | 2026-06-01 (epoch 1780272000) | 23,627,520 | 40,320 blocks (~1 week) | 70% (28,224 of 40,320) | Pending |
| Testnet (testnet26) | BIP9 start/reset genesis 1780156800 | 600 | 200 blocks | 70% (140 of 200) | Check `getdigidollardeploymentinfo` |
| Regtest | ALWAYS_ACTIVE | 0 | 144 blocks (BIP9 default) | 75% (108 of 144) | Active |
As of v9.26.5 the Taproot, DigiDollar, and AlgoLock deployments are **buried** (BIP90): all three are ACTIVE on mainnet, activation is a hardcoded per-network height returned by `Consensus::Params::DeploymentHeight()` (fields `TaprootHeight` / `DigiDollarHeight` / `AlgoLockHeight`), the BIP9 state machine no longer runs for them, and blocks no longer signal bits 2/23/0. `DeploymentPos` retains only `DEPLOYMENT_TESTDUMMY`. The burial heights are the empirically verified BIP9 `since` heights (live mainnet `getdeploymentinfo`; testnet26 verified block-by-block). The historical BIP9 parameters (bit 23, mainnet start 2026-06-01, 70% of a 40,320-block window, `min_activation_height` floor 23,627,520) are preserved in `DIGIDOLLAR_ACTIVATION_EXPLAINER.md`.

`nDDActivationHeight`, `nOracleActivationHeight`, and `nDigiDollarMuSig2Height` collapse to the same height trigger on mainnet (23,627,520 / 23,627,520 / 23,627,520) and testnet (600 / 600 / 600). Default regtest keeps DD/oracle height gates at 650 / 650 while the BIP9 deployment is `ALWAYS_ACTIVE` with `min_activation_height=0`; `nDigiDollarMuSig2Height` follows that effective BIP9 boundary and is `0`, so v0x03 quotes are valid whenever DigiDollar is active. The direct `-digidollaractivationheight=N` regtest knob retargets both the BIP9 minimum and the static DD/oracle/MuSig2 height gates. Generic `-vbparams=digidollar:...` still overrides BIP9 only; because MuSig2 follows the effective DigiDollar BIP9 boundary, a BIP9-only test override can move MuSig2 validation without moving the static DD/oracle P2P gates. Startup oracle-price reconstruction follows the same BIP9 predicate as block connection, so default-regtest BIP9-active blocks below 650 are not dropped during restart/reindex cache rebuilds. The variable in code is `nDigiDollarMuSig2Height`, not the older `nDigiDollarPhase3Height` (`src/consensus/params.h:195`). Once DigiDollar is active, v0x03 MuSig2 is the only on-chain bundle format ever accepted.
| Network | `TaprootHeight` | `DigiDollarHeight` | `AlgoLockHeight` |
|---------|-----------------|--------------------|------------------|
| Mainnet | 21,168,000 | 23,869,440 | 23,869,440 |
| Testnet (testnet26) | 0 | 600 | 0 |
| Signet / Regtest | 0 | 0 | 0 |

Static gates are unchanged: mainnet `nDDActivationHeight = nOracleActivationHeight = nDigiDollarMuSig2Height = 23,627,520` (the historical BIP9 floor, deliberately below the 23,869,440 burial height); testnet 600 / 600 / 600. Default regtest keeps the DD/oracle height gates at 650 / 650 while `nDigiDollarMuSig2Height = min(650, DigiDollarHeight) = 0`, so v0x03 quotes are valid whenever DigiDollar is active. `EarliestActivationFloor(params) = min(nDDActivationHeight, DigiDollarHeight)` (0 if the deployment is disabled) — value-preserving vs the pre-burial formula on every network. `IsDigiDollarEnabled` is a pure height compare against `DigiDollarHeight` (no `VersionBitsCache` anywhere in the DD path), and startup oracle-price reconstruction uses the same buried predicate as block connection, so DD-active blocks below the regtest 650 gate are still not dropped during restart/reindex cache rebuilds.

Regtest knobs: `-digidollaractivationheight=N` sets `DigiDollarHeight` AND `nDDActivationHeight`/`nOracleActivationHeight`/`nDigiDollarMuSig2Height` to N, so DigiDollar activates at exactly height N (pre-burial the knob ran real BIP9 signaling and activated at the first 144-block window boundary >= max(432, N)). `-testactivationheight=taproot@H` / `digidollar@H` / `algolock@H` moves only the buried deployment height — the static DD/oracle gates keep their defaults, but `nDigiDollarMuSig2Height` is derived as `min(nDDActivationHeight, DigiDollarHeight)` and so follows `digidollar@H` below 650; `-digidollaractivationheight` takes precedence for DigiDollar. `-vbparams=digidollar/taproot/algolock` is now a startup error ("Invalid deployment") — only `testdummy` remains.

RPC/GBT surface: `getdeploymentinfo`/`getblockchaininfo` render the three deployments as `{"type":"buried","active":…,"height":…}` with no `bip9` sub-object. `getdigidollardeploymentinfo` now returns `{enabled, type:"buried", status:"active"|"defined", activation_height (omitted if the deployment is disabled), oracle_activation_height, musig2_format_activation_height, oracle_pubkey_count, oracle_consensus_required, oracle_total_slots, oracle_seed_peers, musig2_session{...}}`; the BIP9 fields (`bit`, `start_time`, `timeout`, `min_activation_height`, `blocks_until_timeout`, `signaling_blocks`, `threshold`, `period_blocks`, `progress_percent`) were removed, and `activation_height` is now always the burial height (the old back-scan reported the first-active/last-LOCKED_IN block instead). `getblocktemplate` always lists `taproot`/`digidollar`/`algolock` in `rules` once active (hardcoded like `csv`); `vbavailable` no longer mentions them and the template `version` never sets bits 2/23/0. `MinBIP9WarningHeight` is 23,909,760 on mainnet and 800 on testnet. The variable in code is `nDigiDollarMuSig2Height`, not the older `nDigiDollarPhase3Height`. Once DigiDollar is active, v0x03 MuSig2 is the only on-chain bundle format ever accepted.

## Oracle roster

Expand Down
Loading
Loading