Docs · Cryptography
Signature scheme
The backup key is a Winternitz one-time signature (WOTS+) built on keccak256. Its security rests on the hash function alone.
Why hash-based
Quantum computers break the algebra behind elliptic curves. They do not break hash functions in the same way: the best known attack only halves the effective strength, which leaves 256-bit hashes with a wide margin. A signature that relies on nothing except hashing is the most conservative post-quantum choice, and keccak256 is the one hash every EVM chain runs cheaply.
The trade is that each key can sign only once. The Vault validator handles that by rotating to a new key with every signature.
Parameters
| Parameter | Value | Meaning |
|---|---|---|
w | 16 | Each chain encodes one hex digit |
n | 32 bytes | Hash output and chain value size |
| Message chains | 64 | One per hex digit of a 32-byte digest |
| Checksum chains | 3 | Three hex digits of checksum |
| Total chains | 67 | |
| Steps per chain | 15 | From the secret value to the public value |
| Signature | 2,144 bytes | 67 × 32 |
Keys
Everything derives from a 32-byte seed, the account address and a key index.
T = keccak256(account ‖ uint256 keyIndex) tweak, 32 bytes
sk[i] = keccak256(seed ‖ T ‖ uint8 i) secret start of chain i
F(v) = keccak256(T ‖ uint8 i ‖ uint8 j ‖ v) step j of chain i
pk[i] = F applied 15 times to sk[i], j = 0 .. 14
pkHash = keccak256(pk[0] ‖ pk[1] ‖ … ‖ pk[66])
Only pkHash goes onchain. The tweak ties every hash to one account and one key index, and each step also mixes in the chain number and step number. A value from one position can never be reused at another, on this account or any other.
Signing
Split the 32-byte message into 64 hex digits, most significant first, and append the three checksum digits. For chain i with digit d, the signature value is the secret start advanced d steps.
sig[i] = F applied d[i] times to sk[i], j = 0 .. d[i] - 1
Verifying
The verifier finishes each chain and hashes the results. It never sees a public key, only its hash.
pk'[i] = F applied (15 - d[i]) times to sig[i], j = d[i] .. 14
valid = keccak256(pk'[0] ‖ … ‖ pk'[66]) == pkHash
The Solidity verifier is in contracts/src/lib/WOTSPlus.sol. It and the TypeScript signer are checked against the same vector file, so the two cannot drift apart unnoticed.
The checksum
Anyone holding a signature can hash a chain value forward, which would turn a digit into a larger one. The checksum stops that. It is the sum of 15 − d over the 64 message digits, at most 960, written as three hex digits. Raising any message digit lowers the checksum, and lowering a checksum digit would mean running a hash backwards.
Rotation
The message a Vault account signs is not the user operation hash alone:
message = keccak256(userOpHash ‖ nextPkHash)
nextPkHash is the public key hash for keyIndex + 1, derived from the same seed. Each signature authorises one operation and names its successor, so the account moves down a chain of keys and never checks one twice.
Two signatures under the same key reveal chain values at two sets of positions. Together they can be enough to sign a third message. The key index is the guard: read it from the chain before every signature.
Size and cost
| Measure | Value |
|---|---|
| Signature in a user operation | 2,176 bytes with the next key hash |
| Hashes to verify | At most 1,005 chain steps plus one final hash |
| Verify gas, typical digest | About 89k |
| Verify gas, worst case | About 154k |
validateUserOp after the flip | About 103k, including rotation |
| Key generation | 1,005 hashes per key, in the browser |
Gas figures are measured in Foundry with forge test -vv.