Cold Wallet Mode

Overview

Implementing a Cold Wallet Mode (Air-Gapped Wallet) enables transaction signing on a completely offline device, enhancing security by ensuring private keys are never exposed to the internet.


1. System Structure for Cold Wallet Mode

MirrorWallet will consist of two primary components:

  • MirrorWallet Cold (Offline Mode): An app running on an offline device dedicated to transaction signing.

  • MirrorWallet Hot (Online Mode): An internet-connected app that constructs transactions and broadcasts them to the blockchain after they have been signed.

The interaction between these components is achieved through QR codes or encrypted file transfer (air-gapped communication).


2. Developing the Offline Signing System (Cold Wallet)

To maintain complete isolation, the offline wallet must:

  • Disable all connectivity → No WiFi, Bluetooth, or mobile data.

  • Store private keys locally → Keys must never be exported or accessible externally.

  • Transaction signing process:

    1. The online device generates a QR code containing the unsigned transaction.

    2. The offline device scans the QR, signs the transaction, and generates a new QR containing the signed transaction.

    3. The online device scans the new QR and broadcasts the signed transaction to the blockchain.

Key Technologies:

  • BIP-174 (PSBT - Partially Signed Bitcoin Transactions) → For Bitcoin transactions.

  • EIP-712 (Typed Data Signing) → For Ethereum and EVM-compatible blockchains.

  • CBOR (Concise Binary Object Representation) → Efficient data exchange format between cold and hot wallets.


3. Developing the Air-Gapped Data Transmission System

Two primary methods can be used to transfer transaction data securely between offline and online devices:

  • The online device generates a QR containing the unsigned transaction.

  • The offline device scans the QR, signs the transaction, and generates a new QR with the signed transaction.

  • The online device scans the signed QR and submits the transaction to the blockchain.

Libraries for Implementation:

  • QR Code Generation: qrcode (Node.js), zxing (Android), VisionKit (iOS).

  • QR Scanning: ZXing, ML Kit (Google), VisionKit (Apple).

2. File Transfer via USB or SD Card (Less Convenient, Alternative Option)

  • The online device exports a JSON file containing the unsigned transaction.

  • The offline device imports the file, signs it, and generates a new JSON file with the signed transaction.

  • The signed file is transferred back to the online device and broadcasted to the blockchain.

Recommended File Format:

  • CBOR or Signed JSON for efficient and secure data exchange.


4. Implementing Secure Signing with Hardware Protection

To maximize security, cryptographic operations should leverage secure hardware environments:

  • iOS: Use Secure Enclave to handle private key operations without exposing them.

  • Android: Utilize TEE (Trusted Execution Environment) to secure transaction signing.

  • Optional: Enable hardware wallet integration (e.g., Ledger Nano X via Bluetooth or NFC).

Libraries for Secure Signing:

  • Ethereum: ethers.js, web3.js

  • Bitcoin: bitcoinjs-lib, bip32, bip39

  • Solana: @solana/web3.js


5. UX/UI for a Seamless User Experience

  • Automatic Mode Activation: The app detects when it is offline and enables Cold Wallet Mode automatically.

  • Intuitive UI: Step-by-step guidance and animations to explain the QR-based signing process.

  • Transaction Confirmation: A visual confirmation before signing to ensure accuracy and security.


Benefits of Cold Wallet Mode

  • Maximum Security: Private keys never connect to the internet, eliminating remote hacking risks.

  • Resistant to Online Attacks: Even if the online device is compromised, the wallet remains secure.

  • Ideal for High-Value Storage: Perfect for advanced users and institutional investors managing significant crypto holdings.

By integrating this system, MirrorWallet will provide a secure and seamless experience for users seeking cold storage-level security with the flexibility of an online interface.

Last updated