Jason C


Bitcoin

Using Virtual Machines

2017-09-18

Introduction

This tutorial will use a couple pieces of software - Virtual Box, Vagrant, and Cygwin (if using Windows). First step is to install Virtual Box (www.virtualbox.org). Virtual Box is an open-source program to manage virtual machines.

Next step is to install Vagrant (www.vagrantup.com). Vagrant is a tool for running specific virtual machines on systems like Virtual Box. Lastly, if using Windows I recommend using Cygwin over command prompt.

Vagrant

Once you have those installed it's time to setup Vagrant. First you need to pick a place to store the Vagrantfile. On my machine I use F:/VMs, so that's what will be used in this tutorial (and for mac I use ~/VMs), but you can use any directory.

Open a text editor (I recommend Sublime Text) and save the file below in your VMs folder, e.g. F:/VMs/bitcoin-ubuntu/Vagrantfile or ~/VMs/bitcoin-ubuntu/Vagrantfile for mac.

$script = <<SCRIPT
sudo apt-get update
sudo apt-get install -y xfce4 python-qt4 python-pip gedit
curl -O https://electroncash.org/downloads/3.1.2/win-linux/ElectronCash-3.1.2.tar.gz
echo "c355e0edb9d2253ce9b87c50c83412b10b84f7fefafd06c9907a0ab69c2404a2 ElectronCash-3.1.2.tar.gz" > hash_check.sha256
if sha256sum -c hash_check.sha256; then
    sudo pip install ElectronCash-3.1.2.tar.gz
fi
SCRIPT

Vagrant.configure("2") do |config|
    config.vm.box = "bitcoin-ubuntu"
    config.vm.provider :virtualbox do |vb|
        vb.name = "bitcoin-ubuntu"
    end
    config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
    config.vm.provision "shell", inline: $script
end

If you are doing this for Bitcoin Core (not Bitcoin Cash), use Electrum. Source: https://download.electrum.org/3.0.5/Electrum-3.0.5.tar.gz Md5sum: 17257d2ee01454283a3324392b85eef5

Open your terminal (e.g. Cygwin or Terminal/iTerm if on a Mac). Go to the directory which has the Vagrantfile. Run vagrant up. This will download the Ubuntu image and create the virtual machine in Virtual Box. This can take around 10 minutes (or longer if you have slow internet).

Ubuntu

Open Virtual Box and you will see the bitcoin-ubuntu VM running. Double click it to load the VM gui. Login as user vagrant and password vagrant. Run startxfce4. When prompted choose to use default panels.

You now have a Linux desktop. You can resize the window to make it larger if you'd like. One convenient item to enable is a shared clipboard, you can do this in the VM devices menu under Devices > Shared Clipboard > Bidirectional. You can open Electron Cash from the applications menu in Ubuntu under Applications Menu > Internet > Electron Cash Bitcoin Cash Wallet.

Wallets

You should now be able to use Electron Cash or Electrum just how you would normally. And once you're done you can destroy the VM to remove your wallets. Use vagrant on your host machine to destroy the VM: vagrant destroy. Make sure if you created any wallets to back them up before deleting the VM. After destroying, if you bring up the VM again it will be a new one without the wallets from before. If you don't want to destroy the VM you can use vagrant suspend to save the VM, and vagrant up to bring it back up again.

Return to top or back to Bitcoin.