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
@mnm458
Organization or Individual Name
Mohak Malhotra
How did you learn about the Lockbox: Coinholder Retroactive Grants Program?
By being part of the Zcash community
Requested Grant Amount (USD)
$47,200
Category
Infrastructure
Project Summary
Thirteen merged pull requests to Zallet, integration-tests and lightwalletd (March to November 2026), led by four bug fixes. The largest is a fix for a connection-pool deadlock (zcash/zallet#708, fixed in zcash/zallet#914) that could freeze 14 wallet RPCs under load or on small machines, including z_getnewaccount on a fresh wallet. The rest add a backup command for live wallets, owner-only file protection on Unix and Windows, zcashd-compatible viewing key RPCs and cookie authentication. All of it is merged and reviewed by Zallet's maintainers.
Project Description
Since March 2026 I have contributed 13 merged pull requests to Zallet, Zcash's replacement for the zcashd wallet, and to its test and light-client infrastructure. The work focused on fixing bugs that broke wallets in production and on closing gaps that block zcashd users from migrating.
Bug fixes
- Wallet RPC deadlock (zcash/zallet#708, fixed in zcash/zallet#914). Wallet sync permanently holds 4 pooled database connections. Fourteen wallet RPCs held one connection while acquiring another, so under load or on small machines they could wait forever and block every other RPC. On a fresh wallet it was a bootstrapping deadlock:
z_getnewaccount, the call that lets sync start, was itself affected. I hit it while running backup end-to-end tests on a small machine and root-caused it with stack samples. z_listunspentfailing on one bad memo (zcash/zallet#866). One unreadable memo, such as a text memo with invalid UTF-8, made the whole call fail and hid every spendable note. Unfetched memos also returned placeholder text in a field documented as hex.- Infinite loop in lightwalletd darkside mode (zcash/lightwalletd#553).
setPrevhashcomputed the block hash before updating the previous-hash bytes, so the loop never ended. Wallet teams use darkside mode to test reorg handling. - Wrong zcashd migration table (zcash/zallet#885). The Zallet book listed implemented RPCs as missing and gave outdated advice for
sendmanyandsendtoaddress. Exchanges use this table to plan their move off zcashd.
Wallet safety
zallet backup(zcash/zallet#906): consistent, integrity-checked backups of a live wallet. A Zallet maintainer suggested I take on zcash/zallet#195 and asked for the live-wallet design.- Owner-only file protection (zcash/zallet#913, zcash/zallet#936): completes maintainer-filed issue zcash/zallet#910. Backup, the RPC cookie, the encryption identity, the data directory and the wallet database now share one permission module across Unix and Windows. On Windows the wallet database previously had no owner-only protection.
zcashd parity
z_importviewingkey(zcash/zallet#431) andz_exportviewingkey(zcash/zallet#614) for Sapling, matching zcashd's interface, plus an integration test (zcash/integration-tests#181)- RPC cookie authentication (zcash/zallet#502), as in zcashd and bitcoind
blockstomaturityinz_listunspent(zcash/zallet#789), used by mining pools- A shared account-birthday helper for
z_getnewaccountandz_recoveraccounts(zcash/zallet#760)
Not claimed here (still in review)
- zallet #943, #944, #945, #946, #947, #948 (memo, account-birthday and dust-output bug fixes) and integration-tests #208, #212, #213, #219 (including a regression test for the zcash/zallet#708 deadlock).
Technical Approach (how you did it)
All work was done in the upstream repositories (zcash/zallet, zcash/integration-tests, zcash/lightwalletd) and reviewed by their maintainers. For the larger items I agreed the design with a maintainer before building.
Deadlock (zcash/zallet#914). Root-caused from stack samples on a small machine. Fourteen RPCs now stage their database reads, release the connection before keystore access, and reacquire only once key material is in hand. A new clippy.toml bans holding a pooled connection across an await, so the bug class fails CI if it returns. The pool now has a floor of 8 connections (4 for sync plus 4 matching zcashd's default RPC threads), because deadpool's default of twice the CPU count is below what sync alone holds on a single-core host. Nine methods that only need network parameters no longer take a connection at all. Verified with an A/B run on a 2-core host.
Unreadable memos (zcash/zallet#866). Memo lookup returns an explicit outcome (read, not yet fetched, or unreadable). An unreadable memo omits the memo fields for that note and logs a warning identifying it, instead of failing the request.
Backup (zcash/zallet#906). Uses SQLite's Online Backup API, which gives a transaction-consistent snapshot of a running wallet without blocking it. It fails loudly instead of looping forever if sustained writes keep restarting the copy. It never produces a partial backup: if an unclean shutdown leaves a hot journal, it asks you to start the wallet once to recover first. I agreed that trade-off with a maintainer.
File protection (zcash/zallet#913, zcash/zallet#936). A single module provides owner-only file creation (mode 0600 forced on Unix regardless of umask, protected ACLs on Windows) and atomic publishing in three explicit modes. No-clobber publishing uses RENAME_NOREPLACE via rustix on Linux and macOS (already in the dependency tree, so no new crate) and MoveFileExW on Windows. Verified on macOS and Linux, and via a Windows cross-compile.
zcashd parity (zcash/zallet#431, zcash/zallet#614, zcash/zallet#502, zcash/zallet#789). Matched zcashd's RPC interfaces, including the whenkeyisnew/yes/no rescan options for viewing key import. Cookie auth writes {datadir}/.cookie on startup and removes it on clean shutdown, and zallet rpc reads it automatically.
lightwalletd (zcash/lightwalletd#553) and docs (zcash/zallet#885). Fixed the hash ordering in setPrevhash and added an 83-line regression test. Corrected the RPC status table and added a test that fails on a mistyped status or a missing row.
Time Period of Work Completion
10 March 2026 – 6 November 2026
Total Budget (USD)
$47,200
Budget Breakdown
-
Compensation:
- $(USD): 45,000
- Justification: 300 hours at $150/hour. Hours are based on the scope of each PR, including design discussion, review rounds and rebases:
| PR | Work | Hours | USD |
| --- | --- | --- | --- |
| zcash/zallet#914 | Root-cause from stack samples, 14-RPC restructure, Clippy CI enforcement, pool-sizing redesign, regression tests, 2-core e2e verification | 68 | 10,200 |
| zcash/zallet#913 | Shared owner-only fs module, cross-platform atomic publish | 48 | 7,200 |
| zcash/zallet#906 | Wallet backup command | 40 | 6,000 |
| zcash/zallet#936 | Remaining fs call sites, Windows ACL for wallet DB | 24 | 3,600 |
| zcash/zallet#431 |
z_importviewingkey| 24 | 3,600 | | zcash/zallet#502 | Cookie auth and docs | 22 | 3,300 | | zcash/zallet#614 |z_exportviewingkey| 18 | 2,700 | | zcash/zallet#866 | Unreadable-memo fix | 14 | 2,100 | | zcash/zallet#885 | RPC status table fix and drift test | 11 | 1,650 | | zcash/integration-tests#181 |z_importviewingkeyintegration test | 11 | 1,650 | | zcash/lightwalletd#553 | Darkside infinite-loop fix and regression test | 8 | 1,200 | | zcash/zallet#789 |blockstomaturity| 7 | 1,050 | | zcash/zallet#760 | Birthday helper refactor | 5 | 750 | | Total | | 300 | 45,000 |
-
Technology/Software: $0
-
Infrastructure/Hosting:
- $(USD): 2,200
- Justification: Two AWS t2.large hosts (2 vCPU, 8 GB RAM, 400 GB storage) running infra, full nodes and Zallet continuously since March 2026, used for development, end-to-end testing and bug reproduction (about 8 months of compute, storage and data transfer).
-
Services/Contractors: $0
-
Other: $0
-
Total: $47,200
Previous Funding
No
Previous Funding Details
N/A
Other Funding Sources
No
Other Funding Sources Details
N/A
Success Metrics
Zallet has to be safe and reliable before exchanges, mining pools and custodians can leave zcashd. This work removed real failures in that path, and all of it is merged into the official repositories.
- Bugs fixed: 4 production bugs, each with a test or lint that prevents it from returning.
- Deadlock removed from 14 wallet RPCs, including the one a fresh wallet needs to start syncing. 9 more methods no longer take a database connection at all.
- Tracked issues closed or completed: zcash/zallet#708 (deadlock), zcash/zallet#80 (viewing key import), zcash/zallet#305 (cookie auth), zcash/zallet#910 (file permissions, all steps), the manual-backup part of zcash/zallet#195, and zcash/lightwalletd#552.
- New wallet safety: live-wallet backups did not exist before, and Windows wallet databases now get owner-only protection.
- zcashd parity: 2 new RPCs and a new
z_listunspentfield matching zcashd, cookie auth matching zcashd, and an accurate migration table that a test keeps current. - Scale: 13 merged PRs, about 6,050 lines added across 3 repositories, all reviewed and merged by maintainers.
- Qualitative: two of the larger items (zcash/zallet#195 and zcash/zallet#910) were suggested or filed by a Zallet maintainer, and I agreed the backup design with them before building it.
Proof of completion
- Repository/Commit:
- zallet (11 PRs): #914 deadlock fix · #936 fs call sites · #913 fs module · #906 backup · #885 RPC status table · #866 memo fix · #789 blockstomaturity · #760 birthday refactor · #431 z_importviewingkey · #614 z_exportviewingkey · #502 cookie auth
- integration-tests (1 PR): #181 z_importviewingkey test
- lightwalletd (1 PR): #553 setPrevhash fix and regression test
- Issues resolved: zallet#708 · zallet#910 · zallet#195 · zallet#80 · zallet#305 · lightwalletd#552
- Other Evidence:
- The zcash/zallet#914 deadlock commit reached main through the zcash/zallet#936 merge (Nov 6, 2026); GitHub shows zcash/zallet#914 as merged.
- zcash/zallet#502 and zcash/zallet#614 were merged from maintainer branches; the commits in them are mine.
- Not claimed here (still in review): integration-tests #208, #212, #213, #219 (including a regression test for the zcash/zallet#708 deadlock).
Conflict of Interest Disclosure
I am an independent contributor and would directly receive this grant. I am not employed or contracted by ZODL, ECC or the Zcash Foundation, and none of this work is covered by their grants.
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.