BNB CHAIN · LIVE BLOCK #— the chain's current layer: ECDSA · secp256k1 — the layer this vault replaces
MerkleBNB
$MRKL
BNB Chain · Hash-Based Signatures · XMSS

Post-Quantum
by Construction.

MerkleBNB is a vault on BNB Chain whose withdrawals are authorized by XMSS hash-based signatures — not by ECDSA. The signature scheme is verified inside the contract, its state is enforced by the contract, and its implementation is byte-for-byte compatible with the reference implementation that defines the standard.

● Contracts in development. Addresses will be published on this page only. · Implementation unaudited — see §06.
Live — XMSS Signing, As It Happens model tree · h = 7 of 10 · real SHA-256 in your browser
SIGNING INDEX—
KEY EPOCH0
TREE ROOT — FOLDED PER SIGNATURE…
COMPUTATION LOG

A scaled model of the vault's key (h = 7: 128 signatures instead of 1,024), signing live in this browser. Each tick spends one index — the leaf lights, its authentication path folds to the root, recomputed with the same thashH the contract runs. When the key is exhausted it rotates to a fresh tree, exactly as the vault requires near index 1,000.

Scheme
XMSS-SHA2_10_256
OID 0x00000001
Standard
RFC 8391
NIST SP 800-208 approved
On-chain verify
2,124,458 gas
≈ 0.000106 BNB @ 0.05 gwei
PQ security
128-bit
post-Grover · SHA-256 only
Signatures / key
1,024
h = 10 · state enforced on-chain
The Two Races

Two Races Against a Quantum Computer

Both panels below run live in your browser. On the left, the attack that ends ECDSA: Shor's algorithm is polynomial, so under a cryptographically relevant quantum computer it always finishes. On the right, the only generic quantum attack on SHA-256 — Grover's — measured on your own hardware, against the full 2¹²⁸ preimage space it would have to search.

Shor vs secp256k1 complexity · polynomial
Elliptic-curve discrete logarithm — the problem every ECDSA account key on this chain rests on.
pub
Running — solving the discrete log… 0%
t = 0.0 s steps ≈ (log N)³ — it does not slow down

Projected scenario: a cryptographically relevant quantum computer runs Shor's algorithm against an exposed public key. The work is polynomial, so the race is not close — the key is recovered, in full, every time. "Harvest now, decrypt later" means the recording of today's keys has already started.

Grover vs SHA-256 complexity · quadratic speedup only
Preimage search — the single problem XMSS security rests on. No structure, no shortcut: only search.
— SHA-256 / second · your browser, hashing now
Hashes computed this visit0
Preimage space to search2¹²⁸
fraction searched ≈ 0 2¹²⁸

At your device's measured rate, finding one preimage takes ≈ — years

The universe is ≈ 1.38 × 10¹⁰ years old. Grover's algorithm only halves the exponent — a 2²⁵⁶ search becomes 2¹²⁸ — it does not make the search finishable, on this hardware or any projected quantum hardware.

The counter above is real: this device is hashing right now, and the bar is honest — it does not move. That immobility is the entire security argument of this vault, demonstrated instead of asserted.

MerkleBNB's vault authorization depends on SHA-256 preimage resistance only. There is no discrete logarithm to recover — on this scheme, the left race has no track to run on.

01

The Problem: Every Key on This Chain Is an Elliptic Curve

ECDSA · secp256k1 · Shor 1994

Every BNB Chain account is authorized by an ECDSA signature over the secp256k1 curve. Its security is the elliptic-curve discrete logarithm problem — a problem that a sufficiently capable quantum computer running Shor's algorithm solves in polynomial time. Once a public key is exposed on-chain (and on an account-model chain, public keys are exposed by use), the corresponding private key is, in principle, recoverable.

The attack does not need to happen in real time. Adversaries can record encrypted traffic and exposed keys today and exploit them when the hardware matures — "harvest now, decrypt later". Long-lived vault assets are exactly the exposure window this attack is built for. The question is not whether the industry migrates; it is whether your assets sit behind a signature scheme that survives the migration deadline.

SHOR'S ALGORITHM

Breaks factoring and discrete logarithms — RSA, ECDSA, Ed25519. It does not apply to hash functions. There is no Shor attack on SHA-256.

GROVER'S ALGORITHM

The best generic quantum attack on a hash: a quadratic speedup. A 256-bit hash keeps 128 bits of security — the design target of the XMSS-SHA2_*_256 parameter sets.

WHY HASH-BASED

XMSS security reduces to the preimage resistance of SHA-256 — the same primitive that secures Bitcoin addresses and proof-of-work, with decades of cryptanalysis behind it. No lattices, no codes, no isogenies: no structured assumption to collapse.

WHY STATEFUL

The stateless alternative (SLH-DSA, FIPS 205) needs 7,856+ byte signatures and tens of thousands of hashes per verification — impractical in the EVM today. XMSS is compact, and its one weakness — state — is precisely what a smart contract can enforce. See §03.

02

The Scheme: XMSS-SHA2_10_256

RFC 8391 §5.1 · OID 0x00000001

One XMSS key is a binary Merkle tree of height 10 over 1,024 WOTS+ one-time keys. Each WOTS+ public key is compressed by an L-tree into one leaf; the tree's single 32-byte root — together with a public seed — is the public key. A signature reveals one one-time signature plus the 10 sibling hashes that reconnect its leaf to the root. Verification recomputes the root and compares. Nothing else is trusted.

ParameterSymbol ValueNote
Hash output lengthn32 bytesSHA-256 (FIPS 180-4), via EVM precompile 0x02
Winternitz parameterw16Each chain has positions 0..15
Message digitslen164ceil(8n / log2 w)
Checksum digitslen23floor(log2(len1·(w−1)) / log2 w) + 1
WOTS+ chainslen67len1 + len2
Merkle tree heighth102^10 = 1,024 one-time keys
WOTS+ signaturelen·n2,144 bytes67 chain values
Authentication pathh·n320 bytesOne sibling hash per level
Full signature—2,500 bytesidx(4) ‖ R(32) ‖ WOTS+ sig(2,144) ‖ auth(320)
Public key—64 bytesroot(32) ‖ PUB_SEED(32)
Interactive — Authentication Path Explorer structural model · h = 4 of 10

How to read this

A scaled model of the production tree (h = 4, 16 leaves instead of 1,024). Node hashes are computed live in your browser with the genuine RFC 8391 tree-hash (thashH with hashtree addresses). Click any leaf: the page derives its authentication path — the sibling hash at every level — and folds it back to the root.

Selected leaf

—

Authentication path (siblings)

Click a leaf node (L0) below… in the diagram.

Reconstructed root

ROOT
—

Leaf values in this model are stand-in hashes of their labels; in production a leaf is the L-tree root of a WOTS+ public key (§02 table). Node hashing, addressing and the path fold are the real algorithm. At h = 10 the path is 10 siblings = 320 bytes.

Signature Anatomy — 2,500 Bytes canonical encoding · RFC 8391
idx
4 B
R
32 B
WOTS+ SIGNATURE
2,144 B · 67 × 32
AUTH PATH
320 B · 10 × 32

On-chain, the contract takes index and auth path as separate arguments and wotsSig = R ‖ WOTS+ sig (2,176 B); the byte content is identical to the canonical encoding.

WOTS+ — 67 Hash Chains schematic · w = 16 · 15 steps per chain
chain — · position —/15

Schematic — heights are illustrative, not computed from a real digest. Each column is one WOTS+ chain; a signature reveals one position per chain, set by a base-16 digit of the message digest (64 message digits + 3 checksum digits). Verification completes every chain to position 15, then folds the 67 tops through the L-tree.

03

The Vault: State Enforced by the Contract

PQVaultV2 · nextIndex

A stateful scheme is only as safe as its counter. WOTS+ key reuse is catastrophic — sign two messages at one index and an attacker can forge — and counters are exactly what client software gets wrong (backups, restores, parallel devices). PQVaultV2 therefore makes the contract the state authority: it stores nextIndex, accepts a withdrawal only at index == nextIndex, and increments the counter in the same transaction, before any transfer. Reuse and index-skipping are not discouraged; they are impossible on-chain.

The same discipline covers every path that can move funds or change keys. An early draft let the wallet's ECDSA key rotate the XMSS key on its own — a backdoor that would have voided the entire post-quantum claim, found in review and closed. Today, rotation itself requires an XMSS signature under the current key. The withdrawal digest binds chain ID, vault, user, token, recipient, amount and index, so a signature cannot be replayed across chains, contracts, tokens or amounts.

AUTHORIZATION MATRIX

ActionAuthorized byEffect / rule
withdrawXMSS signature (consumes nextIndex)The only path that moves funds. Index must equal nextIndex.
rotateVaultXMSS signature under the current keyInstalls a fresh key, resets the counter, clears any pending recovery. A previously used root can never be re-activated.
cancelRecoveryXMSS signature under the current keyVetoes a pending recovery at any time inside the 30-day window.
initiateRecoveryECDSANo immediate effect. Registers a pending root and starts a public 30-day timelock — the seed-loss path.
finalizeRecoveryECDSA + timelock expiredInstalls only a root that sat publicly pending for the full 30 days, unvetoed.
registerVaultECDSAInitial binding, before any funds depend on the root. Binds a root to the caller's own address only.
depositECDSACan only add funds to the caller's own balance. Cannot endanger existing funds.
State Machine — nextIndexPQVaultV2
UNREGISTERED no root bound ACTIVE nextIndex = 0 ACTIVE nextIndex = k RECOVERY PENDING readyAt = now + 30d registerVault · ECDSA withdraw · XMSS @ 0 withdraw / rotate / cancel · XMSS @ k → k+1 initiateRecovery · ECDSA finalize · t ≥ readyAt cancelRecovery · XMSS veto

Any call with index ≠ nextIndex, an invalid XMSS signature, or a previously used root reverts. A key holds 1,024 indices; operational guidance is to rotate near index 1,000. Withdrawal recipients are bound by the signature and may be addresses that have never appeared on-chain — the authorization step exposes no ECDSA public key.

MEASURED GAS — HARDHAT, BSC PROFILE

OperationGas@ 0.05 gwei
XmssSha256.verify()2,124,458≈ 0.000106 BNB
PQVaultV2.withdraw()2,576,477≈ 0.000129 BNB
PQVaultV2.rotateVault()2,388,207≈ 0.000119 BNB
PQVaultV2.cancelRecovery()2,427,046≈ 0.000121 BNB
PQVaultV2.initiateRecovery()97,599≈ 0.0000049 BNB
PQVaultV2.finalizeRecovery()62,491≈ 0.0000031 BNB

Gas usage is rate-independent; 0.05 gwei is the observed BSC rate as of Dec 2026, not a guarantee. Verification cost ≈ 500 chain steps + 66 L-tree hashes + 10 path hashes, ≈ 1,800 SHA-256 precompile calls.

04

Evidence: Checked Against the Reference Implementation

xmss-reference @ 171ccbd

A signature scheme you implement yourself is a claim, not evidence. The strongest public evidence available is interoperability with the authors' own code: our test vectors are the full bytes exported by the unmodified XMSS reference implementation, fingerprinted against its stock test program's output. Our signer reproduces its public key and its signatures at indices 0, 1 and 512 byte-for-byte, and the reference implementation's signatures verify inside our Solidity contract. Below, the same check runs in your browser.

Verify It Yourself — Reference Vector, Index 512runs locally · WebCrypto SHA-256
Source github.com/XMSS/xmss-reference Commit 171ccbd26f098542a67eb5d2b128281c80bd71a6 Procedure Reference test/vectors.c deterministic seed (seed[i] = i), full bytes exported unmodified Index / Message 512 / {37} = 0x25 XMSS root 9d898033e37af48e6a116f8b15651cc26773467007ad19375d38c23c690c3483 PUB_SEED 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f SHAKE128 fingerprints (10 B) pk 7de72d192121f414d4bb · sig@512 8b6cb278d50a3694ca38

This panel carries a verification-only port of the same algorithm (WOTS_pkFromSig → L-tree → root reconstruction, RFC 8391 Algorithms 6, 8, 13). Press the button: your browser recomputes the root implied by the reference signature and compares it against the reference root. No server is involved; view source and check the math yourself.

Idle. The full signature (2,500 bytes) is embedded in this page.
Cross-checkMethodResult
JS keygen vs reference public keyscripts/check-vectors.jsByte-for-byte identical
JS signatures @ idx 0 / 1 / 512 vs referencescripts/check-vectors.jsByte-for-byte identical (3/3)
Solidity verify accepts reference signaturestest/xmss-vectors.test.js3/3
Python (hashlib) third implementation: chains, digits, leafscripts/python-crosscheck-xmss.jsThree-way agreement (JS · Solidity · Python)
Tamper rejection (message / index / auth / signature element / truncation)test suiteAll rejected
Vault state machine + authorization modeltest/pqvault2.test.js16/16
Full test suitenpx hardhat test29/29

Note: NIST SP 800-208 publishes no official known-answer tests. These vectors are the reference implementation's own test system — which is precisely why matching them is meaningful: it is the same code the standard's authors ship.

05

Landscape: Three Ways to Sign After Quantum

FIPS 204 · FIPS 205 · RFC 8391
Property ECDSA · secp256k1 ML-DSA-44 · FIPS 204 XMSS-SHA2_10_256 · RFC 8391
Hardness assumptionElliptic-curve discrete logModule-LWE / Module-SIS (structured lattices)SHA-256 preimage resistance only
Signature size65 B2,420 B2,500 B
Public key size33 B1,312 B64 B
StatefulNoNoYes — enforced by the vault contract
Shor's algorithmBreaks itResistant (by design)Not applicable
Grover's algorithmNot applicableResistant (by design)128-bit security remains
Status on BNB ChainCurrent default — the thing being replacedBEP-736 precompile proposed; testnet targeted in 4–8 weeksThis project: application-layer verification, working today, no protocol change required

BNB Chain's BEP-713 roadmap (3 Dec 2026) migrates the protocol itself in four phases; its BEP-736 draft proposes native precompiles for ML-DSA-44 and the stateless hash-based SLH-DSA-SHA2-128s. MerkleBNB operates one layer up: the vault's authorization is post-quantum now, independent of the protocol timeline — and a future precompile would only make the same verification cheaper.

TIMELINE

1979

Merkle invents hash-based signatures

Ralph Merkle's dissertation introduces one-time signatures, the Merkle tree, and the construction this project is named after — 47 years of cryptanalysis and counting.

2018-05

RFC 8391 standardizes XMSS

The IETF publishes XMSS as an RFC; the SHA2 parameter sets are marked mandatory for deployment.

2020-10

NIST SP 800-208 approves stateful hash-based signatures

NIST approves XMSS and LMS for use in US federal systems, with state management as the central operational requirement.

2024-08

FIPS 203 / 204 / 205 finalize the PQC standards

ML-KEM, ML-DSA and SLH-DSA become federal standards. Hash-based signatures are standardized in both stateful (SP 800-208) and stateless (FIPS 205) forms.

2026-12-02

NSA advisory urges accelerated PQC migration

US agencies urge operators of national-security systems to speed the move to post-quantum cryptography, following disclosed AI-assisted advances against classical schemes.

2026-12-03

BNB Chain publishes its post-quantum roadmap

BEP-713 sets out a four-phase migration of BSC accounts and consensus; BEP-736 proposes signature-verification precompiles, testnet targeted within 4–8 weeks.

2026-12

MerkleBNB: an XMSS vault on BNB Chain

A working, vector-verified XMSS implementation and a state-enforcing vault, in development on the application layer — the layer users can actually choose today.

06

Scope, Boundaries, Documents

TECHNICAL.md §8
Document — TECHNICAL.mdspecification & verification report

The full technical brief: scheme identification, parameter set, security analysis (including the rotation threat model and the hole it closed), the SHA-256 vs Keccak decision record, test-vector provenance and cross-check results, gas benchmarks, the contract state machine, limitations, and reproduction commands. Every number on this page traces to it.

§1 Scheme identification
§2 Parameter set XMSS-SHA2_10_256 · hash-family instantiation · RFC algorithm map
§3 Security analysis · state risk · rotation & recovery threat model
§4 SHA-256 vs Keccak-256: decision record
§5 Test vectors: provenance & cross-check results
§6 Gas benchmarks (BSC profile)
§7 Contract state machine
§8 Limitations
§9 Reproduction commands
§10 References — RFC 8391 · SP 800-208 · FIPS 180-4 / 204 / 205
Contract Excerpt — XmssSha256.solSolidity · RFC 8391 Alg. 13/14
// XMSS_rootFromSig (Algorithm 13), tree fold bytes32 node = leaf; for (uint256 k = 0; k < TREE_HEIGHT; ++k) { bytes32 authNode; assembly { authNode := mload(add(add(authPath, 0x20), mul(k, 0x20))) } uint256 adrs = _hashtreeAdrs(k, index >> (k + 1)); if (((index >> k) & 1) == 1) { node = _thashH(authNode, node, pubSeed, adrs); } else { node = _thashH(node, authNode, pubSeed, adrs); } } return node; /// @notice Verifies a full XMSS-SHA2_10_256 signature on-chain (Alg. 14). function verify( bytes32 xmssRoot, bytes32 pubSeed, bytes memory message, uint256 index, bytes calldata wotsSig, bytes calldata authPath ) internal pure returns (bool) { if (index >= LEAF_COUNT) return false; if (wotsSig.length != SIG_BYTES || authPath.length != AUTH_BYTES) return false; return rootFromSig(xmssRoot, pubSeed, message, index, wotsSig, authPath) == xmssRoot; }