feat(consensus): registration-activation cooldown, part of HF4 — wallet usable N blocks after registration (availability prototype) - #122
Open
DDerona wants to merge 3 commits into
Conversation
…i wallet-spam) Client-side registration miners were optimized (increment-optimized nonce search) and now hash ~10-20x faster, which makes mass wallet registration cheap again and enables regpool flooding / wallet-spam attacks that previously occurred. The historical 24-bit target was calibrated around the old slow hashing, so this restores the per-wallet cost of registration. - Add MAJOR_HF4_HEIGHT to mainnet/testnet config (TODO: set real height). - Add transaction.RegistrationPoWSolved(bits) helper; 28 bits = 3 zero bytes plus a zero high nibble on byte 3 (16x harder than 24 bits). - Enforce the 28-bit target at HF4 in the mempool and block validation; keep the 24-bit rule before the fork. The fork rule is derived from chain height through a single registrationPoWRequiredBits(height, hf4) helper so it lives in one place. - CLI and webwallet registration miners always target 28 bits: a 28-bit winner also satisfies the 24-bit check, so wallets stay valid on both sides of the fork, and Engram can keep its optimized loop (old hardware still registers in ~30-50 min instead of hours). 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
The 1.1GB build/ directory from `go build -o build/...` was untracked and unprotected, so an accidental `git add .` would stage a gigabyte of binaries. Ignore it. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
DDerona
force-pushed
the
feat/registration-active-cooldown
branch
from
August 24, 2026 19:20
1cf9d7b to
c4f5c25
Compare
…ability prototype)
DDerona
force-pushed
the
feat/registration-active-cooldown
branch
from
August 24, 2026 19:26
c4f5c25 to
ccbae2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(consensus): registration-activation cooldown — a wallet becomes usable N blocks after registration (availability prototype, part of HF4)
Summary
Adds the second half of the wallet anti-spam design and the seed of a future
Proof-of-Availability model: a freshly registered wallet is not usable
until it has waited 50 final blocks (≈ 15 min) on-chain after its
registration. The delay is measured in confirmed chain-height progress, not
wall-clock time, so it stays correct even if block time changes in a later
fork.
This ships as part of the single HF4 fork, together with the registration
PoW target bump (24 → 28 bits, from #76). Both rules activate at
MAJOR_HF4_HEIGHT. Together they form the hybrid: a mild creation PoW plusa sustained, availability-style cooldown.
The hybrid and the PoA rationale
Devs have floated moving toward a proof-of-availability consensus, and asked
how that could be exercised at the wallet-registration level first. The idea:
mass registration non-trivial.
blocks before it can mine or spend traceably. This is the availability
toggle: cost is measured in lived participation, not compute, which is what
a PoA regime would later generalise.
A cooldown alone is cheap for honest users (no burning cycles on weak
hardware) and, unlike a bare wall-clock timer, is robust because it counts
confirmed blocks.
What changed
MAJOR_HF4_HEIGHT(mainnet/testnet placeholders — see REQUIRED BEFORE MERGE) and
RegistrationActiveAfterBlocks = 50.RegistrationActivationTopo(regTopo, nowTopo, afterBlocks)— the pure rule + unit tests.
the balance tree (additive, keyed by the account's 16-byte mining identity)
when a registration tx is executed.
Extract_signer)are rejected from the mempool and from block inclusion while the wallet is
too young.
insertion, and block acceptance all reject a miner still in the cooldown.
Scope / privacy note (important)
DERO spending is ring-signature based. The true sender is only
deterministically recoverable at ringsize == 2. Therefore:
anonymous by protocol design and cannot be attributed to one account — the
gate cannot enforce without breaking ring anonymity. This is a known,
accepted property, not a bypass we can close silently.
16-byte identity in every miniblock.
Post-HF4 registrations carry a marker and are gated; legacy wallets
registered before HF4 carry no marker and are treated as already-active
(they cannot be attributed a registration time and must not be locked out).
REQUIRED BEFORE MERGE
MAJOR_HF4_HEIGHTis a placeholder (far in the future). The rule staysdormant until it's set to a real height. Shipping with the placeholder is
unsafe — set the real mainnet/testnet activation heights first.
Verification
go build ./...clean.go test ./transaction/ ./config/pass.go vetclean of new warnings (remaining warnings are pre-existing deadcode).
MAJOR_HF4_HEIGHTlow to confirm: (1) a fresh registration mines/spendsonly after N blocks, (2) a legacy (no-marker) account keeps working, (3) no
regression to block validation speed (marker reads are per-admission tip
tree lookups — consider an LRU like
IsAddressHashValidif profiling showsa need).
Related
creation-cost half of this design and the discussion that motivated it.
Retained for history; both rules land together in HF4.