Ethereum: Using the wallet with a private geth node

Today I wanted to share the steps I follow to use the Ethereum wallet with a private blockchain in a development environment. This article follows on from previous articles where a local blockchain was setup using geth. For my dev environment I’ll be using Ubuntu 16 running on VirtualBox in Windows 10.

Previously…

Check out these previous articles which describe setting up the dev environment and other tools I’ll be using:

(Optional) Update Geth

This step may be optional depending on your situation. If you’ve had geth running in a dev environment for a while then it’s worth checking if a newer version is available.

  1. Check your current geth version by opening a terminal and typing:

    geth version
    

    You should see something like the below:

    Geth
    Version: 1.5.9-stable
    Git Commit: a07539fb88db7231d18db918ed7a6a4e32f97450
    Protocol Versions: [63 62]
    Network Id: 1
    Go Version: go1.7.3
    OS: linux
    GOPATH=
    GOROOT=/usr/lib/go-1.7
    
  2. The stable version available at time of writing is 1.6.7.

    StackExchange has a nice answer on updating Mist on Ubuntu which helped me with the next part:

    sudo apt-get install software-properties-common
    sudo add-apt-repository -y ppa:ethereum/ethereum
    sudo apt-get update && sudo apt-get upgrade
    
  3. Lastly, validate that geth was updated successfully:

    geth version
    

    You should see output similar to below confirming the version installed as 1.6.7-stable

    Geth
    Version: 1.6.7-stable
    Git Commit: ab5646c532292b51e319f290afccf6a44f874372
    Architecture: amd64
    Protocol Versions: [63 62]
    Network Id: 1
    Go Version: go1.8.1
    Operating System: linux
    GOPATH=
    GOROOT=/usr/lib/go-1.8
    

Install the Ethereum Wallet

Next you’ll need to download the Ethereum Wallet if it’s not already installed on your machine.

  1. Open a new terminal and type:

    wget https://github.com/ethereum/mist/releases/download/v0.9.0/Ethereum-Wallet-linux64-0-9-0.zip
    

    Wait until the download is complete and you’ll see something like this:

    .
    HTTP request sent, awaiting response... 200 OK
    Length: 57229019 (55M) [application/octet-stream]
    Saving to: 'Ethereum-Wallet-linux64-0-9-0.zip’
    
    Ethereum-Wallet-lin 100%[===================>]  54.58M   794KB/s    in 2m 12s  
    
    2017-08-18 23:12:42 (425 KB/s) - 'Ethereum-Wallet-linux64-0-9-0.zip’ saved [57229019/57229019]
    
  2. Unzip the downloaded file and cd into the newly created directory:

    unzip Ethereum-Wallet-linux64-0-9-0.zip
    cd linux-unpacked
    

    The new directory named /linux-unpacked should contain several files, including the ethereumwallet executable.

Start geth

Now onto more juicy stuff. We’ll need to start geth using a custom data directory. You can use the same setup as described in my article here. If you don’t have a private blockchain created already then check the article and continue from here.

  1. Open a new terminal window and change into the directory that contains privchain. This is the directory containing the private blockchain.

    For me the directory is named /geth/privchain so cd into directory /geth:

    cd geth
    
  2. Now we’ll start geth. The go-ethereum wiki at GitHub has a nice reference for geth’s command line options that I encourage you to explore.

    geth --port 3020 --networkid 58342 --nodiscover --datadir="privchain" --maxpeers=0 --ipcpath $HOME/.ethereum/geth.ipc
    

    After starting the geth node you should see something like IPC endpoint opened: /home/someone/.ethereum/geth.ipc

    Leave geth running in this terminal window.

Launch the Etherum Wallet

Back in the first terminal you should still be in the linux-unpacked directory.

  1. Run the Ethereum wallet by typing the below:

    ./ethereumwallet
    
  2. This next part I honestly couldn’t figure out - the wallet will start downloading the geth binary, even though we don’t need it. I wasted a lot of time but couldn’t resolve this, and in the end just let it run. The output looks like this:

    [2017-08-18 23:38:25.024] [INFO] ClientBinaryManager - Calculating possible clients...
    [2017-08-18 23:38:25.027] [INFO] ClientBinaryManager - 1 possible clients.
    [2017-08-18 23:38:25.027] [INFO] ClientBinaryManager - Verifying status of all 1 possible clients...
    [2017-08-18 23:38:25.029] [INFO] ClientBinaryManager - Verify Geth status ...
    [2017-08-18 23:38:25.069] [ERROR] ClientBinaryManager - Unable to resolve Geth executable: geth
    [2017-08-18 23:38:25.098] [INFO] ClientBinaryManager - Download binary for Geth ...
    

    The unwanted geth binary is downloaded to /home/someone/.config/Ethereum Wallet/binaries/.

    When the wallet has finished downloading geth it should proceed to detect the running geth node and connect. The output should look like this:

    [2017-08-18 23:40:50.327] [INFO] Sockets/3 - Connect to {"path":"/home/someone/.ethereum/geth.ipc"}
    [2017-08-18 23:40:50.333] [INFO] Sockets/3 - Connected!
    [2017-08-18 23:40:50.340] [INFO] main - Connected via IPC to node.
    [2017-08-18 23:40:50.528] [INFO] (ui: splashscreen) - Network is privatenet
    
  3. If instead you see something like the below, hit Ctrl+C to quit the wallet, otherwise you’ll start to sync the actual Ethereum blockchain.

    [2017-08-18 23:44:48.238] [WARN] EthereumNode - Failed to connect to node. Maybe it's not running so let's start our own...
    [2017-08-18 23:44:48.239] [INFO] EthereumNode - Node type: geth
    [2017-08-18 23:44:48.239] [INFO] EthereumNode - Network: main
    [2017-08-18 23:44:48.241] [INFO] EthereumNode - Start node: geth main
    [2017-08-18 23:44:48.284] [INFO] EthereumNode - Start node using /home/someone/.config/Ethereum Wallet/binaries/Geth/unpacked/geth
    

    When this happens (and assuming this is for DEV purposes only and doesn’t matter if you break/lose anything) simply delete the created directory Ethereum Wallet to reset:

    /home/someone/.config/Ethereum Wallet
    

    Note that .config is hidden by default but it can be made visible in Unbuntu Files by hitting Ctrl+H or from the top menu View > Show hidden files.

The Ethereum Wallet

By now hopefully you are looking at the Ethereum Wallet splash screen

ethereum wallet splash

It will say Looking for peers but shouldn’t find any since we’re running a private blockchain with a single geth node.

  1. On the wallet splash screen click LAUNCH APPLICATION

  2. Now the wallet GUI will launch. There’s a few things to note here:

    • We’re connected to PRIVATE-NET with 0 peers, exactly as we’d expect
    • The current block number is 22 (my blockchain is very young)
    • The balance is 110 Ether
    • The last block was mined on this chain a while ago (5 months ago)

    ethereum wallet splash

geth console

We can confirm some of the blockchain details display in the Ethereum wallet by using geth’s interactive javascript console.

  1. Open a new termainal and enter:

    geth attach ipc://home/someone/.ethereum/geth.ipc
    

    You should get a prompt where you can type commands.

  2. Type the below check the default address:

    web3.eth.coinbase
    
  3. We can also check the balance in Ether:

    web3.fromWei(eth.getBalance(eth.coinbase), "ether")
    
  4. Lastly we’ll display the current block number and it’s hash:

    web3.eth.blockNumber
    web3.eth.getBlock(web3.eth.blockNumber).hash
    

This should match the values displayed in the Wallet GUI.

In the next article we’ll use the Ethereum wallet to deploy a simple contract token to the private blockchain.