tl;dr - Create air-gapped cold wallet appvm with Bitcoin Armory. Create Tor connect Hot wallet from cloned template. Use hardware encrypted USB backup to deep freeze your wallet.
I have been in the process of building Bitcoin VMs and trying to find elegant solutions for hot and cold wallets.
) for my wallet software, which I am a big fan of.
My current solution has been to build Bitcoin Armory from source in a fedora-21-minimal TemplateVM.
This TemplateVM is then cloned. Inside the TemplateVM clone, I build bitcoind (
) from source. (Alternatively, BitcoinArmory will also securely download and install bitcoind for you).
Store blockchain and armory databases on root.img, so they can be shared with all appvms:
Once the entire blockchain has been synchronized, Bitcoin Armory creates
its own database, which will be stored in /usr/share/armory/databases.
This will be the same size as the blockchain.
This means, in your HOT WALLET template, you will need > 90GB of free space in your root.img.
In Dom0:
$ truncate -s 100G /var/lib/qubes/vm-templates/BTC-Hot-Template/root.img
$ qvm-run -a BTC-Hot-Template "sudo resize2fs /dev/mapper/dmroot && sudo reboot"
Now you can start armory, to download blockchain and/or build your database:
$ qvm-run -a BTC-Hot-Template armory
This will cause Armory to run, which automatically starts bitcoind. Click through, and skip creating a wallet. If you downloaded bootstrap.dat ahead of time, it will automatically detect the symlinked bootstrap.dat file in /usr/share/bitcoin if you place it there. You can also have bitcoind download the blockchain, and it will automatically be saved to /usr/share/bitcoin/blocks.
Once you have the entire blockchain synchronized, and your database built, it's time to create the AppVMs, and set their NetVMs. Your cold wallets will never touch the internet, and the hot wallets will use whonix to connect to tor.
$ qvm-create BTC-Hot-VM -t BTC-Hot-Template -l red && qvm-create BTC-Cold-VM -t BTC-Cold-Template -l green && qvm-prefs -s BTC-Cold-VM netvm none && qvm-prefs -s BTC-Hot-VM netvm Whonix-Gateway
Now with your new BTC-Cold-VM, you can create Cold, Offline Wallets. To accomplish this, we will create a brand new wallet in BTC-Cold-VM. We create encrypted backups (Both digital and paper). The backups can be stored inside your KeePassX-2b2 database in your BTC-VaultVM. (KeePassX 0.4.3 does NOT allow for multiple attachments per entry).
I use the KeePassX database to store a copy of my password, the wallet itself, and the PDF backup. Along with any notes, such as the word matrix that can be used to rebuild the wallet (PGP Signed), and PGP Signed Paper Wallet encryption keys. The database is kept in my air-gapped BTC-VaultVM. I send my encrypted backups to the BTC-VaultVM using Qubes' secure file transfer. The BTC-VaultVM is backed up with encryption to a hardware encrypted USB drive.
I also use a Key file for each of my KeePassX databases. Those keys are stored in a separate Key-VaultVM, which gets backed up to a SEPARATE Hardware Encrypted USB Drive. (This vault also stores backups of PGP Keys, and other keyfiles for other locked containers. ie Tomb Key Files)
Now we create our WATCH-ONLY copy of our wallet. Once the watch-only copy is created, we right-click on the file in Nautilus, and hit "Move to AppVM", and type in BTC-Hot-VM. We have now sent a watch-only copy to our VM with our Hot Wallet.
$ qvm-run -a BTC-Hot-VM armory
See:
https://bitcoinarmory.com/tutorials/armory-advanced-features/offline-wallets/Now we can import an existing wallet and point it to ~/QubesIncoming/BTC-Cold-VM/Watch_Only.wallet
You will want to tell Armory that this wallet belongs to you.
Now, Armory can and will generate payment addresses for the cold storage wallet, but it will NOT be able to spend them. So even if your BTC-Hot-VM becomes compromised, they will not be able to spend any of the BTC, which will be residing securely in your air-gapped cold storage wallet, on your hardware encrypted USB drive, and your BTC-VaultVM.
Because we connected our hotwallet to Whonix-Gateway, our BTC transactions will not be tied to our IP address.
In order to spend BTC from our Cold Wallet, we will need to create an OFFLINE TRANSACTION with our Online Wallet. The transaction is then sent via Secure File Transfer or Secure Copy/Paste, to be signed by our offline wallet. The transaction is then sent back to the online wallet to be finalized and broadcast to the network (via Tor).
We can also create new AppVMs based on the BTC-Hot-Wallet, and generate spending wallets. These AppVMs can then be attached to various ProxyVMs VPN-VMs, Whonix-Gateways, or whatever is appropriate for your use case. These are for immediate spending.
In order to "Deep Freeze" your Cold Wallet, create a new DispVM based on your Cold Wallet Template. Now, create a new wallet with armory, and create your encrypted backups, and your watch-only backup. Send your encrypted backups to your USB drive. Send your watch-only to your BTC-Hot wallet.
Once your backups are securely in place, close your disposable VM.
Now there is no wallet even for offline transactions. The BTC sent to the cold wallet cannot be spent without restoring your wallet from your encrypted backup (which should be stored off site, with family and/or attorney).
Now, if you are receiving regular BTC, you can send X% to Deep Frozen Storage, for long term savings, Y% to offline cold wallet for mediem term savings, and Z% of BTC to Hot Wallet for immediate spending.
Notes:
When this system was created, I was unaware of how to install debian-8-minimal in R3.0. Bitcoind is in the debian sid repos, but not Jessie, and not anywhere in Fedora. So, building everything from the github source in fedora-21-minimal, caused the "minimal" image to balloon up. Now, if it's your hot wallet, and it's going to be 100GB anyway, maybe this is no big deal. But if you are like me, and like to keep everything as lean as possible, you either want to remove all the build tools after you are done, or you want to just get some trusted signed binaries from a repo that stays up to date. To get bitcoind installed in Debian Jessie, what I usually do is a dist-upgrade with the Jessie repos, and then switch my main repo to sid, run:
$ sudo apt-get install bitcoind -y && sudo nano /etc/apt/sources.list
This way I don't forget to change back to Jessie, before doing another dist-upgrade.
(I have a habit of running the following command, and then walking away a lot)
$ sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get autoclean && clear && history -cw && exit/halt
WCGW, right?
Anyway, this will not allow you to get fast updates for bitcoind. But on the bright side, Armory has a little announcement panel that will tell you whenever there's updates for Bitcoin or Armory. Unfortunately, only if you're using an online wallet, AND not connected through tor. That being said, if you're installing from GitHub, you're probably not getting updates pushed to you anyway.
The point is, you should make sure you are keeping your software up to date. I install all my software to /opt/ (keepassx2, bitcoinarmory, bitcoind, apt-fast, etc etc), so I have to make an effort to keep those things up to date.
What i would like to discuss now is the security implications of using multiple wallets within the same AppVMs. If they are all cold offline wallets, does it matter? Might it be a better solution then to use a standalone VM?
For online wallets, can Tor Stream Isolation be reliably implemented to make it unnecessary for multiple hot wallet VMs? What are the security and anonymity implications of using multiple Bitcoin based AppVMs connected to the same NetVm/ProxyVM/FirewallVM?
What I am still investigating, is pointing Armory Hot Wallets to the
Whonix Gateway Socks Port, in order to take advantage of stream
isolation. Rather than using a transparent proxy. If other VMs are
connected to same Whonix-Gateway with transparent proxificatin , you are
probably risking identity correlation.
So for the time being, I
am recommending a dedicated Whonix-Gateway for each Hot Wallet. In the
Armory Preferences, you can turn on Tor Support. But it does not seem to
give you the option to choose your server, or port. This needs to be
investigated.
This should probably be tested by disabling transparent proxy in your Whonix-Gateway, and then trying to get Armory to connect.
What is your preferred BTC-VaultVM OS Template? Debian? Fedora? Arch?
I know Electrum is a much more popular wallet cient. I haven't used it much. What are peoples' thoughts on it? It doesn't need to download the blockchain, right? So, that would save me 100GB. Is it as secure? I would have to assume not, but it's packaged with Tails now, so maybe it's worth another look.