PostQ
$POSTQ
AppDashboardCanary$POSTQDocs

Keys, leaves and epochs

#Leaves

A key is a Merkle tree with 1,024 leaves. Each leaf is a Winternitz one-time key and signs exactly one message. The vault stores next_leaf and accepts a signature from leaf q only when

next_leaf ≤ q < 1,024

then sets next_leaf = q + 1. Skipping forward is allowed. Leaf 1,023 is kept for a rotation, so a key can always be rotated.

Two different messages signed by one leaf reveal enough of its hash chains to make a forgery practical. Never sign from two devices at the same time.

#The leaf ledger

Before your device sends anything, it writes down the leaf and a hash of the exact message (in browser storage for the app, in a file for the CLI). From then on it refuses to sign anything else with that leaf. If a transaction fails, the app offers to send the identical signature again or moves on to the next leaf.

A failed transaction can still leave a signature readable in a buffer account. Signed messages carry no expiry, so the app treats such a signature as pending: it offers to finish it, and signs something new only if you confirm.

#Epochs

epoch counts rotations. Each epoch has its own key, derived from your words and bound to this vault:

seed64   = BIP-39(24 words)
binding  = options (epoch 0) or vault_id (epoch 1 and later)
okm      = HKDF-SHA256(seed64, salt "HASHVAULT/LMS/v1",
                       info "epoch" ‖ epoch ‖ network ‖ program ‖ binding)
secret   = okm[0..32], identifier = okm[32..48]

Every signature names its epoch, so a signature made under an old key can never be replayed after a rotation.

#When to rotate

  • Leaves run low. The app warns under 16 leaves and offers a rotation with the same words.
  • The words may be exposed. Rotate to 24 new words; from then on only the new words control the vault.
Leaves per key1,024
Signatures per withdrawal1, covering up to 8 actions
Warningunder 16 leaves left
Epochsup to 2³²