S256 LWMA Fork Transition Rehearsal

Run 2026-09-02 · local, isolated regtest, realistic difficulty floor · scaled-down rehearsal of mainnet's real height-17,500 AuxPoW/LWMA hard fork
Why this test: S256 mainnet is currently at block ~16,883 — roughly 600 blocks (~8–9 days) away from its real AuxPoW+LWMA activation at height 17,500. This rehearsal exercises the exact same code path (chain identity, activation gating, and LwmaCalculateNextWorkRequired) on an isolated local chain, scaled down to a tractable size, with a realistic starting difficulty, to check the transition and LWMA's hashrate-adaptation behavior before it happens for real.

Scenario

Three simulated miners mine from genesis at a realistic starting difficulty (S256 testnet's own real, committed floor — 256× easier than difficulty-1, not an artificial regtest default). The classic-DAA-to-LWMA fork is scaled from mainnet's real height 17,500 down to height 96 — the smallest fork height at which LWMA's own N=96-block window has a full, real, pre-fork-timestamped history immediately available, exactly mirroring mainnet's actual situation. After the fork, miner count is varied to observe LWMA's reaction, with the recovery phase extended so the full round-trip is visible within LWMA's 96-block window:

Phase 1 · heights 1–95
Pre-fork
Classic DAA, on-target pace
Phase 2 · heights 96–155
3 miners
LWMA baseline, ~4% above target
Phase 3 · heights 156–205
2 miners
One miner drops out — genuinely below target
Phase 4 · heights 206–375
3 miners
Dropped miner returns

Result: difficulty over the full run

0 96 156 206 375 block height harder easier
pre-fork (classic DAA) baseline (3 miners) drop (2 miners) recovery (3 miners)

Reading the result

Bottom line: LWMA activates cleanly at the fork, eases quickly and decisively when hashrate drops, and recovers cleanly once enough evidence of the higher hashrate accumulates in its window — with a realistic, expected lag before that recovery becomes visible, not instability. 375 blocks, zero crashes, zero stalled/rejected blocks, zero consensus errors.

Methodology

Regtest, with a temporary consensus test-patch (fPowNoRetargeting=false; activation heights set to 96; powLimit set to S256 testnet's own real, already-committed value — 256× easier than difficulty-1, not regtest's own unrealistic default). setmocktime (regtest-only) gave each block a controlled, phase-appropriate timestamp, while every block's proof-of-work was still genuinely solved and validated through real RPC calls (generatetoaddress, real block acceptance, real LwmaCalculateNextWorkRequired execution) rather than a unit-test mock. The test-only patch is local to this rehearsal and is not part of any real chain's consensus rules.

Earlier attempts and what they found (click to expand)

Two issues turned up before this run, both worth keeping on record:

  1. Real competitive CPU mining on testnet (first attempt): mining the pre-fork phase in ~4–5 real seconds/block instead of the real 1200s target made LWMA see an "impossibly fast" history the instant it activated, spiking required difficulty ~250× — correct LWMA behavior, but an artifact of compressing the test's own timeline, not reproducible on mainnet (whose real pre-fork blocks are already paced at ~20 minutes).
  2. Regtest's own default powLimit (second attempt, the "spike" a reader spotted in the very first version of this report): regtest's real default is deliberately enormous, ~255 bits — essentially the ceiling of a 256-bit integer. At the one classic-DAA interval boundary the pre-fork phase crossed, the retarget formula's multiplication (oldTarget × actualTimespan) overflowed that fixed-width type and silently wrapped around, producing a difficulty spike of roughly 43,700× that had nothing to do with LWMA, S256, or the fork itself. Confirmed by calling the actual compiled retarget function directly with the exact recorded block times and reproducing the identical (wrapped) result. This run instead uses a realistic powLimit (~232 bits, S256 testnet's own value) with over 20 bits of headroom — comfortably safe, and the same margin any real chain has by design.

Checkpoints

HeightPhasenBitsRelative difficulty
0genesis1e00ffff3.906e-03
71pre-fork1e00ffff3.906e-03
72pre-fork1e00fc723.961e-03
95pre-fork1e00fc723.961e-03
96fork block1e00ffff3.906e-03
120baseline (3)1e00f9a04.006e-03
155baseline (3)1e00f1a34.138e-03
156drop (2)1e00f1694.142e-03
165drop (2)1e00ffff3.906e-03
205drop (2)1e00ffff3.906e-03
206recovery (3)1e00ffff3.906e-03
256recovery (3)1e00ffff3.906e-03
296recovery (3)1e00f47d4.090e-03
336recovery (3)1e00ee144.200e-03
375recovery (3)1e00e5ac4.354e-03

"Relative difficulty" is expressed against real Bitcoin's difficulty-1 reference (nBits 1d00ffff = 1.0); the values here are all in the 256×-easier floor's own range, hence the small numbers throughout — only the trend across rows matters.

Related evidence

Separately, this build's daemon completed a full real sync of the live S256 mainnet chain (genesis through height 16,883, against real network peers) with zero errors, warnings, or reorgs — confirming the consensus code is sound on the real chain right up to (but not yet through) the real fork. This rehearsal is the complementary piece: what happens at and after the fork, which the real chain hasn't reached yet.