Cryptography
QVAULT uses its own Winternitz one-time signature (WOTS) over SHA-256. It is a hash-based signature: its security rests only on properties of SHA-256, so Shor's algorithm has nothing to attack and Grover's algorithm only square-roots a brute-force search. The scheme belongs to the same family as NIST SP 800-208 (LMS, XMSS) and the Winternitz chains inside FIPS 205 (SLH-DSA). QVAULT is not NIST-certified or FIPS-validated, and it is not audited.
Parameters#
| Parameter | Value |
|---|---|
| Hash | SHA-256 (sol_sha256 syscall on-chain, @noble/hashes in the browser) |
| Chain value size n | 24 bytes (SHA-256 truncated, 192 bits) |
| Winternitz parameter w | 256: one digit per byte, chain length 255 |
| Message digits | 24 (the first 24 bytes of SHA-256 of the message) |
| Checksum digits | 2 |
| Chains | 26 |
| Signature | 26 × 24 = 624 bytes |
| Public key | 26 × 24 = 624 bytes (never stored on-chain) |
| Vault hash | 32 bytes, full SHA-256 of the public key |
| Uses per key | exactly one signature |
Hash-based signatures in one paragraph#
Each of the 26 chains starts at a secret value and is hashed 255 times. The end of each chain is public. To sign a digit d, reveal the value d steps along its chain. A verifier hashes it the remaining 255 − d steps and must arrive at the public end. Going backwards along a chain would require inverting SHA-256. Each revealed value exposes every later point on its chain, which is why a key must never sign twice.
Chain function#
Every step of every chain hashes a position tweak along with the value, so values from different chains or steps can never be swapped for each other:
F(i, j, x) = SHA-256( "QVF" ‖ 0x01 ‖ i ‖ j ‖ x )[0..24]
"QVF" ‖ 0x01 4 bytes domain prefix 0x51 0x56 0x46 0x01
i 1 byte chain index, 0..25
j 1 byte step index, 0..254
x 24 bytes current chain value| Value | Definition |
|---|---|
| public chain end | pk_i = F^255(sk_i), steps j = 0 … 254 |
| signature value | sig_i = F^(d_i)(sk_i), steps j = 0 … d_i − 1 |
| verification | continue from sig_i at step j = d_i for 255 − d_i steps; the result must equal pk_i |
Key derivation#
# 64 bytes, PBKDF2-HMAC-SHA512
seed = BIP39(phrase, passphrase = "")
sk[n][i] = HMAC-SHA512( key = seed,
data = "qvault/wots/v1" ‖ u32be(n) ‖ u8(i) )[0..24]
n vault index in the chain (0, 1, 2, ...)
i chain index (0..25)- The phrase is 24 English BIP39 words (256 bits of entropy) generated with the browser's cryptographic random number generator. It is a dedicated QVAULT phrase, never a wallet seed, and the BIP39 passphrase is always empty.
- Each vault index gives an independent one-time key.
- Deriving one vault's public key costs 26 × 255 = 6,630 hashes, about 10–20 ms in a browser.
Domain tags#
| Tag | Bytes | Used in |
|---|---|---|
QVF 0x01 |
4 | chain function F |
qvault/wots/v1 |
14 | secret-key derivation |
QVAULT/root/v1 |
14 | vault hash |
QVAULT/spend/v1 |
15 | signed spend message |
vault |
5 | PDA seed |
Message digits and the checksum#
h = SHA-256(message)
d_0..23 = h[0..24] 24 message digits, each 0..255
C = Σ (255 − d_i) for i = 0..23 0 ≤ C ≤ 6,120
d_24 = C >> 8 checksum, big-endian u16
d_25 = C & 0xffWhy the checksum is required#
Anyone who sees a signature can hash a revealed value further along its chain. Without a checksum, one public
signature on digits d_i therefore lets anyone produce a valid signature for any other message whose digits are
all ≥ d_i. For short digit vectors such a message can be found by trying candidate messages. With w = 256 and 24
digits it is far from free, but it is not a 2^192 problem. Since a withdrawal signature becomes public as soon as
it is broadcast, a scheme without a checksum is not safe for a vault.
The checksum closes this. Raising any message digit lowers C, so at least one checksum digit would have to go down. That would mean walking a chain backwards, which requires a SHA-256 preimage. This is standard Winternitz construction and part of every WOTS variant in the standards. QVAULT's tests include a property test that forward forgeries fail.
Vault hash and address#
pk = pk_0 ‖ pk_1 ‖ … ‖ pk_25 624 bytes
vault_hash = SHA-256( "QVAULT/root/v1" ‖ pk ) 32 bytes
vault = PDA( ["vault", vault_hash], program_id ) canonical bumpOnly the 32-byte vault hash is stored on-chain. To verify, the program recomputes every chain end from the signature, hashes them into a root, and requires the root to equal the stored vault hash.
Signed message layout#
Every spend signs exactly 184 bytes:
| Offset | Size | Field | Notes |
|---|---|---|---|
| 0 | 15 | "QVAULT/spend/v1" |
domain tag, ASCII |
| 15 | 32 | program id | binds the signature to this deployment |
| 47 | 32 | vault hash | the vault being spent |
| 79 | 1 | action | 1 WithdrawSol, 2 WithdrawToken, 3 Close |
| 80 | 8 | amount | u64 little-endian; lamports or token base units; 0 for Close |
| 88 | 32 | recipient | wallet address receiving funds |
| 120 | 32 | mint | the one bound token mint, or 32 zero bytes for none |
| 152 | 32 | next vault hash | where the rest rolls, or 32 zero bytes for Close |
The program does not receive this message. It rebuilds it from the instruction data and the accounts it was given, then verifies the signature against it. Changing any field, such as the amount, the recipient, the mint, the next vault, the action or the program, invalidates the signature.
Security level#
| Attack | Classical work | Quantum work (Grover) |
|---|---|---|
| Forge a signature: invert a 192-bit chain value, or find a second preimage of the 192-bit message digest | about 2^192 | about 2^96 |
| Find a preimage of the 256-bit vault hash | about 2^256 | about 2^128 |
Notes:
- Multi-target. An attacker attacking T published chain values at once gains up to log2(T) bits. The chain function binds the chain and step position but has no per-key public seed, because one would not fit the transaction size budget. Even with 2^30 targets, forging still takes about 2^162 classical or 2^81 quantum work.
- Collisions. A collision in the 192-bit message digest (about 2^96 classical work) would matter only if an attacker could get you to sign a message of their choosing. In QVAULT the signer composes every field, so this does not apply.
- Grover's cost counts hash evaluations inside a quantum circuit. Those are far more expensive than classical hashes, so the quantum figures are conservative from the defender's side.
- For comparison, NIST's SLH-DSA uses the same 24-byte hash output at its category-3 parameter sets.
Verification cost#
The verifier runs Σ (255 − d_i) hash steps over all 26 digits. That is 0 to 6,630 steps; over random messages the average is about 3,430. Each step costs about 131 compute units on-chain, so a typical spend uses about 450k–640k compute units including the fixed cost, well under Solana's 1.4M per-transaction limit. Once signed, the message is fixed, so nobody can grind it to raise the cost.
Size comparison#
| Scheme | Family | Public key | Signature | Reuse | Status |
|---|---|---|---|---|---|
| Ed25519 | elliptic curve | 32 B | 64 B | many | broken by Shor on a CRQC |
| QVAULT WOTS | hash-based | 32 B on-chain (hash of 624 B) | 624 B | one-time | custom, not audited |
| Falcon-512 (FN-DSA) | lattice | 897 B | about 666 B | many | being standardised by NIST as FN-DSA |
| ML-DSA-44 | lattice | 1,312 B | 2,420 B | many | FIPS 204 [S10] |
| SLH-DSA-128s | hash-based | 32 B | 7,856 B | many (stateless) | FIPS 205 [S11] |
Lattice schemes are compact and reusable but rest on newer assumptions. Hash-based schemes rest on the oldest, best-studied assumption, and they pay for that with either one-time keys (WOTS), state (LMS, XMSS) or large signatures (SLH-DSA). QVAULT's chain of vaults is what makes one-time keys usable: a 624-byte signature fits in one legacy Solana transaction of up to 1,232 bytes. Source keys refer to the sources table.