0x02 PQ Addresses (z1q{2,f,g,t}), AuthRegistryContract (#14), 179B PoP & Wallet KDF
60-Second TL;DR (
ZNN-SPEC-PHASE1-v4): Keeptypes.Addressat exact 20 bytes (z1q...40-char Bech32) so all embedded contracts, ABI words,AccountHeaders (60 B),smt-v1storage keys, and third-party exchange^z1qregexes remain 100% compatible! Introduce user class byte0x02(PQUserAddrByte, encoding deterministically asz1q2... / z1qf... / z1qg... / z1qt...—N02fix), enforce an explicit{0x00, 0x02}sender class allowlist (M12fix), add optionalPrecommitKeyfor256-bitcold-vault binding (B05fix), upgradeAuthRegistryContract (#14)with explicitexpectedRotationNonce+ErrAuthNonceOverflow+179-byteGenesisHash-bound Proof-of-Possession (B03, M06fix) evaluated atInclusionMomentumHeight(R4-03fix), and derive PQ keys cleanly usingGo 1.27+crypto/mldsaand32-bytefn-dsa v0.3seeds (B01, M05, R4-09fix).
1. Preserving the 20-Byte types.Address Invariant, Bech32 Prefixes (N02) & Class Allowlist (M12)
In go-zenon-v1/internal/types/address.go:11-28, Address is a [20]byte value type encoded in BIP-173 Bech32 with HRP = "z" (40 characters total).
Exact 8-to-5 Bit Bech32 Prefix Table (N02 Verified)
In Bech32 (CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"), the first 5-bit data symbol encodes the top 5 bits of addr[0], and the second 5-bit symbol encodes ((addr[0] & 0x07) << 2) | (addr[1] >> 6):
addr[0] | Constant Name | Exact Bech32 Prefix Set | Sender Class Rule (M12 Fix) |
|---|---|---|---|
0x00 | UserAddrByte | z1qp..., z1qq..., z1qr..., z1qz... | Valid user sender (legacy 0x00 sigs disabled at Spork #14; rotated AuthRegistry PQ accounts remain valid forever!) |
0x01 | ContractAddrByte | z1q8..., z1q9..., z1qx..., z1qy... | Canonical Embedded Contract address (#1..#12 Phase 0, #13 Settlement, #14 AuthRegistry, #15 Channel) |
0x02 | PQUserAddrByte | z1q2..., z1qf..., z1qg..., z1qt... | Native Post-Quantum user address (enabled at Spork #10; algID in {0x01, 0x02, 0x03}, plus 0x81 pre-sunset) |
0x03..0xff | Unassigned | (Reserved for future eras) | Rejected fail-closed as AccountBlock.Address (ErrABUnsupportedAddressClass, M12 fix)! |
0x02 (z1q{2,f,g,t}...) Is Superior to Changing the 3rd Character (z1z...)- 100% Zero-Friction CEX & SDK Compatibility: Both official SDKs (
znn_sdk_dartAddress.isValid) and third-party exchange/explorer^z1q[a-z0-9]{37}$regexes accept0x02withdrawals on Day 1! - No Misleading UX Dichotomy: Rotated
0x00Pillars, time-locked Stakes, andPoKoS-rescued wallets retain theirz1q{p,q,r,z}...addresses after upgrading toML-DSA-44/FN-DSA-512—so wallets indicate quantum safety via an explicit on-chain auth badge rather than address prefix heuristics, while engineers can still distinguish native0x02addresses immediately by character #4 ({2, f, g, t}).
2. Canonical 0x02 Derivation, Golden Go 1.27 Vector (N02) & 152-Bit vs. 256-Bit Binding (B05, R4-06)
DomainTag = "zenon-pq-addr:v1" // 16 ASCII bytes
Preimage = DomainTag || [algID] || pqPubKey // 17 + len(pqPubKey) bytes
Digest = FIPS202_SHA3_256(Preimage) // 32 bytes
Address[0] = 0x02
Address[1:] = Digest[0:19] // 19 bytes (152 bits)
Canonical Golden Go 1.27+ ML-DSA-44 (0x01) Test Vectors (N02, R4-01 Verified)
32-byte Seed (hex) : 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20
Go 1.27 Call : sk, _ := mldsa.NewPrivateKey(mldsa.MLDSA44(), seed[:])
len(pk.Bytes()) : 1312 bytes
SHA3-256(pk.Bytes()) : 941049da6dbfb141f770f075f7968f243cd4533e9719f121be0eb7c5f8ee7645
Derived 20B Address (hex) : 0208953cfda6d999d2a6c636a4a0b1cfb1c7fdea
Canonical Bech32 Address : z1qgyf208a5mven54xccm2fg93e7cu0l022alugr
Low-Level Sig KAT : sk.SignDeterministic([]byte("zenon-v3-kat"), &mldsa.Options{Context: "zenon-ab:v2"})
SHA3-256(lowLevelSig) : 621b16f8e3e2c7c064aec7ab540f1f64b1d1665feef964f07c6cded92d99f33b
v4 Bound Transcript Digest : f79b6f58918590a542c285d49fec08cde4ca1abc4d47ccb77b78b078569e542f // over SHA3-256("zenon-v4-bound-ab-kat")
SHA3-256(boundSig[2420]) : b7444ca31c5c802bd2cdc7f3fd5c76d1e2bce8655bfd44dd96a099e26c8608cf
Honest Security Profile of 152-Bit First Binding & PrecommitKey Upgrade (B05, R4-06 Fix)
- Before First Spend (
Height == 0, Unregistered): Only the19-byte(152-bit) digest is committed on-chain.- Ideal Unbounded-Depth Quantum Model:
~2^76single-target Grover queries (2^((152 - u)/2)multi-target across2^uuntouched funded addresses). - NIST
MAXDEPTH = 2^64Bounded-Depth Model (Zalka's Theorem[E6],R4-06Corrected): For oracle circuit depthD_circ = 2^d(d ≈ 12forML-DSAkeygen +SHA3-256), each processor runsK = 2^(64 - d) = 2^52Grover iterations coveringK^2 = 2^104states, requiringM = 2^152 / K^2 = 2^48parallel quantum processors andW = M * K = 2^152 / K = 2^100total oracle calls (> 2^112logical quantum gates) (M = 2^24parallel runs andW = 2^88calls in the idealizedd = 0limit).
- Ideal Unbounded-Depth Quantum Model:
- After First Spend (
Height >= 1) ORPrecommitKeyRegistration (Height == 0Cold Vaults): Full32-byte(256-bit)SHA3-256([algId] || pqPubKey)is locked in authenticatedsmt-v1state (2^128ideal Grover). High-value cold vaults wanting256-bitbinding before ever emittingHeight = 1callAuthRegistry.PrecommitKey(from any feeless sponsor/funder account pre-CRQC) to bind their fullpqPubKeyintoAuthRegistry (#14)at funding time!
3. AuthRegistryContract (#14) v4 ABI, 179-Byte PoP & Dual-Ledger Races (B03, B05, M06, R4-03 Fix)
3.1 AuthRegistryContract (#14) ABI
[
{"type":"function","name":"RotateKey","inputs":[
{"name":"algId","type":"uint8"},
{"name":"expectedRotationNonce","type":"uint64"},
{"name":"newPublicKey","type":"bytes"},
{"name":"newKeyPopSignature","type":"bytes"}
]},
{"type":"function","name":"RescueWithPoKoS","inputs":[
{"name":"targetAddress","type":"address"},
{"name":"algId","type":"uint8"},
{"name":"newPublicKey","type":"bytes"},
{"name":"newKeyPopSignature","type":"bytes"}
]},
{"type":"function","name":"PrecommitKey","inputs":[
{"name":"targetAddress","type":"address"},
{"name":"algId","type":"uint8"},
{"name":"newPublicKey","type":"bytes"},
{"name":"newKeyPopSignature","type":"bytes"}
]},
{"type":"function","name":"UpgradeHybridToPureMLDSA44","inputs":[
{"name":"expectedRotationNonce","type":"uint64"},
{"name":"newKeyPopSignature","type":"bytes"}
]}
]
PrecommitKeyGuard (B05): RequirestargetAddress[0] == 0x02,AccountStore(targetAddress).Height == 0,activePubKeyHash == 0,pendingEffectiveHeight == 0,DerivePQAddress(algId, newPublicKey) == targetAddress(preventing unauthorized griefing/bricking of third-party addresses!), and a valid179-bytenewKeyPopSignature(opByte = 0x03).- Overflow Guard:
RotateKeyandUpgradeHybridToPureMLDSA44requireauthState.rotationNonce < math.MaxUint64(ErrAuthNonceOverflow), never wrapping to0.
3.2 Exact 179-Byte GenesisHash- & Generation-Bound PoP Preimage (M06 Fix)
To prevent cross-network replay (e.g., devnets sharing ChainIdentifier = 1), cross-role confusion, or competing-generation races (B03), AuthRegistryContract reconstructs the exact 179-byte popPreimage:
popPreimage (exact 179 bytes):
Bytes 0..17 : "zenon-auth-pop:v3" // 17 ASCII bytes
Bytes 17..25 : be_u64(ChainIdentifier) // 8 bytes (1 on Alphanet)
Bytes 25..57 : GenesisMomentumHash[32] // 32 bytes (prevents same-ChainId fork replay!)
Byte 57 : opByte // 1 byte (0x01=Rotate, 0x02=PoKoS, 0x03=Precommit, 0x04=HybridStrip)
Bytes 58..78 : targetAddress[20] // 20 bytes
Bytes 78..98 : senderBlock.Address[20] // 20 bytes (binds sponsor/relayer!)
Bytes 98..106 : be_u64(senderBlock.Height) // 8 bytes (prevents intra-account replay)
Bytes 106..114 : be_u64(expectedRotationNonce) // 8 bytes (MUST equal authState.rotationNonce!)
Bytes 114..146 : prevActivePubKeyHash[32] // 32 bytes ([32]byte{0} on first registration)
Byte 146 : algId // 1 byte in {0x01, 0x02, 0x03, 0x81*}
Bytes 147..179 : SHA3_256(newPublicKey)[32] // 32 bytes
-------------------------------------------------------------------------
Exact Sum: 17 + 8 + 32 + 1 + 20 + 20 + 8 + 8 + 32 + 1 + 32 = 179 bytes!
popDigest = FIPS202_SHA3_256(popPreimage) // 32 bytes
3.3 Dual-Ledger Send -> Receive Generation Semantics & H_inc + 1 Promotion (B03, R4-03 Fix)
- Preserving User-Stripe Isolation + Clean
rollbackEmbeddedon Competing Sends (B03, R4-03):- User
UserSendblocks remain 100% isolated to the sender's ownAccountStore(ApplySendvalidates stateless ABI packing only, preserving parallelStage 3auser stripes!). - Suppose an old key emits two
RotateKeyUserSendblocksS_1(expectedRotationNonce = 0) andS_2(expectedRotationNonce = 0) beforeAuthRegistryexecutesContractReceive(S_1). ContractReceive(S_1)executes againstctx.InclusionMomentumStore()atH_confirm = ctx.InclusionHeight()(NOTreceiveBlock.MomentumAcknowledgedR4-03!), setspendingEffectiveHeight = H_confirm + 1, and immediately incrementsauthState.rotationNoncefrom0to1.- When
ContractReceive(S_2)executes,S_2.expectedRotationNonce (0) != authState.rotationNonce (1)—returningErrAuthStaleGeneration, whichGenerateEmbeddedReceive(vm.go:568-578) cleanly rolls back (Data = be_u64(2)) after advancing the FIFO sequencer cursor without stallingAuthRegistry's mailbox!
- User
- Phase 1A (
10sv3) vs. Phase 1B (1sv4) In-Flight Window (B03, B09Honesty):- In Phase 1A (
LegacyDposV1),ContractReceive(S_1)is produced asynchronously in the next slot (~10–20 stotal window); in Phase 1B (Momentum v4Algorithm 1 Step 3b),ContractReceive(S_1)executes deterministically in the sameMomentumH_confirm(1.0 spromotion atH_confirm + 1). Rotation is strictly a pre-CRQC proactive migration mechanism, never a post-compromise undo button.
- In Phase 1A (
4. Wallet Key Derivation (Go 1.27+), Seed Classes & Independent Seed Option (B01, M05, R4-09 Fix)
Master Node: HMAC-SHA512(Key = "zenon-pq-slip0010:v1", Data = bip39Seed64)
Derivation: m / 44' / 73404' / 1' / <algId>' / <accountIndex>'
- Computational PRF Isolation & Wallet Cohort Coverage (
M05Fix):HMAC-SHA512provides computational PRF domain separation between classicalSLIP-0010and PQ subtrees (not information-theoretic secrecy ifbip39Seed64itself is physically stolen!). Wallets (Syrius,znn-cli) MUST offer both deterministic derivation from an existing12/24-wordBIP-39mnemonic (with or without 25th-word passphrase, includinggo-zenonArgon2id-encryptedKeyFileswallet/keystore.go:29) and rotating to a freshly generated independent256-bitentropy seed (mandatory whenever root mnemonic exposure is suspected).- Hardware wallets or CLI users holding standalone imported keys without
BIP-39rotate directly to a fresh PQ seed viaRotateKey(and any standard32-byteRFC 8032seed remains eligible forRescueWithPoKoS—see Ed25519-PoKoS Rescue).
algId' Segment | Target Scheme | Exact Go 1.27+ / Reference Extraction from 32-Byte leaf.Key[0:32] (B01, R4-09 Verified) |
|---|---|---|
1' (0x80000001) | ML-DSA-44 | mldsa.NewPrivateKey(mldsa.MLDSA44(), leaf.Key[0:32]) (Go 1.27+ stdlib crypto/mldsa) |
2' (0x80000002) | FN-DSA-512 | SHA3_256("zenon-fndsa512-keygen:v1" || leaf.Key[0:32]) (32 B seed -> pinned fn-dsa v0.3 keygen R4-09) |
3' (0x80000003) | SLH-DSA-SHAKE-128s | SHAKE256("zenon-slhdsa128s-keygen:v1" || leaf.Key[0:32], 48) -> FIPS 205 (SK.seed, SK.prf, PK.seed) |