Keys
A key is 26 secret 24-byte values and a 16-byte public seed, all derived from one 32-byte master secret and a key index. Each secret is hashed 255 times to get the top of its chain. The public key hash is SHA256("PQS-v1-key" ‖ seed ‖ top₀ … top₂₅), and the vault is the program address with seeds ["vault", keyHash].
step(i, j, x) = SHA256(seed ‖ i ‖ j ‖ x)[0..24]
top_i = step(i,254, … step(i,1, step(i,0, sk_i)))
Message
The signed digest is the first 24 bytes of SHA256("PQS-v1-spend" ‖ programId ‖ vault ‖ amount ‖ destination ‖ nextKeyHash ‖ nonce). Each byte picks how far up its chain to reveal. Two checksum bytes, Σ(255 − dᵢ), stop anyone from pushing a revealed value further up to forge a different message.
The signer tries nonces until the total verification work is at most 3,000 hashes. That keeps every spend inside one transaction's compute budget. It is the one echo of PQSB's signer-side search, and it takes a few milliseconds.
Verification
The program recomputes the digest from the accounts it was given, walks each revealed value the remaining 255 − dᵢ steps with the sol_sha256 syscall, hashes the tops, and checks that the result derives the vault address. The key hash is never sent, so the vault address is the whole check.
Instruction
spend (tag 0)
data: amount u64 | nextKeyHash [32] | nonce u64 | seed [16] | sig [26×24]
accounts: payer (signer) · vault · spent marker · destination · next vault · system
program:
The spend marker is a program-owned account at ["spent", keyHash]. Creating it is part of every spend, so a second spend from the same key fails. Never deposit to a vault after it has been spent: those funds cannot move again.
Security
- Chain values are 192-bit truncated SHA-256: about 192-bit classical and 96-bit quantum preimage resistance under Grover.
- One signature reveals one point per chain. The checksum means no other message can be signed from them.
- The destination, amount and next key are inside the signed message, so a validator or watcher who sees the transaction cannot redirect it.
- The Ed25519 fee payer only pays fees. The upgrade authority on devnet is a normal key. The program is not audited.
Run it
# build the program and run the end-to-end test on a local validator cargo-build-sbf solana-test-validator --bpf-program <PROGRAM_ID> target/deploy/pqs_vault.so PAYER=~/.config/solana/id.json node test/e2e.mjs ok forged signature rejected ok redirected destination rejected ok destination got 0.01 ok change moved to vault1 ok second signature from key 0 rejected ALL PASS
