Signature schemeAll pages

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

ParameterValueMeaning
w16Each chain encodes one hex digit
n32 bytesHash output and chain value size
Message chains64One per hex digit of a 32-byte digest
Checksum chains3Three hex digits of checksum
Total chains67
Steps per chain15From the secret value to the public value
Signature2,144 bytes67 × 32

Keys

Everything derives from a 32-byte seed, the account address and a key index.

notation
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.

notation
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.

notation
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:

notation
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.

Never sign two messages with one key.

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

MeasureValue
Signature in a user operation2,176 bytes with the next key hash
Hashes to verifyAt most 1,005 chain steps plus one final hash
Verify gas, typical digestAbout 89k
Verify gas, worst caseAbout 154k
validateUserOp after the flipAbout 103k, including rotation
Key generation1,005 hashes per key, in the browser

Gas figures are measured in Foundry with forge test -vv.