A proof of concept: reading a handwritten seed on a SeedSigner fork

Changelog
  • The reading engine is published: Haller-1, its weights, training recipe and evaluation (Haller-1 release), and the SeedSigner fork that runs it (haller-project/seedsigner-haller).
  • Risk scale: bar for the fingerprint combined with the 6-letter check code (about 1 in 17 trillion per photo, the code read exactly), explained in the check code section.
  • Check code: new alphabet of 16 capitals (G H J K M N P Q R S T U W X Y Z), example code SJZ GJX. Recommendations: mockup of a seed card variant with FINGERPRINT and CHECK CODE fields below the last word, blank and filled.
  • “How strong is the fingerprint check?” rewritten step by step (problem, idea, check, why a misreading does not pass, demonstration, SeedQR), with a flow diagram of the check and a risk scale; figures moved to the details.
  • Fingerprint check: plain explanation of the probability and the threshold, with the arithmetic of the bound. Fingerprint strength: measured collisions added (birthday pairs, neighbours 1, 2 and 3 words away, look-alike words).
  • Check code section: the sentence on the fingerprint now follows the convention of the page (fingerprint of the words alone, without passphrase).
  • Updated to the production engine 130393e: every reading, image, screen and figure redone (new word detector, fingerprint line read on three crops). Torture photos 07 and 08 added (Verified). New sections: “How strong is the fingerprint check?” and “A proposal: a 6-letter check code”.
  • First published.

This is a proposal, open to discussion. It describes a prototype that runs on a fork of SeedSigner. It is not part of SeedSigner and it is not integrated. Its reading engine, Haller-1, is open source (MIT): weights, training recipe and evaluation in haller-project/haller (Haller-1 release), the SeedSigner fork in haller-project/seedsigner-haller.

The page follows one real photo through the prototype's reading engine. Four small neural networks and deterministic code turn a photo of 12 or 24 handwritten BIP39 words into a seed. When a BIP32 master key fingerprint is written with the words, the prototype also checks the seed against it. Everything runs offline, on a Raspberry Pi Zero.

  1. 1The photoinput
  2. 2The detector finds the writingmodel
  3. 3Lines, numbers and reading ordercode
  4. 4Each word is cut out and normalizedcode
  5. 5The word readers2 models
  6. 6The search for the seedcode
  7. 7The fingerprint checkmodel + code
  8. 8The result and the confidence gaugescreen
  9. 9When it does not verifyexamples
  10. 10Layouts it has readexamples
  11. 11Torture testresults
  12. 12The whole engine at a glancesummary
  13. 13How strong is the fingerprint check?comparison
  14. 14A proposal: a 6-letter check codeproposal
  15. 15Recommendations, if this were integratedproposal
model trained, int16 weights code deterministic
1

The photo

In the prototype, the user photographs the paper with the SeedSigner camera. The photo below was taken with a phone and sent to a public test site; the same engine reads it. It shows a test seed: 12 words in a numbered list, with the BIP32 master key fingerprint of the seed written above.

Photo of a handwritten list of 12 numbered words, with the fingerprint e5f2474c written above
More detail
  • The seed is a test seed generated by the test site. It holds no funds. The person who took the photo agreed to its publication.
  • The engine works on the grayscale image. Like SeedSigner, the prototype has no network connection.
  • Every image and figure of sections 1 to 8 comes from the engine reading this photo at full resolution (3024 × 4032).
  • The fingerprint is optional. Section 7 explains how it is used.
2

The detector finds the writing

A small fully convolutional network, the detector, processes the whole photo in one pass, reduced to 288 × 384 pixels in grayscale. It outputs 11 output maps of 144 × 192 (per-pixel logits): where the words are, where the line numbers are, and which number belongs to which word.

Inputreduced photophoto, 288 × 384, gray
→
DetectorU-Net-style CNN
~224,000 parameters
459 KB
→
Output11 output maps, 144 × 192

Tap the buttons to overlay the sigmoid of the real output logits on the input.

Input of the detector: the photo reduced to 288 by 384 pixels Word map Line number map Link map

On this photo, the detector found 13 lines of writing and 13 line numbers.

The same detector also finds printed cards. Below, a SeedSigner card photographed with the camera of a Raspberry Pi Zero running the prototype: the card map covers the inside of the card, and the words inside it are assigned to that card.

Input of the detector: a photo of a SeedSigner card reduced to 288 by 384 pixels Card map Word map
More detail
  • Architecture: an encoder of 3 × 3 convolutions with 2 × 2 max pooling, then a decoder with nearest-neighbour ×2 upsampling and U-Net skip connections by concatenation. About 224,000 parameters.
  • The 11 output maps: word kernel (central band of each word box); the same for line numbers; inner area of a printed card; the four card corners (not used); height of the word or number box (regression output, not a logit); card kernel, which separates cards lying side by side; link from each number to the start of its word; cut or hidden word (not used).
  • One detector for every kind of backup: the SeedSigner card, other printed cards, and free lists on any paper. There is no separate rule-based search.
  • When the document covers less than 50 % of the photo, the detector runs a second time on that region, at a higher resolution.
  • Arithmetic: int16 weights, int32 biases and accumulators, ReLU activations requantized to 12-bit integers; the output layer applies a float scale and bias. A small C library computes it (SMLAD instructions on ARM). One pass takes about 1.2 s on a Raspberry Pi Zero.
3

Lines, numbers and reading order

Deterministic code turns the output maps into boxes: each connected component of a kernel map becomes a box, with its height from the height map. The code groups the boxes into lines and columns and decides the reading order. When line numbers are written, they set the order.

Input11 output maps
→
Layoutdeterministic code
→
Outputword boxes in reading order, and lines set aside
The photo with a green box around each word, numbered 1 to 12, an orange box around each line number, and a purple box around the fingerprint line
word, in reading orderline numberextra line

The detector took the first character of the fingerprint, e, for a line number (the 13th orange box). There are 13 lines for 12 words: the extra line is scored both as a BIP39 word and as 8 hexadecimal characters, scores far better as hexadecimal, and is set aside as a candidate fingerprint line. A number found just before a line tried as the fingerprint is put back into its crop, so the crop starts with the e.

More detail
  • With six line numbers or more, each number gets one slot, and each word goes into the slot of its number. A missed word can then be recovered in an empty slot.
  • Without numbers, the order comes from the geometry: column by column, row by row for words written in rows, and band by band when the columns are split by a wide gap (1-3 beside 4-6, then 7-9 beside 10-12).
  • Two columns of equal length without numbers can be read in several orders. Every order the geometry allows is scored. If more than one gives a valid seed and no number or fingerprint tells them apart, the order on paper is unknown: every word is marked uncertain and the gauge shows Low.
  • An extra line is a candidate fingerprint only if it is the first line, or the last line of a column, and if its log-likelihood as 8 hexadecimal characters exceeds that of its best BIP39 word by at least 17 (mean of both word readers).
  • Completeness checks: a word that touches the edge of the photo, or a column that may continue beyond it, means that no word can be certain. A handwritten word found but left out of the list makes every word uncertain.
4

Each word is cut out and normalized

Each word box is cut out of the full-resolution photo with a perspective rectification. The code then separates the ink from the paper. The result is an ink map (0 = paper, 255 = ink), 32 pixels high and at most 256 pixels wide: the input of the readers.

Inputcroprectified crop
→
Normalizationdeterministic code
→
Outputink mapink map, 32 px high

The crops below are the exact images the engine gave to the readers on this photo (first crop variant).

crop 1→ink map 1
crop 2→ink map 2
crop 3→ink map 3
crop 4→ink map 4
crop 5→ink map 5
crop 6→ink map 6
crop 7→ink map 7
crop 8→ink map 8
crop 9→ink map 9
crop 10→ink map 10
crop 11→ink map 11
crop 12→ink map 12
More detail
  • The crop keeps a margin around the box: 0.6 box heights on each side, 0.85 above and 0.75 below. It often includes the end of the line number. The readers are trained on crops with random margins and optional line numbers, and learn to ignore them; the decoder also accepts a number before the word.
  • Two other crop variants exist (a taller band, and a wider band of 1.2 box heights on each side). While the seed is not valid, the least probable words are read again on them.
  • Long horizontal runs of ink are removed: ruled and printed lines are much longer than the strokes of a letter. Pieces of the lines above and below are removed too.
  • The same normalization code builds the training images, so the readers always see the same kind of input.
5

The word readers

A second network, the word reader, reads each ink map. It is a CTC model: for every slice of 4 pixel columns, it outputs a probability distribution over 37 classes (blank, a–z, 0–9). A decoder constrained to the BIP39 lexicon turns these distributions into a log-likelihood for each of the 2,048 BIP39 words.

Inputink mapink map
→
Word readerCTC CNN
~164,000 parameters
335 KB
→
Lexicon decoderdeterministic code
→
OutputBIP39 words, with probabilities

Below, the real output for word 5: the most probable class of each slice. A dot is the blank class; a darker cell has a higher probability.

ink map of the word robot
···r·····o·····b···o····t··
slices→r o b o t→robot · 100 %

The 12 words of the photo, with the calibrated probability of the best word. Tap a word to see its crop and the next candidates.

1ink map of word 1 label100 %

As cut from the photo:

crop of word 1

Three most probable words, first word reader:

label100 %
later< 0.1 %
lake< 0.1 %

Second word reader, for comparison: label 99.8 %, fade < 0.1 %, lake < 0.1 %.

2ink map of word 2 tape99.5 %

As cut from the photo:

crop of word 2

Three most probable words, first word reader:

tape99.5 %
top< 1 %
trap< 0.1 %

Second word reader, for comparison: tape 99.8 %, top < 0.1 %, tag < 0.1 %.

3ink map of word 3 idea100 %

As cut from the photo:

crop of word 3

Three most probable words, first word reader:

idea100 %
sea< 0.1 %
deal< 0.1 %

Second word reader, for comparison: idea 100 %, index < 0.1 %, video < 0.1 %.

4ink map of word 4 brand99.9 %

As cut from the photo:

crop of word 4

Three most probable words, first word reader:

brand99.9 %
grant< 0.1 %
brain< 0.1 %

Second word reader, for comparison: brand 99.9 %, grant < 0.1 %, sand < 0.1 %.

5ink map of word 5 robot100 %

As cut from the photo:

crop of word 5

Three most probable words, first word reader:

robot100 %
robust< 0.1 %
rib< 0.1 %

Second word reader, for comparison: robot 100 %, robust < 0.1 %, rose < 0.1 %.

6ink map of word 6 gloom100 %

As cut from the photo:

crop of word 6

Three most probable words, first word reader:

gloom100 %
glow< 0.1 %
room< 0.1 %

Second word reader, for comparison: gloom 100 %, loan < 0.1 %, glory < 0.1 %.

7ink map of word 7 tell97.7 %

As cut from the photo:

crop of word 7

Three most probable words, first word reader:

tell97.7 %
test< 1 %
ten< 1 %

Second word reader, for comparison: tell 96.8 %, ten 1.2 %, tent < 1 %.

8ink map of word 8 diagram100 %

As cut from the photo:

crop of word 8

Three most probable words, first word reader:

diagram100 %
jaguar< 0.1 %
abandon< 0.1 %

Second word reader, for comparison: diagram 100 %, dragon < 0.1 %, abandon < 0.1 %.

9ink map of word 9 notable100 %

As cut from the photo:

crop of word 9

Three most probable words, first word reader:

notable100 %
table< 0.1 %
stable< 0.1 %

Second word reader, for comparison: notable 100 %, table < 0.1 %, stable < 0.1 %.

10ink map of word 10 believe99.9 %

As cut from the photo:

crop of word 10

Three most probable words, first word reader:

believe99.9 %
behave< 0.1 %
derive< 0.1 %

Second word reader, for comparison: believe 100 %, behave < 0.1 %, derive < 0.1 %.

11ink map of word 11 together100 %

As cut from the photo:

crop of word 11

Three most probable words, first word reader:

together100 %
abandon< 0.1 %
ability< 0.1 %

Second word reader, for comparison: together 100 %, abandon < 0.1 %, ability < 0.1 %.

12ink map of word 12 state80.3 %

As cut from the photo:

crop of word 12

Three most probable words, first word reader:

state80.3 %
seat12.8 %
skate3.1 %

Second word reader, for comparison: state 90.5 %, skate 5.8 %, seat 1.1 %.

Word 12 is the least certain: state at 80.3 %, with seat (12.8 %) and skate (3.1 %) behind. The checksum and the fingerprint settle it in the next steps.

More detail
  • Architecture: four 3 × 3 convolutions with max pooling, then 1-D convolutions along the columns (one of them dilated), with one output per 4 columns. No recurrent layer. Same int16 arithmetic as the detector.
  • The decoder computes the CTC likelihood of each word over a prefix tree of the 2,048 BIP39 words, with beam pruning. It accepts a line number before the word, so that “5. robot” scores as “robot”.
  • Two word readers share the same architecture. The first one reads every photo. The second one, trained with more lowercase and cursive writing, reads again only when the first one gives no valid seed; a weighted blend of both (0.65 / 0.35) is also tried. On this photo, the first reader was enough.
  • Calibration: log-likelihoods are divided by a temperature of 2.2, chosen on simulated pages kept apart from the tests. For capitals, the probability of the best word then matches its accuracy within about 1 %.
7

The fingerprint check

A third network of the same architecture, the fingerprint reader, reads the line set aside. A forward–backward pass over its CTC output, constrained to 8 hexadecimal characters, gives the posterior probability of each of the 16 characters (0–9, a–f) at each of the 8 positions. The code computes the BIP32 master key fingerprint of each candidate seed and evaluates the probability that the line reads exactly that string.

Inputfingerprint linethe line set aside
→
Fingerprint readerCTC CNN
~164,000 parameters
335 KB
→
Outputper-position character posteriors
ink map of the fingerprint line
···e····f···ff···2···44···7··44···cc·

The engine reads the line on 3 crops (as cut, 2 % of its height less at the top, 2 % less at the bottom) and averages the probabilities. The strip above is the crop as cut, where the second character alone would read f (eff2474c). The most probable character at each position, averaged over the 3 crops:

e97 %
553 %
f100 %
2100 %
4100 %
799 %
4100 %
c98 %
Read on the papere5f2474c Computed from the seede5f2474c

The probability that the line reads e5f2474c is 0.49, against a threshold of 7 × 10⁻⁴. The fingerprint matches.

The reader is 49 % sure the line says exactly e5f2474c, the fingerprint of the words it read. It only needs 0.07 %: the threshold is set so that a wrong seed passes by chance less than once in a million photos.
8-character hexadecimal strings4,294,967,296
Strings that can reach 7 × 10⁻⁴ on one lineat most 1,428
Candidate seeds checked per photoat most 3
Wrong seed accepted by chance≤ 3 × 1,428 / 4,294,967,296 ≈ 1 in a million

✔ Verified: the seed read is the seed written.

Which fingerprint? The proposal uses the fingerprint of the words alone, without passphrase, as a SeedQR encodes the words alone. It would be written next to the words. A wallet with a passphrase has another fingerprint: that one belongs next to the passphrase, not next to the words.
More detail
  • BIP32 master key fingerprint: the first 4 bytes of HASH160 of the master public key. Computing it takes about 0.07 s on a Pi Zero, mostly the PBKDF2-HMAC-SHA512 of BIP39 (2,048 rounds).
  • The probability is not a confidence in the seed. It is the probability of one exact string among the 2³² = 4,294,967,296 strings of 8 hexadecimal characters. Ambiguous handwriting splits the probability between neighbouring strings (5 / f on this photo, 1 / 7), so even a right fingerprint rarely gets close to 1.
  • A wrong seed has an unrelated fingerprint, which lands on a given string with a chance of 1 in 4.3 billion (2.3 × 10⁻¹⁰). A probability of 7 × 10⁻⁴ is about 3 million times that: the match with the fingerprint computed from the words is what makes the proof.
  • Bound: the probabilities of all strings sum to 1, so at most 1,428 strings can reach 7 × 10⁻⁴ on one line. The fingerprint of a wrong seed falls on one of them with a probability of at most 1,428 / 2³² ≈ 3.3 × 10⁻⁷. With at most 3 candidate seeds, that is about 4,300 chances in 4.3 billion: at most 10⁻⁶ per photo.
  • The threshold is the lowest whose bound is at most 10⁻⁶ per photo, for the number of candidates that verified the most right seeds on the tuning pages. A higher threshold would lose right verifications of poorly written fingerprints without a useful gain in safety.
  • The probability here is well below 1 because the second character is less certain (53 %). The check only needs this exact string to be far more probable than chance.
  • If no candidate matches, the seed is never called wrong (a word or a character may be misread): the reading gets the lowest confidence level, and every word is marked uncertain.
  • Measured: on simulated pages with a fingerprint, 1,216 seeds verified, none wrong; on real development photos, 24 verified, none wrong.
  • The fingerprint reader was fine-tuned from the first word reader on simulated lines, half of them fingerprints.
8

The result and the confidence gauge

In the prototype, the user always sees the words and compares them with the paper. When the fingerprint matches, the screen says Verified. Without a matching fingerprint, the reading is never called verified: a gauge shows a proposed confidence level.

Prototype screen: 12 words read, VerifiedThis photo: verified.
Prototype screen: review of the wordsThen the words, to compare with the paper.

Screens of the prototype, rendered by the SeedSigner screenshot generator from the real reading of this photo.

Verified
A fingerprint was read and matches.
Wrong seed verified by chance: at most 10⁻⁶ per photo.
High
No fingerprint, no uncertain word.
Announced: at least 90 % of seeds fully right.
Medium
Valid seed with uncertain words, posterior at least 0.5.
Announced: at least 40 % fully right.
Low
Everything else: a fingerprint that does not match, or words that can be read in more than one order.
No rate announced.

These levels and thresholds are a proposal. We would like your opinion on them.

More detail
  • The rates were set on 2,757 simulated pages used for tuning only. There, 96.1 % of “high” seeds and 56.2 % of “medium” seeds were fully right; the announced rates (90 % and 40 %) are below the 95 % Wilson lower bounds (94.7 % and 50.7 %).
  • On adversarial simulated pages built to fool the engine, some levels fall below these rates. The gauge describes ordinary pages, not every trap.
  • In the prototype, after an unverified seed is loaded, the device shows its fingerprint and suggests writing it next to the words, so that the next reading can be verified.
  • If the user changes a word on the review screen, the reading is no longer verified.
9

When it does not verify

Most backups have no fingerprint written. The prototype then never says Verified. It shows a confidence level, marks the uncertain words, and asks the user to compare every word with the paper. Below, real readings of publishable photos by the same engine, with the prototype's real screens.

No fingerprint, no uncertain word: High

A SeedSigner card photographed with the camera of a Raspberry Pi Zero running the prototype. All 12 words were right and none was uncertain.

Prototype screen: Not verified, confidence highNot verified · High
Prototype screen: review, no word markedNo word marked.

Full text of the notice (it scrolls)

No fingerprint was found with your words to verify them.

Compare every word with your paper.

Unmarked words can be wrong too. Never use this seed without checking it.

No fingerprint, some words uncertain: Medium

Lowercase writing in one numbered column, photographed with the camera of a Pi Zero running the prototype. All 12 words were right, but the engine marked 5 of them as uncertain (orange boxes).

Handwritten numbered list with five words boxed in orange as uncertain
Prototype screen: Not verified, confidence mediumNot verified · Medium
Prototype screen: uncertain words markedUncertain words marked.

Full text of the notice (it scrolls)

No fingerprint was found with your words to verify them.

Compare every word with your paper.

The least sure words are marked like this: open each one, then confirm or correct it.

Unmarked words can be wrong too. Never use this seed without checking it.

Right words, low confidence: Low

Two columns in two bands, numbered. All 12 words were right, but the posterior probability of the seed was only 33.6 %: the level is Low and 8 words are marked. The gauge is conservative: a Low reading can be right, and the comparison with the paper decides.

Handwritten list in two bands with the uncertain words boxed in orange
Prototype screen: Not verified, confidence lowNot verified · Low
Prototype screen: uncertain words markedUncertain words marked.

Full text of the notice (it scrolls)

No fingerprint was found with your words to verify them.

Compare every word with your paper.

The least sure words are marked like this: open each one, then confirm or correct it.

Unmarked words can be wrong too. Never use this seed without checking it.

Wrong words: Low

Lowercase writing, numbered in rows of three, photographed with the camera of a Pi Zero running the prototype. The engine found a seed with a valid checksum, but 4 of its 12 words were wrong (red boxes: the word read is in the label). Its posterior probability was only 17.7 %: the level is Low, and 8 words are marked.

Handwritten list in rows of three, with four words boxed in red as misread
Word 4: written fine, read fireWord 6: written rose, read noseWord 8: written rain, read runWord 11: written rain, read train
Prototype screen: Not verified, confidence lowNot verified · Low
Prototype screen: words markedUncertain words marked.

Full text of the notice (it scrolls)

No fingerprint was found with your words to verify them.

Compare every word with your paper.

The least sure words are marked like this: open each one, then confirm or correct it.

Unmarked words can be wrong too. Never use this seed without checking it.

Same seed, written in two long rows without numbers: a valid seed again, with 5 wrong words and a posterior probability of 3.7 %; Low, every word marked.

Handwritten words in two long rows, with five words boxed in red as misread
Word 2: written main, read manWord 4: written fine, read fireWord 6: written rose, read toeWord 8: written rain, read teamWord 11: written rain, read train
Prototype screen: Not verified, confidence lowNot verified · Low

These are the cases the gauge is for: the checksum was valid, yet the seed was wrong. The Low level and the comparison with the paper are the protection here. A fingerprint written with the words would have flagged the mismatch.

No layout found

The same seed in text far too small for the photo: one line found, and the prototype's real failure screen.

Sheet with tiny handwritingText far too small for the photo.
Prototype screen: Scan failed, 1 line foundScan failed.

Not shown yet

A fingerprint that does not match (Low). No publishable photo yet. The notice would read: “The fingerprint read, …, does not match these words. The fingerprint must be the one of the words alone.”

More detail
  • The full notice scrolls on the 240 × 240 screen; its complete text, as built by the prototype for each reading, is given under each pair of screens.
  • The list in two bands was sent by a participant of the public test site with a test seed. The SeedSigner card and the other photos were taken with the camera of a Raspberry Pi Zero running the prototype. All hold test seeds and were shared for publication.
10

Layouts it has read

The same engine reads several ways of writing a seed. Each photo below was read by the engine, and every word was right. The green numbers show the reading order.

Examples read right, not a rate. They show what the engine can do, not how often it succeeds.

More detail
  • All these photos hold test seeds and were shared for publication. The lists were sent by participants of the public test site.
  • Two of these layouts, the two bands and the words in rows, were added to the engine after earlier versions failed on these very photos. They show what the engine does now, not how it does on new photos.
  • The SeedSigner card was photographed with the camera of a Raspberry Pi Zero running the prototype.
  • Not shown here, for lack of a publishable photo: other printed cards, the 24-word SeedSigner card, cursive writing, and three columns or more.
11

Torture test

The torture test is a bench of 10 test seeds of 12 words. Each seed holds at least three pairs of BIP39 words that look alike in handwriting (for example car / can, come / core, hunt / hurt). Each has a valid BIP39 checksum, and its BIP32 master key fingerprint (words alone, without passphrase) is given with it.

These pairs are the worst case for a reader: a confusion between two such words can keep the checksum valid, and only the fingerprint would catch it.

#Look-alike pairsFingerprint
1change / charge, theme / there, wear / year9cd79e5d
change year charge wear bind theme bind over night hard there mail
2can / car, come / core, hand / hard637d6d16
car come can hard nice hand rain nose there fine core charge
3oven / over, project / protect, wine / wire672217d0
year protect over project wine clay oven rule theme fire wire joy
4fine / fire, hunt / hurt, main / rain, night / right20594d19
hand main hunt fine night rose right rain fire hurt rain mule
5aim / air, claw / clay, come / coref01eba0a
rule aim clay core change change come rose claw air wear protect
6aim / air, fine / fire, hunt / hurt7a46b2d3
air come hurt hurt fine fine nose come fire aim hunt bird
7claw / clay, come / core, hunt / hurt30faafcd
wine claw hurt core rule hunt come clay theme hurt protect aim
8bind / bird, come / core, hunt / hurt6b9bc8af
core claw hurt bird charge come nice bind hunt over wine come
9hand / hard, nose / rose, oven / overef79f286
oven hard can joy main nose over rose hand rule wine aim
10aim / air, can / car, claw / clay, project / protect22f535cb
clay project bind there claw aim car air can joy over protect

Checked with the engine code: all 10 checksums are valid, and all 10 fingerprints match their words. Tap a row to see the 12 words.

Real results

10 photos of three of these seeds, written by hand and photographed with the camera of a Raspberry Pi Zero running the prototype, read by the same engine.

Capitals, one column, fingerprint written above.prototype screen
Seed 1. Capitals, one column, fingerprint written above.
Verified · 12/12 words right
Lowercase, numbered, one column, no fingerprint.prototype screen
Seed 1. Lowercase, numbered, one column, no fingerprint.
Medium · 12/12 words right, 5 marked
Lowercase, text far too small for the photo.prototype screen
Seed 4. Lowercase, text far too small for the photo.
Scan failed · 1 lines found: no layout
Lowercase, two long rows without numbers.prototype screen
Seed 4. Lowercase, two long rows without numbers.
Low · 7/12 words right, 12 marked
Lowercase, numbered in rows of three.prototype screen
Seed 4. Lowercase, numbered in rows of three.
Low · 8/12 words right, 8 marked
Capitals, numbered in rows of three.prototype screen
Seed 4. Capitals, numbered in rows of three.
High · 12/12 words right
Capitals, numbered in rows of three, fingerprint written above.prototype screen
Seed 4. Capitals, numbered in rows of three, fingerprint written above.
Verified · 12/12 words right
Capitals, numbered in rows of three, fingerprint written above, closer.prototype screen
Seed 4. Capitals, numbered in rows of three, fingerprint written above, closer.
Verified · 12/12 words right
SeedSigner card, capitals, no fingerprint.prototype screen
Seed 9. SeedSigner card, capitals, no fingerprint.
High · 12/12 words right
SeedSigner card, capitals, fingerprint written below.prototype screen
Seed 9. SeedSigner card, capitals, fingerprint written below.
Verified · 12/12 words right

Examples, not a rate. Green boxes: words read right; orange: marked uncertain; red: misread.

To come. The other seeds of the test have not been photographed yet.

12

The whole engine at a glance

Detector U-Net-style CNN · ~224,000 parameters · 459 KB
photo, 288 × 384 gray → 11 output maps: words, numbers, links, cards
Layout and normalization deterministic code
output maps → word boxes in reading order → ink maps 32 px high
Two word readers CTC CNN · ~164,000 parameters · 335 KB each
ink map → distribution over 37 classes (blank, a–z, 0–9), every 4 columns
Lexicon decoder and seed search deterministic code
CTC outputs → BIP39 word log-likelihoods → valid seeds with posteriors
Fingerprint reader CTC CNN · ~164,000 parameters · 335 KB
fingerprint line → per-position posteriors over 16 hexadecimal characters
Fingerprint check and gauge deterministic code
candidate seeds + reader output → verified, or a proposed confidence level

This is a proof of concept on a fork of SeedSigner: not part of SeedSigner, not integrated, and open to discussion. Its engine, Haller-1, is published: haller-project/haller and haller-project/seedsigner-haller. Figures measured on simulated pages are labelled as such; the others come from real photos.

13

How strong is the fingerprint check?

The problem

The BIP39 checksum catches most reading mistakes, but not all. About 1 misread 12-word seed in 16 still has a valid checksum. The device cannot tell it from the right seed.

The idea

The user writes the fingerprint of the words, without passphrase, below the seed. It is a second check, independent of the checksum. A seed is accepted only if the words read and the written fingerprint agree.

What the prototype does

It computes the fingerprint of the words it has read. Then the network that reads the handwritten fingerprint line answers one question: how probable is it that the line says exactly this string?

Photo Words read label tape … state Written line handwritten Fingerprint of the words read e5f2474c Fingerprint reader probability per character Can the line read exactly e5f2474c ? here: 49 %, threshold 0.07 % at least 0.07 % Verified below 0.07 % Not verified
Values from the example photo of sections 1 to 8.

Here the network gives the string e5f2474c a probability of 49 %. The threshold is only 0.07 %. Handwriting spreads the probability over similar strings, so even a right fingerprint rarely scores near 100 %. A low threshold is still safe, for the reason below.

Why a misreading does not pass

There are 4.3 billion possible fingerprints. With a threshold of 0.07 %, at most about 1,400 of them can pass on a given line. If a word is misread, the fingerprint of the words changes completely: it lands on a random one of the 4.3 billion. The chance that it falls among the accepted ones is at most 1 in a million per photo. Retaking photos adds up: 10 photos, at most 10 in a million.

The demonstration

For one test seed, every seed with 1 or 2 words changed was computed, and every mix of look-alike words: none has the same fingerprint. A seed with the same fingerprint was found 3 words away. It took 17.8 billion tries on a GPU, and its words look nothing like the original.

Two valid seeds three words apart, change / coconut, bind / rally, mail / holiday, with the same fingerprint 9cd79e5d

Look-alike words have no special link to the fingerprint: a seed with look-alike words is as unlikely to match as any other wrong seed. The fingerprint confirms a seed; it does not identify it.

And the SeedQR?

Per image, the SeedQR is safer still. It is made for a machine: even a damaged code almost never decodes to a wrong seed. Scanning an unreadable CompactSeedQR for a minute brings its risk to the order of the fingerprint check.

BIP39 checksum alone1 in 16 Fingerprint check≤ 1 in a million Fingerprint + 6-letter check code, explained below≤ 1 in 17 trillion CompactSeedQR, 24 words≈ 1 in 2.4 billion SeedQR, 24 words≈ 1 in 26 trillion
Chance of accepting a wrong seed, logarithmic scale: longer is safer. Checksum: per misread seed. Fingerprint, and fingerprint with check code: bound per photo, the check code read exactly (section 14). SeedQR: conservative estimate per image of a damaged code. The units differ: the bars give orders of magnitude, not a direct comparison.
More detail
  • Checksum: 4 bits for 12 words, so a random wrong 12-word seed is valid with a probability of 1/16; 8 bits and 1/256 for 24 words.
  • Fingerprint: the first 4 bytes of HASH160 of the BIP32 master public key, derived from the words alone through PBKDF2-HMAC-SHA512. 2³² = 4,294,967,296 values.
  • Threshold: the probabilities of all strings sum to 1, so at most 1,428 strings can reach 7 × 10⁻⁴ on one line. A wrong seed lands on one of them with a probability of at most 1,428 / 2³² ≈ 3.3 × 10⁻⁷, assuming HASH160 behaves as a random function. The prototype checks at most 3 candidate seeds, chosen from the words without using the fingerprint line: at most 10⁻⁶ per photo, and at most N × 10⁻⁶ over N photos. The threshold is the lowest with this bound; a higher one would lose right verifications of poorly written fingerprints.
  • On this photo, the third most probable sequence replaces state with skate and also passes the checksum. Its fingerprint is 1bd36128; the probability that the line reads it is 1.1 × 10-34, against 0.49 for e5f2474c.
  • Collisions measured on a GPU, each result checked with two independent CPU implementations. Random valid seeds: 132 pairs sharing a fingerprint among 1,048,576 (128 expected by the birthday bound). Torture seed 1: none of the 1,555 seeds 1 word away, the 17.3 million seeds 2 words away, or the 705,352 combinations of words at edit distance 1. First collision 3 words away after 17,779,518,951 valid seeds (3 h 26 on an RTX 4090).
  • SeedQR, per image of a code damaged beyond its correction capacity, conservative estimates (exact Reed-Solomon calculation × filter rates measured at their 95 % upper limit, worst damage pattern tested): CompactSeedQR 12 words 1 in 5.1 billion, 24 words 1 in 2.4 billion; SeedQR 12 words 1 in 1.5 trillion, 24 words 1 in 26 trillion. A SeedQR whose damage stays within its correction capacity is always decoded correctly. On 9.2 million damaged images decoded with zbar, the decoder of SeedSigner, no wrong seed was accepted: by the rule of three, less than 2 × 10⁻⁶ per image not read right. zxing, which corrects beyond the detection reserve of the standard, is about 2,000 times riskier per correction attempt, before filters. One minute of persistent scanning of an unreadable CompactSeedQR of 24 words at an assumed 10 images per second gives about 2.5 × 10⁻⁷, the order of the fingerprint bound per photo. The CompactSeedQR has no checksum.
  • The fingerprint bound is a bound on verification, not an estimate of an error rate.
14

A proposal: a 6-letter check code

The BIP39 checksum is short: 4 bits for 12 words, so one wrong word passes it once in 16. The fingerprint is only meaningful as the fingerprint of the words alone (without passphrase), costs a PBKDF2 per candidate, and does not say which word is wrong. This page also proposes a short check code, written with the words. It is a proposal, not an existing BIP: a draft specification, a reference implementation and test vectors exist, nothing more.

1. label
2. tape
3. idea
…
11. together
12. state
SJZ GJX
The check code of the seed of sections 1 to 8, computed by the reference implementation, written below the last word.

Combined with the fingerprint

A wrong seed would have to pass both checks. The code always detects 1 or 2 wrong words: exactly the plausible reading mistakes. Any other wrong seed matches the code with a chance of 1 in 16.8 million.

With the code read exactly, the fingerprint and the code together give a bound of about 1 in 17 trillion per photo, instead of 1 in a million with the fingerprint alone.

More detail
  • Bound: at most 3 candidate seeds × 3.3 × 10⁻⁷ for the fingerprint × 2⁻²⁴ for the code ≈ 5.9 × 10⁻¹⁴ per photo. The fingerprint comes from PBKDF2 and HASH160, the code is a linear function of the word indices: for a wrong seed, they are treated as independent.
  • “Read exactly” means the 6 letters are known without error: typed or confirmed by the user, or read with no ambiguity. No reader for the handwritten code exists yet. If a network read it with a probability threshold of 7 × 10⁻⁴, as for the fingerprint, the code alone would let a wrong candidate pass with a probability of at most 1 / (7 × 10⁻⁴ × 2²⁴) ≈ 8.5 × 10⁻⁵, and the combined bound would be about 1 in 12 billion per photo.
  • Detection of 1 or 2 wrong words is certain only in verification mode, with the code read exactly. In correction mode, the words rebuilt from the code agree with it by construction: they are checked by the fingerprint and by the user, not by the code.
Below the last word, never on a split backup. The code reveals 24 bits of the seed: it is as secret as the words. It would be written below the last word, on its own line, never on the line of the fingerprint, which is public. Alone it is useless to an attacker, but with all the words but 4, it reduces a search of about 2⁴⁰ PBKDF2 derivations to 2¹⁶: it must never be written on a backup split across several places.

Simulated gain on the reader (production engine, 93 real photos read with the right number of words, code assumed read right): exact seeds 71 → 79; seeds with a posterior of at least 0.99, 49 → 78, none wrong. The gain is on pages without a fingerprint. Reading 6 handwritten letters has not been measured yet; it would need a reader trained like the fingerprint reader.

15

Recommendations, if this were integrated

If handwritten seed reading were integrated into SeedSigner, a few changes outside the engine would make it more reliable.

1. Fingerprint and check code fields on the official card

A variant of the official seed card could carry two fields on the words side, below the last word: FINGERPRINT, 8 boxes for the 8 hexadecimal characters, and CHECK CODE, two groups of 3 boxes for the 6 capital letters of the proposed check code (section 14). A 24-word card would have the same two fields below its 24 lines.

SEED WORDSMOCKUP1.2.3.4.5.6.7.8.9.10.11.12.FINGERPRINTCHECK CODE
Blank.
SEED WORDSMOCKUP1.LABEL2.TAPE3.IDEA4.BRAND5.ROBOT6.GLOOM7.TELL8.DIAGRAM9.NOTABLE10.BELIEVE11.TOGETHER12.STATEFINGERPRINTe5f2474cCHECK CODESJZGJX
Filled with the test seed of sections 1 to 8: fingerprint e5f2474c, check code SJZ GJX.

Mockup, not an official template. The check code is as secret as the words. The fingerprint can also appear on the SeedQR side.

2. Capital letters

The instructions would keep recommending capital letters, even as the models improve. Capitals are easier to read, for a person and for the engine, and the measured rates are higher.

Simulated benchCapitalsLowercaseNeat cursive
Usual pages (1,560 pages)94.9 %1,196 / 1,260–68.3 %205 / 300
Lists with a fingerprint line (1,200 pages)83.8 %616 / 73557.4 %267 / 465–
Badly framed photos (1,167 pages)74.9 %501 / 66941.0 %59 / 14445.8 %162 / 354

Share of seeds read exactly. Simulated benches read by the production engine. On real photos sent to the test site and read by the same engine (writing declared by the participant), the samples are still too small to compare: capitals 20 of 20, lowercase 6 of 8, cursive 3 of 3 exact.

3. The fingerprint, every time

The fingerprint field would be filled every time: it is the only path to Verified. After the review of a seed that is not verified, the prototype shows the fingerprint of the words alone and suggests writing it next to them.

Prototype screen: Fingerprint 20594d19, write this fingerprint next to your wordsReal screen of the prototype after reading photo 06 of the torture series (High, not verified). No passphrase.

4. Without an official template

The principle. The networks and the engine are trained and tuned to tolerate a wide range of layouts and writing styles. A few simple instructions would still make the reading more reliable and faster. Even with them, writing a seed by hand and scanning it would remain simpler than copying a SeedQR.