Nonce Allocator for a High-Throughput Ethereum Hot Wallet
Last updated: November 29, 2026
Quick Overview
Design a nonce manager for one account-based hot wallet address that hands out nonces to concurrent send requests, reuses nonces whose transactions were never broadcast, resyncs with the chain, and reports gaps that would block later transactions.
BitGo
November 29, 20260
0
0 solved
Design a nonce manager for one account-based hot wallet address that hands out nonces to concurrent send requests, reuses nonces whose transactions were never broadcast, resyncs with the chain, and reports gaps that would block later transactions.
On Ethereum and similar chains, a transaction with nonce n cannot confirm until n-1 has, so a single skipped nonce freezes every later withdrawal from a busy exchange hot wallet. BitGo's coin and wallet teams deal with exactly this, and the interviewer checks state modelling under failure.
What the Interviewer Expects
- Explains why gaps block all later transactions on account-based chains
- Reuses the lowest released nonce first
- Discards released nonces that the chain has already consumed
- Syncs from the chain nonce without moving backward
- Can list gaps given broadcast pending transactions
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How do you replace a stuck transaction (same nonce, higher fee)?
- How would you run this across multiple signing workers?
- What happens if someone sends from this address outside your system?
- How do you detect a transaction dropped from the mempool?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
reserve() returns the nonce to use. release(n) is called when building or signing fails before broadcast. broadcast_ok(n) marks success. sync(chain_nonce) applies the latest confirmed account ...
High-Level Design
Track floor (chain's next accepted nonce), next_fresh (never handed out), a min-heap of released nonces and an in-flight set. Reserving prefers the smallest released nonce because it is the one bl...