Skip to main content

0x02 Addresses, AuthRegistry & Wallet KDF

TL;DR: Keep types.Address at exact 20 bytes (z1... Bech32) so all 12 embedded contracts, ABI words, AccountHeaders (60 B), and storage keys remain 100% unchanged. Introduce user class byte 0x02 (z1p... / z1r... under HRP "z") for fresh post-quantum accounts, deploy a 13th embedded contract AuthRegistryContract (0x01...) so existing 0x00 addresses with locked Stake, Pillar, or Sentinel state can rotate to a PQ key in place, and derive all PQ keys deterministically from existing 24-word BIP-39 seeds.


1. Preserving the 20-Byte types.Address Invariant​

In go-zenon-v1/internal/types/address.go:11-28, Address is a [20]byte value type permeated throughout consensus:

  • Every ABI "address" parameter across all 12 embedded contracts (internal/codec/abi/) unpacks into [20]byte.
  • types.AccountHeader (internal/types/account_header.go) is a fixed 60-byte tuple Address[20] || Hash[32] || Height[8] sorted lexicographically inside Momentum.Content.
  • AccountBlock.ComputeHash() (internal/nom/account_block.go:152-153) places Address at bytes 104..124 and ToAddress at 124..144 of the fixed 306-byte preimage.

Changing AddressSize from 20 to 32 bytes would fork every ABI selector, storage key (ProducingPillarNameKey, DelegationInfoKey, etc.), RPC payload, and AccountBlock hash preimage. Instead, Zenon's existing class byte addr[0] cleanly namespaces post-quantum accounts within the exact 20-byte envelope:

addr[0]Constant NameBech32 Prefix (HRP = "z")Meaning & Payable Status
0x00UserAddrBytez1q...Legacy Ed25519 user address (may bind a PQ key in AuthRegistry)
0x01ContractAddrBytez1qxemdedded...Canonical Embedded Contract address
0x02PQUserAddrBytez1z... / z1y...Native Post-Quantum user address (algID ∈ {0x01, 0x02, 0x03, 0x81})
Required Helper Updates in internal/types/address.go & ptlc.go
  1. Update (a Address) IsUserAddress() bool (address.go:197) from a[0] == UserAddrByte to: a[0] == UserAddrByte || (pqSporkActive && a[0] == PQUserAddrByte).
  2. Update ptlc.IsPayableDestination(addr) (internal/vm/contracts/ptlc/ptlc.go:289) to accept both 0x00 (if not sunset) and 0x02 user addresses.

2. Canonical 0x02 Address Derivation Formula​

To prevent cross-algorithm preimage collisions, a 0x02 address hashes a domain-separated tag, the 1-byte algID, and the exact canonical public key encoding:

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)
algIDSchemelen(pqPubKey)Exact Preimage LengthAllowed on 0x02 Address?
0x01ML-DSA-441,312 B1,329 BYes
0x02FN-DSA-512897 B914 BYes (post-Phase 2)
0x03SLH-DSA-SHAKE-128s32 B49 BYes
0x81Hybrid Ed25519 + ML-DSA-4432 + 1,312 = 1,344 B1,361 BYes
  • Bech32 vs. Bech32m Encoding: internal/types/address.go:175 (ParseAddress) already accepts both BIP-173 Bech32 and BIP-350 Bech32m, while String() emits canonical 40-character lowercase Bech32 (z1...) for full backwards compatibility with existing explorers and RPC clients.

3. In-Place Key Rotation via AuthRegistryContract​

Why Sending Funds to a New Address Is Insufficient on Zenon​

On Zenon Alphanet, four embedded contracts lock high-value state to an immutable types.Address that cannot be transferred via UserSend:

  1. PillarContract (internal/vm/contracts/pillar/pillar.go:220): UpdatePillar rotates BlockProducingAddress and RewardWithdrawAddress, but NEVER StakeAddress (15,000 ZNN locked; revoking destroys the Pillar slot permanently!).
  2. StakeContract (internal/vm/contracts/stake/stake.go): Time-locked ZNN stakes (1 to 12 months) can only be cancelled after expirationTime by the original Address.
  3. SentinelContract (5,000 ZNN + 50,000 QSR): Bound to the registering Address.
  4. LiquidityContract & Governance (SporkAddress, BridgeInfo.Administrator): Bound to 0x00 addresses.

AuthRegistryContract Specification​

Deploy AuthRegistryContract (0x01 embedded class address z1qxemdeddedxauthregystryxxxxxxxxxx...) gated by PostQuantumAccountsSpork:

[
{"type":"function","name":"RotateKey","inputs":[
{"name":"algId","type":"uint8"},
{"name":"newPublicKey","type":"bytes"},
{"name":"newKeyPopSignature","type":"bytes"},
{"name":"revokeLegacy","type":"bool"}
]},
{"type":"function","name":"RescueWithPoKoS","inputs":[
{"name":"targetAddress","type":"address"},
{"name":"algId","type":"uint8"},
{"name":"newPublicKey","type":"bytes"},
{"name":"starkProof","type":"bytes"}
]},
{"type":"variable","name":"authRecord","inputs":[
{"name":"algId","type":"uint8"},
{"name":"publicKeyHash","type":"hash"},
{"name":"publicKey","type":"bytes"},
{"name":"legacyRevoked","type":"bool"},
{"name":"updatedHeight","type":"uint64"}
]}
]

Storage Layout Inside AuthRegistryContract ([0x04] Contract State)​

  • Key: [0x01] || userAddr[20] (21 bytes) → ABI-packed authRecord.
  • Proof of Possession (newKeyPopSignature): Prevents a user from bricking their account by accidentally registering a corrupted newPublicKey for which they do not hold the secret key. newKeyPopSignature MUST verify under (algId, newPublicKey) over the 61-byte domain-separated digest: SHA3-256("zenon-auth-rotate:v1" || be_u64(chainId) || sendBlock.Address[20] || be_u64(sendBlock.Height) || [algId]).
  • Immediate Legacy Lockout (revokeLegacy = true): Once AuthRegistryContract executes ReceiveBlock, legacyRevoked becomes true. From the next Momentum onward, accountBlockVerifier.signature rejects Ed25519 (algID = 0x00) on userAddr—even before the Phase 3 network-wide sunset!
  • Zero-Exposure First Tx for Untouched 0x00 Accounts: During Phase 1–2, an untouched 0x00 account (Height = 1) whose first block is a UserSend (or UserReceive followed immediately in the same Momentum by RotateKey) only exposes its Ed25519 key for a single 10-second slot before legacyRevoked = true permanently locks out Shor attacks.

4. Deterministic BIP-39 Key Derivation (Zero New Seed Phrases)​

Zenon wallets (syrius, znn_cli_dart, go-zenon-v1/internal/crypto/slip0010.go) currently derive Ed25519 keys from a 24-word BIP-39 mnemonic (64-byte PBKDF2-HMAC-SHA512 seed) along:

Classical Path: m / 44' / 73404' / <accountIndex>' (HMAC-SHA512 key = "ed25519 seed")

To guarantee strict cryptographic domain separation (so compromising a classical SLIP-0010 child key or chain code leaks zero bits about any post-quantum key, even to an unbounded quantum adversary), post-quantum keys MUST use a dedicated master HMAC domain tag and purpose subtree:

Master Node: HMAC-SHA512(Key = "zenon-pq-slip0010:v1", Data = bip39Seed64)
Derivation: m / 44' / 73404' / 1' / <algId>' / <accountIndex>'
algId' SegmentTarget SchemeSeed Extraction from 32-Byte Leaf SLIP0010Key.Key
1' (0x80000001)ML-DSA-44Pass leaf.Key[0:32] directly to mldsa.NewPrivateKey(mldsa.MLDSA44(), leaf.Key[:])
2' (0x80000002)FN-DSA-512Expand SHAKE256("zenon-fndsa512-keygen:v1" || leaf.Key[:], 64) into deterministic fixed-point FIPS 206 keygen
3' (0x80000003)SLH-DSA-SHAKE-128sExpand SHAKE256("zenon-slhdsa128s-keygen:v1" || leaf.Key[:], 48) → (SK.seed[16], SK.prf[16], PK.seed[16])
UX Win for Syrius Users

Because all three post-quantum tiers derive deterministically from the exact same bip39Seed64, existing Syrius users do not need to write down a new 24-word recovery phrase. Restoring their existing mnemonic in a PQ-upgraded Syrius wallet automatically recovers both their legacy 0x00 accounts and their 0x02 / AuthRegistry-rotated PQ accounts!