Inspiration The Midnight Network introduces a privacy-first blockchain with built-in data protection, but there was no standalone wallet extension that could serve as both a personal wallet and a shared treasury management tool. Existing wallet solutions either lacked dApp connectivity or didn't support multi-signature governance. We wanted to build something from scratch that showcases what Midnight enables — private, composable smart contracts with a great user experience. What it does Midnight Multi Sig Wallet is a Chrome Extension (Manifest V3) that serves as a full-featured wallet for the Midnight Network. It supports:
- Wallet management — Create or import wallets via BIP-39 mnemonic, with HD key derivation for up to 10 accounts per seed
- NIGHT token transfers — Send and receive unshielded NIGHT with automatic DUST (fee token) generation
- Multi-sig smart contracts — Deploy and manage N-of-M threshold signature contracts written in Compact. Users can propose transactions, vote to approve, and execute once the threshold is met — ideal for shared treasury management
- dApp connector — A full ConnectedAPI v4 implementation with 17 methods, letting web dApps request transfers, sign data, query balances, and more — all requiring explicit user approval through the popup
- Multi-network support — Switch between localnet and preprod testnet from the UI How we built it We built the entire extension from scratch in TypeScript (logic) and vanilla JavaScript + CSS (popup UI) — no React, no frameworks. The architecture is a clean three-layer design:
- Inpage provider — injected into web pages via content script, exposes window.midnight['midnight-wallet'] to dApps
- Content script bridge — thin relay between the page and background via postMessage
- Background service worker — the central hub managing the wallet lifecycle, transaction queuing, approval flows, and 40+ message types The multi-sig system is powered by a Compact smart contract compiled to WASM, with ZK proving keys and verifiers loaded directly from the extension bundle. We used Vite with three separate build configs (background+content, inpage, popup) and esbuild for the multi-sig UI module. The wallet SDK from @midnight-ntwrk handles all on-chain operations including HD derivation, transaction building, and ZK proof generation via a proof server. Challenges we ran into
- WASM in Chrome MV3 service workers — The Midnight SDK relies heavily on WASM, which requires special CSP headers (wasm-unsafe-eval) and careful bundling with vite-plugin-wasm and top-level await support
- Service worker lifecycle — Chrome can kill idle service workers at any time. We had to persist pending dApp requests to chrome.storage.session and gracefully handle "stale" requests that lose their Promise references
- Transaction balancing with unknown state — dApps send opaque transaction hex, so we implemented an 18-combination brute-force approach (3 signature states × 3 proof states × 3 binding states × 3 option combos) to deserialize and balance incoming transactions
- BigInt serialization — chrome.storage.local can't clone BigInt values, requiring explicit string conversion guards throughout the codebase
- Multi-sig witness binding — The Compact contract uses a mutable closure pattern for the secret key witness, requiring careful setSigner() calls before every contract invocation
- Network ID patching — A custom Vite plugin was needed to rewrite the midnight-js-network-id module at build time for dynamic network switching Accomplishments that we're proud of
- Built a complete Chrome extension wallet from scratch without any existing wallet template or framework
- Implemented the full ConnectedAPI v4 with 17 methods and a dApp approval flow that mirrors production-grade wallet UX (pending request queue, badge indicators, stale request handling)
- Designed and deployed a multi-sig Compact smart contract with threshold signatures, proposal lifecycle management, and on-chain state queries — all integrated into the extension UI
- Created a three-layer architecture with clean separation of concerns across inpage provider, content bridge, and service worker
- Wrote extensive architecture documentation (8 arch docs + implementation notes) and built a test dApp for manual connector verification What we learned
- Deep understanding of Chrome Extension Manifest V3 architecture, including the service worker lifecycle, content script injection, and postMessage communication patterns
- How to work with the Midnight Network SDK — wallet initialization, HD key derivation, transaction building, and ZK proof generation
- Compact smart contract development — writing, compiling, and deploying contracts with witness binding patterns and state management
- The complexities of building WASM-heavy applications for browser extension contexts, including CSP requirements and module bundling strategies
- How to implement a multi-sig governance model on-chain with propose → approve → execute semantics What's next for Midnight Multi Sig Wallet
- Multi-sig UI polish — Improve the proposal workflow UX with real-time signer status updates and transaction previews
- Shielded transaction support — Extend the multi-sig system to work with Midnight's privacy-preserving Zswap transactions
- Event notifications — Push notifications when new proposals are submitted or when thresholds are reached
- Contract interaction history — Full audit trail of multi-sig operations (proposals, votes, executions, cancellations)
- Additional networks — Support for additional Midnight testnets and eventually mainnet
- Unit test coverage — Expand testing beyond the multisig modules to cover the full wallet, background message handling, and inpage provider
Built With
- claude
- compact
- effects
- midnight
- opencode
- typescript

Log in or sign up for Devpost to join the conversation.