Self-tests
What you'll learn
- How to check the camera link end to end, before any seed is involved
- What the animated-QR and transaction self-tests prove
- What a pass looks like, and what to do if one fails
Before you put any seed in the device, check that its parts work. None of these tests needs a seed. The firmware’s self-tests are under Dev tests in the menu.
1. Scan test: the camera link, end to end
Section titled “1. Scan test: the camera link, end to end”This checks the whole path: camera board, one-way wire and DevKit.
- On a phone or a computer screen, show a QR code that holds some plain text, such as a short sentence. A QR code generator website or app can make one.
- On the device, open Scan test.
- Hold the QR code in front of the camera, about 20 cm away. The camera’s lens has a fixed focus, and it’s sharpest at about that distance.
A pass: the text you encoded appears on the screen, character for character, with its length and checksum. The counters show ok going up and no errors. In testing, 7 different codes, including one with binary data, arrived byte for byte.
2. UR self-test: the animated-QR decoder
Section titled “2. UR self-test: the animated-QR decoder”Dev tests → UR self-test checks the device’s UR decoder and encoder: the code that collects animated QR frames and turns them back into a transaction, and the code that makes the animated QR of the signed result. It runs the official test vectors from the UR format’s authors, a simulated stream with lost and repeated frames, deliberately broken inputs, and two real animated QR codes captured from Sparrow.
A pass: the screen reports PASS with 0 failed, in well under a second. (In testing: 43 of 43 checks on firmware 0.7.0, and the 0.8.0 firmware adds 4 encoder checks.)
3. PSBT self-test: the transaction checker
Section titled “3. PSBT self-test: the transaction checker”Dev tests → PSBT self-test feeds the device’s transaction checker a set of prepared PSBTs, honest ones and attacks, and checks that each is accepted or refused as it should be. Among them:
- honest one-input and multi-input transactions (accepted)
- a fake “change” output that doesn’t belong to the wallet (shown as a payment to someone else)
- a multi-input transaction without the earlier transactions (refused)
- a copy of an earlier transaction that doesn’t match the coin it claims to be (refused)
- amounts that disagree with each other, the “fee lie” attack (refused)
- an input that isn’t the wallet’s (refused)
- an unusual signing mode (refused)
- corrupted and truncated data (refused, without crashing)
It uses a test wallet’s public key only, so no seed is needed.
A pass: PASS with 0 failed. In testing, 82 cases ran twice each: 24 accepted and 58 refused, exactly as expected. The slowest case (50 inputs) took about 4 seconds.
4. QR loopback (optional): the camera reading the device’s own screen
Section titled “4. QR loopback (optional): the camera reading the device’s own screen”Dev tests → QR loopback shows a QR code on the touch screen for the camera to read back. It matters later, if you want to test a SeedQR with the device’s own camera.
A pass: the device reports a match. Hold the camera about 20 cm from the screen and keep it steady for a few seconds while it adjusts to the bright screen. In testing, 9 read-backs out of 9 matched exactly.
If a test fails
Section titled “If a test fails”- Scan test shows nothing: check the camera link wiring (step 5), especially that the ground wire isn’t on the
GND/Rpin. Check that the camera board has power from the adapter. - Scan test is slow to read: bring the QR code closer or further, keep it steady, and make it bigger on the screen.
- UR or PSBT self-test fails: don’t continue. The firmware or a library may not match the tested versions. Check software setup and the library patches, then upload again.
Before you continue
Section titled “Before you continue”- Scan test shows your text exactly.
- UR self-test and PSBT self-test both report PASS with 0 failed.