Terms and Conditions
- I agree to the Grant Agreement terms if funded
- I agree to Provide KYC information if funded above $50,000 USD
- I agree to disclose conflicts of interest
- I understand that this grant program is only eligible for completed work, as it is a retroactive grant program. Applications for planned or partially completed work will not be considered. All completed work will be verified and accepted by its intended users or their representatives, who will confirm that the outputs meet the required quality, functionality, and usability before the work is listed as an option for Coinholder voting.
- I agree that for any new open-source software, I will create a CONTRIBUTING.md file that reflects the high standards of Zcash development, using the
librustzcashstyle guides as a primary reference. - I understand when contributing to existing Zcash code, I am required to adhere to the project specific contribution guidelines, paying close attention to any merge, branch, pull request, and commit guidelines as exemplified in the librustzcash repository.
- I understand all grants are valued in USD but will be disbursed in Shielded ZEC. I acknowledge and accept that disbursement amounts may fluctuate based on the ZEC/USD exchange rate at the time of payment.
Application Owners (@octocat, @octocat1)
@wh00hw
Organization or Individual Name
wh00hw (independent developer, sole applicant)
Additional Team Members
None
How did you learn about the Lockbox: Coinholder Retroactive Grants Program?
Zcash Community Forum. This is a resubmission of issue #28, which coinholders rejected in Q3 2026.
Requested Grant Amount (USD)
$16,875
Category
Infrastructure
Project Summary
A device-agnostic Rust SDK that drives any hardware signer through Zcash shielded (Orchard / Ironwood) PCZT signing, and a dependency-free C11 library, built for microcontrollers with a few kilobytes of stack and no heap, that runs on the device and checks and signs, tested against librustzcash. FlipZcash, a Flipper Zero firmware built on both, is the working example: it has signed real transactions on mainnet and testnet.
Project Description
What this is. Two reusable components and one working example. The SDK is the host side any wallet can use with any device that speaks its protocol; the C library is the device side a hardware-wallet or DIY-signer developer links into their own firmware, instead of porting the Rust stack or starting from zero; FlipZcash shows the two working together on real, constrained hardware:
| Repository | What it is | Licence |
|---|---|---|
| zcash-hw-wallet-sdk | Host core. Rust, device-agnostic: drives a device through PCZT signing over a transport-agnostic protocol; includes a virtual device for end-to-end tests | MIT OR Apache-2.0 |
| libzcash-ironwood-c | Device core. The C library: Pallas, Sinsemilla, RedPallas, ZIP 32, ZIP 244 v6 sighash, ZIP 2005 notes, note encryption, a signing state machine and a transport-agnostic device protocol | MIT |
| FlipZcash | Working example. Flipper Zero firmware (ARM Cortex-M4) built on the two | MIT |
Built for small microcontrollers. This is what sets the library apart: shielded Zcash signing that fits where a full Rust stack does not.
- No heap, no dependencies. The library never allocates; it uses fixed static work areas that it wipes after use, and needs nothing beyond a C compiler, a few C library functions (string and formatting) and a random-number source supplied by the firmware.
- Bounded stack. Every function stays within 512 bytes of stack, enforced in CI. On the Flipper the signing thread runs in a 6 KB stack, with a measured worst case of about 2.5 KB.
- Fits a Flipper Zero. On a Cortex-M4 at 64 MHz, where an app gets about 134 KB of heap, the whole wallet (library, user interface, storage) loads with a peak of 129 KB and signs. The 64 KB Sinsemilla lookup table is read from storage on demand and integrity-checked, not held in RAM.
- Speed without big tables. Per-output verification went from 375 ms to about 1 ms on a desktop, in constant time, using small tables. Build-time options trade a little speed for RAM on the tightest targets with identical results; FlipZcash uses them.
An ESP32-S2 port (zcash-hw-wallet-esp32) shows the library also builds for a second architecture (Xtensa); it is not part of this request.
What this is not. It is not a consumer product and not a place to keep savings. The Flipper Zero has no secure element, the code has had no third-party audit, and every repository says so. The deliverables are the SDK and the library, and the evidence that they are correct; FlipZcash exists to show them working on real, constrained hardware.
Why it was resubmitted, and what changed since #28. #28 asked $40,000 and was rejected in Q3 (6% Accept; part of the rejecting vote chose "would reconsider at a lower amount"). I took three things from that:
- The price. This request is $16,875, with an hours-based budget.
- The application was too long and the forum went quiet. This one is short; the detail is in the repositories.
- "The companion app cannot be trusted" — the objection @hanh raised on the Q2 thread. He was right, and more right than I understood then; see below.
Work completed since the Q3 application (all public, all before this submission):
- An adversarial review of my own code, and what it found. Before resubmitting I ran an adversarial review of every component with AI tooling, including a pass playing a fully malicious host and a fuzzer checking "what the screen showed" against "what was signed". It found real defects in the code I had called complete in #28, among them: a way for the host to hide an arbitrary fee behind a normal-looking one; change outputs the device could not tell from an attacker's; ciphertext and memo checks the host could opt out of; a PIN-derived key left in RAM; a default address that differed from the
orchardcrate for about half of all seeds; a spending key cached unencrypted on the Flipper's SD card; and transparent-input signing that never produced a valid signature. Each is fixed, the library ones each with a regression test; transparent inputs are now refused (see limitations). The findings and fixes are in the commit history of 11–13 November. - The device now decides for itself what is change and what is leaving. It derives its own viewing keys, classifies every output as change, own address or external, re-encrypts every output that carries value, and computes the fee and the total leaving the wallet from data bound by the signature.
- NU7. The host stack is on the October 2026
librustzcashrelease set; host and device accept the NU6.3 and NU7 branches and refuse everything else. On 13 November the current firmware signed a testnet payment on a Flipper Zero, after NU7: 30f35b3a…808195, block 4,616,057, with the payment, the change and the totals reviewed on the device.
AI assistance. As I have said on the forum since April, I work with an AI coding assistant, and the review above used AI tooling too. Design decisions, hardware testing and what ships are mine. Nothing below asks you to take that on trust: every claim is checkable.
Technical Approach (how you did it)
Correctness is established against the reference implementation.
- 389 known-answer checks generated from the Rust
orchard/librustzcashcrates by generators kept in the repository, replayed by the C tests; 21 test binaries in CI. - 55 end-to-end tests drive the host SDK against a virtual device built from the same C library the hardware runs. 34 of them (
sec_*) are security tests, most of them a malicious host trying redirected change, substituted memo, hidden fee, wrong pool, reordered or repeated messages or an unknown network upgrade; the rest check user refusal and what is shown. - During the review, a fuzzer written separately from the signer, comparing what the screen showed with what was signed, ran about 800,000 sessions on the final revisions without finding a violation. That fuzzer is not yet published, so this figure cannot be reproduced from the repositories.
- 512-byte per-function stack budget enforced in CI; constant-time behaviour of the secret-key paths checked under valgrind memcheck with the secrets marked undefined, on x86-64 with GCC and clang (method and results in
SECURITY.md; the harness itself is not yet in the repository, and the ARM and Xtensa builds were only partly checked by reading the assembly); a test that static memory holds no secret-derived bytes after the unlock, derive and sign paths it exercises.
What the device checks itself, with a hostile host assumed. The host builds the transaction and the Halo 2 proof. Before releasing a signature the device:
| A hostile host tries to… | The device… |
|---|---|
| show one recipient or amount and commit another | recomputes each note commitment from the recipient and value it displays; a mismatch aborts |
| send the change to its own address | decides from its own keys whether an output is change, one of the wallet's addresses, or external; the protocol carries no ownership hint |
| change or drop the memo, or attach an undecryptable note | re-encrypts every output that carries value and compares ciphertext and memo |
| hide value in another pool or in the fee | requires Sapling to be empty, refuses transparent inputs, requires a pool with no actions to have zero balance, and computes fee and total leaving from data bound by the sighash |
| skip the review, or reuse an approval | releases at most one signature per action, only for the sighash it computed, after the output and totals screens were confirmed |
| use an unknown network upgrade | accepts only the consensus branches compiled into the firmware |
Stated precisely: the total shown is an upper bound on what the wallet loses, exact when all inputs are the wallet's. The device does not verify the spend side (which notes are spent, anchors, nullifiers) or the proof; a lie there yields a transaction the network rejects, not a different payment. Expiry height and lock time are bound by the signature but not shown (expiry 0 means no expiry, so a host that withholds a signed transaction can broadcast it later). Zero-value outputs without a memo are verified but not shown, so the host can add a few such outputs to addresses of its choice; and the host holds the full viewing key, so privacy against the host is not a goal. One kind of zero-value output required by the sealed Orchard pool is accepted without a ciphertext match, under conditions the device checks itself. SECURITY.md lists, field by field, what is hashed, recomputed, shown, forced, or not verified.
These checks live in the library's signing state machine, so a firmware that uses the library gets them by default. A firmware holds the keys and could bypass them deliberately; the library makes the safe path the default one, nothing more.
Time Period of Work Completion
March 2026 – November 2026. First mainnet spend signed on the device: 2026-03-30. First public commit dated 2026-04-03. End of the work covered by this request: libzcash-ironwood-c 6525ec1 (code at c2f09bf, documentation after), zcash-hw-wallet-sdk 4a25306, FlipZcash 6665792, zcash-hw-wallet-esp32 d337951 (all 13 November 2026).
Total Budget (USD)
$16,875
Budget Breakdown
Compensation: $16,875 — 225 hours at $75/hour (estimate by deliverable, not a timesheet):
- C primitives and test-vector generators against librustzcash: 80 h
- Signing state machine, device protocol, on-device verification: 40 h
- Rust host SDK, virtual device, integration tests: 35 h
- FlipZcash firmware (UI, PIN-sealed storage, transport): 30 h
- NU6.3 / Ironwood migration of the whole stack: 25 h
- Constant-time performance work, NU7, adversarial review and fixes: 15 h
Technology/Software: $0
Infrastructure/Hosting: $0
Services/Contractors: $0
Other: $0
Total: $16,875
The public record behind these hours is the commit history of the repositories (113 commits across the three deliverables and the ESP32 port; they are large and pushed in batches, so days with commits undercount days worked) plus development before the first public commit, evidenced by the mainnet transaction of 30 March. No future work, audit or hosting is included.
Previous Funding
No
Previous Funding Details
None. Issue #28 (the earlier version of this application) was rejected in Q3 2026 and nothing was paid.
Other Funding Sources
No
Other Funding Sources Details
None: no grants, donations, bounties or hackathon prizes for this work.
Success Metrics
On-chain, checkable by anyone:
- Mainnet, 2026-03-30, block 3,290,949 — an Orchard spend signed on a Flipper Zero: 1c9eb6ca…5466b
- Testnet, 2026-07-15, block 4,173,268 — Orchard → Ironwood migration, signed before mainnet activation:
b8109ef3cee0dd3163ab082da9e389d77eebfc8dad681ded4e0035e7889fecb8 - Testnet, 2026-07-16, block 4,175,613 — Ironwood → Ironwood spend:
d20fc899caf89eca53a5199c79a41f4c2805dc61e92596224e21c83fa0aa400d - Testnet, 2026-11-13, block 4,616,057 — signed with the current code, after NU7:
30f35b3ab63a8a60b60adbfd8204a3222f331ade823184c411b4665656808195. A v6 transaction with 2 Ironwood actions: a payment to another wallet and the change. On the device the payment was shown as leaving the wallet with its full address and memo, the change as "Change (your wallet)", and the totals (amount + fee) were confirmed before signing.
The first three transactions were signed with earlier versions of the code; the last one with the code this application describes.
Reproducible in ten minutes, without hardware:
git clone https://github.com/wh00hw/libzcash-ironwood-c && cd libzcash-ironwood-c
git checkout c2f09bf
cmake -B build -DSTACK_ANALYSIS=ON && cmake --build build -j
(cd build && ctest --output-on-failure) # expect 21/21
./scripts/check_stack.sh build # expect PASSED
The end-to-end suite (host SDK against the virtual device) is one more build and one cargo test; the commands are in the SDK's CONTRIBUTING.md.
Community record. The design thread (forum t/55259) and the Q2 application thread (t/55550) have public comments from developers in the intended audience, several of which changed the design (on-device sighash, the companion-trust model, stack proofs, the vector corpus). They are comments on the work; nobody quoted there has audited it or endorsed this application.
Verification by intended users. No third party has yet confirmed a build or a test run in public. I am asking for it on the forum and will link any response here; I would rather state that plainly than imply an endorsement that does not exist.
Known limitations.
- No third-party security audit. The review described above was done by me with AI tooling; it found a lot, and it is not a substitute for an independent one.
- The Flipper Zero has no secure element. Its mnemonic is sealed under a 5-digit PIN; someone who takes the SD card can brute-force that PIN offline in minutes. The on-device attempt counter only protects against guessing through the device itself.
- Transparent inputs are not supported (no shielding from a t-address, no transparent signing). Shielded payments to a t-address work.
- The device does not verify the spend side or the proof, and does not show expiry height or lock time (see the table above).
- The ESP32-S2 port (not a deliverable) compiles against the current library but has not been run on the board since the November port; it has no trusted display and is a porting demonstration, not a wallet.
- Device attestation exists as a signing primitive only; it is not wired into the bundled dispatcher or FlipZcash.
- No hardware vendor or wallet team has integrated the library yet.
- The current firmware has signed one real transaction on hardware (above). Device timings are not yet measured (all speed figures above are desktop measurements), and on the Flipper the heap headroom during a signing session is small: fitting it required dropping a precomputed table and shrinking thread stacks, documented in the FlipZcash notes.
Proof of completion
Repository/Commit:
- https://github.com/wh00hw/libzcash-ironwood-c 6525ec1 (code at c2f09bf)
- https://github.com/wh00hw/zcash-hw-wallet-sdk 4a25306
- https://github.com/wh00hw/FlipZcash 6665792
- https://github.com/wh00hw/zcash-hw-wallet-esp32 d337951 (portability evidence, not a deliverable)
- https://github.com/wh00hw/zipher-app (companion CLI fork used for the transactions; not part of the request) Publication:
- https://forum.zcashcommunity.com/t/55259 (design thread, April 2026 onwards)
- Q4 application thread: linked in a comment on this issue Deployment/Release:
- Mainnet tx 1c9eb6ca4ada67bf66452120d128ceacf2c0e21146de089e51694eb14db5466b (block 3,290,949)
- Testnet tx b8109ef3… (block 4,173,268), d20fc899… (block 4,175,613), 30f35b3a… (block 4,616,057, current code) Other Evidence:
- CI: https://github.com/wh00hw/libzcash-ironwood-c/actions
- Previous application and its review thread: issue #28, https://forum.zcashcommunity.com/t/55550
Conflict of Interest Disclosure
None. I have no affiliation with FPF, ZCG, or any hardware-wallet vendor, and hold no position that depends on this grant beyond being its recipient.
Community Forum Posting
- I understand it is my responsibility to post a link to this issue on the Zcash Community Forums after this application has been submitted so the community can give input. I understand this is required in order for the community to discuss and vote on this grant application. Note: If you are unable to post on the forum (for example, due to new user restrictions), please leave a comment below, and we will adjust your posting permissions.