Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hardware wallets

A hardware wallet can use either authorization method of this section on its own: the hash preimage as a Kishu leaf of the transaction’s proof, or a leanSPHINCS signature that the host verifies in its transaction. This page asks what the wallet has to compute and transfer for each, and what a channel allows. It was written for ZIP 2005’s Recovery Statement [ZIP-2005], whose Option A keeps on a hardware wallet and has the networked host prove the rest (Recovery from Ironwood). It takes the device split from an analysis of FROST members recovering from a seed phrase. The costs are the same for a native Zoodles spend. The figures come from the PCS frontier page, which prices the wallet’s part as applications of its transaction measure.

The device split

The model to reason in makes the hardware wallets the only honest parties and treats every networked device as the adversary. A wallet holds the spending key , or with FROST its signing share and the common , and so . It exports and and nothing else that is derived from the secret. is derived from and exported by a single-signer wallet; with FROST it is the output of the distributed key generation. and the incoming and outgoing viewing keys follow from those, so the host can scan, build transactions and produce the main Recovery proof, whose witness is viewing-key material plus the note and its path. ZIP 2005’s other path, , has the Recovery Statement prove the key derivations from itself. The priced circuit takes either value; this page follows the path, the one whose costs a hardware wallet is meant to optimize.

The wallet signs FROST shares and makes , each after verifying the transaction and asking the user, and the user’s confirmation is the adversary’s choice of message. Two adversary classes share one win condition: a consensus-valid recovery spend on an unapproved SigHash.

  • A pre-quantum adversary corrupts up to wallets. It is bounded by the unforgeability of re-randomized FROST.
  • A discrete-log-breaking adversary is given every host’s state and every network message, but no wallet. It is bounded by the unforgeability of as a signature scheme with key . That bound is 1-of-, since every wallet holds the same .

Option A is the statement that the second class learns nothing from a wallet but its interface’s outputs.

What the wallet can prove

Two shapes are priced. The wallet can prove the preimage statement as a leaf of the transaction’s own proof system, Kishu on the frontier page: one BLAKE3 compression, 11,344 committed digits, with the linking commitment of ZIP 2005’s hardware-wallet section left out for now. Or the wallet can sign with leanSPHINCS and leave the verification to the host, which proves the verifier inside its own transaction with the signature and the public key as witnesses, so the spends stay unlinkable.

A Kishu leaf

The handoff is the whole question. The host folds the wallet’s leaf into the transaction’s accumulator, and split accumulation needs the witness of whatever it folds. So the wallet hands over a masked witness: the response of the zero-knowledge note (the zk note), a Gaussian mask added to the leaf’s digits under a challenge . Rejection sampling makes the accepted independent of the secret. The mask covers the leaf’s  digits alone, since the wallet hands over no accumulator of its own. The transaction measure charges the user’s handoff the host’s merge that folds the leaf, and a small merge of the handoff’s own: the challenge derivation, the commitment identity, and the fold of the evaluation claims. The decomposition and the range and norm proofs are deferred to the host (the zk note’s §5.8). For a one-compression leaf the host’s merge is most of the cost. The measure’s 0.0131 s in a step of  digits is 81.7 percent merge and 17.4 percent fold, and the circuit itself is 0.974 percent.

The wallet need not prove that fold. The zk note’s §4.2 lists the handoff merge’s witness as simulatable: the hiding commitment, the mask’s commitment, the challenge, the evaluation claims, and the obligation transcripts. So the host can derive the challenge, prove the fold’s merge and the obligations (the zk note’s §5.8 deferral), and verify the leaf’s sum-checks in its own merge. The wallet keeps what touches the secret. It commits to the leaf under the matrix that binds the masked response , whose coordinates are larger than the leaf’s digits. It appends uniformly random bits to the leaf’s bits. The commitment hides the leaf only if there are enough of them: 4,800 bits at the 147-bit floor, for a computational argument that is given below. It proves its constraint and Booleanity sum-checks under Libra-style masking polynomials, since the host sees their transcripts: 120 committed elements of , the polynomials’ coefficients.

So the vector that the wallet commits has three parts: the leaf’s bits, which are the circuit’s witness; the padding’s bits; and the digits of the masking coefficients. The last two are the zero-knowledge layer’s own randomness. The range check is a statement about the circuit’s witness, and no claim of it covers the coefficients’ digits. Soundness needs only that the committed digits determine each coefficient. They do, because the commitment is binding by the norm check on the masked response, whatever the digits are. The digits’ size matters to the wallet alone. The mask’s width is set for the honest vector’s norm, and the rejection sampling hides a vector of at most that norm, so a wallet whose vector was larger would only weaken its own zero knowledge.

The coefficients’ digit set is therefore chosen for the vector’s norm and length alone. A base’s digits are the consecutive integers nearest zero, and a coefficient is written as its representative of least absolute value.

The mask’s width is set for a bound on the honest vector’s norm. The leaf’s bits are the witness, and the bound takes them at their worst case, a one in every bit. The padding and the coefficients are the wallet’s to sample. So the bound takes their squared norm at a value that it exceeds with probability at most , by a Chernoff bound from the exact distribution of a coefficient’s digits. The wallet checks that its randomness is within the bound, but if it is not, this should be reported as a likely implementation error rather than resampling. In any case, this adds a term of less than to the statistical error of the zero-knowledge argument, as the cut at in the zk note’s §3.2 does.

The base is chosen for the response’s size. Each coefficient is written in the base that gives the least response among those that keep the vector’s matrix at the padding sweep’s rows: 28 digits in base 5, from to 2, at both floors. It samples and commits the mask in idle time, and computes the response with the rejection test.

The padding is computational rather than the zk note’s leftover-hash one. for of 4,800 uniform bits at the 147-bit floor, the page’s default, or 4,400 at 128, is pseudorandom if knapsack-LWE is hard at the commitment’s rows. By the Micciancio–Mol duality that is LWE of the padding’s bits less the rows, with the rows as samples and binary secret and error at the 64-bit modulus (the zk note’s §5.10 gives the argument). The lattice estimator puts the cheapest attack on the padding at the matrix’s 1,024 rows at 149 and 128 quantum bits at the two floors’ paddings, under the page’s cost model, a dual hybrid attack on the binary secret. The primal attacks are a hundred bits dearer, so a primal estimate alone would overstate the margin. The padding is the least on the sweep’s grid, 50 bits where the floors are crossed, that reaches the floor, so the hedge of the 147-bit floor applies to it too. At the zk note’s 1,385 rows 5,000 bits give 140 bits, and at 2,048 rows they would fall short of the 128-bit floor. The frontier page’s 165-bit level is in that case: the wallet’s matrix there has 2,048 rows at every digit width, so its padding comes from a sweep at those rows. It is 768 bytes, 6,144 bits, where the cheapest attack is at 165.9 quantum bits. The least whole number of bytes that reaches the level is 767, and 768 is taken as the rounder figure. The statistical padding would be 66 thousand bits, 5.8 times the statement.

The paddings at the three floors: the wallet’s matrix’s rows, the padding, the work of the cheapest attack on it under the quantum cost model, and the handoff that results, the wallet’s masked response:

FloorMatrix rowsPaddingCheapest attackHandoff
128 bits1,0244,400 bits
(550 bytes)
50.1 kbytes
147 bits, the default1,0244,800 bits
(600 bytes)
51.2 kbytes
165 bits2,0486,144 bits
(768 bytes)
55.4 kbytes

So the wallet commits 19,504 digits. That is 0.199 ms of online work on one M4 core, 9 percent of the handoff fold that the measure charges the user, with 0.276 ms in idle time, and a response of 51 kbytes at 21 bits a coordinate. No merge circuit and no accumulator sit on the device, and the witness is 3.0 kbytes packed.

That amount of prover work, apart from being quoted for a much more powerful device than a typical hardware wallet, is for a prover with memory to spare. A hardware wallet does not have that. So the wallet’s memory comes first below, then the transfer of its response, and then its times on three devices, in the memory that each has.

The wallet’s memory

This count is an estimate from the protocol’s shape, not from an implementation.

What the wallet holdsSize
the mask, which the response overwrites51 kbytes
the witness, packed3.0 kbytes
its two commitments while they are accumulated16.4 kbytes
working buffers for the matrix products24.6 kbytes
the sum-checks’ tables, in a prover with memory to spare786 kbytes

The commitments are a 64-bit coefficient for each of the matrix’s rows, and the buffers are taken as three vectors of that size. The tables are the largest part. The wallet’s two sum-checks run over the vector’s padded length, 15 rounds each, and a prover with memory to spare keeps 3 tables of half that length after its first round, with an element of the extension in each entry. Without the tables the wallet needs 95 kbytes, and with them 882 kbytes.

A device with less memory streams the sum-checks’ first rounds. A streamed round keeps no table and recomputes its sums in one pass over the whole vector, and the prover switches to tables at the first round whose tables fit. Each streamed round costs a pass, where a round with tables costs half of the round before it.

A device that cannot hold even the mask keeps only a seed for it. The mask is the output of a pseudorandom generator on the seed, and the device expands the seed three times:

  1. In idle time it expands the seed and commits to the mask as its coordinates are produced. It keeps the seed and the commitment.
  2. Once the challenge is known, it expands the seed again and runs the rejection test over the response’s coordinates, keeping none of them. No part of the response may leave the device before the test passes.
  3. If the test passes, it expands the seed a third time and writes the response out to the host, a coordinate at a time.

If the test fails, the device discards the seed and starts again with a fresh one, as it would with a stored mask. So a mask from a seed costs two sampling passes more than a stored one.

Over an animated QR code

An airgapped wallet of the Keystone kind exchanges data by animated QR codes, fountain-coded fragments read by a phone camera from the wallet’s screen. Keystone’s firmware sends fragments of 200 bytes at 5 frames a second, 1 kbyte a second. So the response takes 51 s with no frame missed, and the fountain code’s redundancy after missed frames can double or treble that. Denser codes would cut it: a fragment of 800 bytes at the same rate gives 13 s, and the format’s ceiling, a version-40 symbol holding about 2,100 bytes of fragment, 4.9 s. Whether a camera reads the denser codes reliably depends on the screen, the light, and the camera, and gets worse toward the ceiling. So the transfer is slow at today’s settings and within reach with denser codes on some devices.

The response cannot be made much smaller, and the reason is not an encoding choice. The accepted is a Gaussian of width on every coordinate of the leaf, about  bits of information each. It is secret-dependent, so it cannot be regenerated from a seed as the mask can. With no padding and no masking elements the leaf’s own 11,344 coordinates still make 30 kbytes. A succinct Kishu proof of the leaf in place of the response would be about 72 kbytes, whatever the step rank from 14 up, since nearly all of it is the opening’s fixed parts, the compression levels and the terminal. A narrower mask saves two or three bits a coordinate at the price of idle-time attempts, and a lighter challenge set a fraction of a bit. The transfer cannot be avoided by moving the fold elsewhere: split accumulation needs the host to hold a witness of the wallet’s accumulator, and that witness is . A wallet on today’s QR settings is better served by the signature of the next section.

On three devices

The device rates are assumptions, scaled from the hash rates that [Wam26]’s hardware-wallet benchmark measured on a Ledger Nano S+: 10 million word multiplications a second for an MCU-class device and 3 million for a secure element. Both are a scaling from hashing, not a measurement of 64-bit modular multiplication on these cores.

The Ledger Nano Gen5’s secure element is an ST33K1M5 [Led25], the chip of the Nano S+ that the benchmark measured [LedHW], and a Ledger app runs on the secure element. So the secure-element rate applies to it without a further assumption. ST gives the family’s core as a Cortex-M35P clocked at 63 MHz, with 64 KiB of user RAM [ST33]. The operating system shares that memory, and an app’s part of it was not found, so the table gives the least that the wallet could do with. A Ledger device transfers the response over USB, at the benchmark’s measured 21 kbytes a second, or in 0.88 s with a pipelined transport; its Bluetooth and NFC are not priced here.

The Keystone 3 Pro’s firmware runs on a Megahunt MH1903 microcontroller, and its secure elements hold keys and run no application code [Key3]. The MCU-class rate is taken for it. That is the less certain of the two: the MH1903’s clock is not confirmed here, and its core’s multiplier may be slower than the M35P’s. The MH1903 has 1 MiB of SRAM, and the part that is free for the wallet is an assumption. The Keystone is air-gapped, and transfers the response by its QR codes alone.

The Trezor Safe 3, Safe 5, and Safe 7 run their firmware on STM32U5 microcontrollers, with Cortex-M33 cores [TrzFW], beside a secure element, or two in the Safe 7 [Trz7]. That core is of the same generation as the ST33K1M5’s, and the STM32U5 family is clocked at up to 160 MHz [STU5]. So its rate is taken as the secure element’s scaled by the two clocks, 7.6 million word multiplications a second. Each device’s exact part and its memory are not confirmed here, and the memory free for the wallet is an assumption. They transfer the response over USB, taken at the Ledger’s measured rate; the Safe 7’s Bluetooth is not priced here.

DeviceWallet
memory
Rounds
streamed
Memory usedOnlineIdle timeTransfer of the response
Keystone 3 Pro200 kbytes, assumed3193 kbytes0.081 s0.083 s51 s by
QR code
Trezor Safe 3, 5, or 7200 kbytes, assumed3193 kbytes0.11 s0.11 s2.4 s
over USB
Ledger Nano Gen5 or S+least the
wallet needs
all but
the last
44 kbytes1.2 s0.28 s2.4 s
over USB

In the Keystone’s and the Trezor’s rows the mask is held in memory. In the Ledger’s row it is regenerated from a seed, since the mask alone would take most of that chip’s memory.

Taken together, the Keystone can run the wallet with the mask held and a few rounds streamed. The Ledger devices could run it only with the mask from a seed, and even the least memory is over half of what the chip has. An app does not get most of a chip’s memory, so a Ledger device is likely ruled out as the prover of a Kishu leaf: memory, more than time, is what decides whether a secure element can be the prover. A Ledger device can instead sign with leanSPHINCS, as [Wam26]’s benchmark on the Nano S+ shows, which is the route of A hash-based signature.

So a Kishu signature of knowledge is within reach of a wallet with a few hundred kilobytes of memory, and there the transfer is by far the larger part of it.

The host’s work

The transaction that a wallet’s user makes is the host’s Recovery Statement with the wallet’s leaf folded in. The wallet proves the quantum key’s BLAKE3 compression and the host proves the rest, so the circuit is the recovery circuit’s, whoever proves each part. What the handoff adds for the host is a step of its own, which holds only the merge that takes in the wallet’s leaf with the circuit’s accumulator, and the handoff’s fold beside the fold of the host’s own accumulator. A merge in the circuit’s first step instead would lengthen the step that the mask covers, and costs more.

The frontier page has this as an application. With zero knowledge it takes 0.132 s in Kishu, in 2 steps of  digits. That is 53 percent more than the recovery transaction alone. Most of the difference is the merge, whose sum-checks run over the recovery circuit’s digits: it is 0.0434 s of that, and the handoff’s fold 0.00228 s. The handoff’s fold is taken over a whole step’s digits, as the device statement’s is, which is more than the wallet’s vector. So the figure is an upper estimate.

A hash-based signature

leanSPHINCS fits the QR channel: a signature of 4,276 bytes with the pruned key, 6,332 with the layered forest key, or 7,740 with Ethereum’s provisional set [EIP-8288] [Lit26] is a few seconds of scanning. Its signing is hashing alone, measured on a Nano S+ by [Wam26]’s benchmark. The pruned key’s 16,384 grinding digests per signature take 2.8 s with Keccak on that device and 0.50 s with BLAKE2s; BLAKE3, with seven rounds to BLAKE2s’s ten, was not in the benchmark and should be no slower. The grind is the wallet’s: it is keyed, and the key cannot leave the wallet without revealing which leaves it kept. A full tree can take the host’s help instead. The wallet produces the leaf hashes at key generation, the host builds and stores the tree and supplies the authentication paths, and signing then has no grind.

How much of the tree the signer keeps is a choice. The kept subtree’s height sets the trade between the key’s proved lifetime, its generation, and the grind. For a tree of height 26, with the lifetimes proved at 127 bits and the times on a Nano S+ with BLAKE2s:

Kept subtree’s heightSignatures proved safeKey generationGrinding cost per signature
12, as priced here126,900991,260 compressions
(30 s)
16,384 compressions
(0.50 s)
14480,1003.96 million compressions
(2.0 minutes)
4,096 compressions
(0.13 s)
2026.0 million254 million compressions
(2.2 hours)
64 compressions
(0.0020 s)
26, the full tree1.38 billion16.2 billion compressions
(5.8 days)
none

The signature is the same size, 4,276 bytes, in every row: the verifier cannot tell a pruned key from a full one.

leanSPHINCS is stateless and deterministic, which matters when every member’s wallet holds the same seed: a stateful scheme’s index would be reused across wallets, and the deterministic randomizer makes the members’ signatures identical. The verifier’s cost in the host’s transaction is on the leanSPHINCS page.

References