Monday, March 2, 2015

Develop Solidity Contracts on PoC-8



This is the fastest setup I could come up with that allows you to learn by doing.
This is for learning how to develop Ethereum contracts (not for developing Ethereum itself).

Set up the VM -- you only need to perform these steps one time



  • Add this to your ~/.bashrc file:
    export GOPATH=$HOME/go
    export PATH=$PATH:$GOPATH/bin
    export PATH=$PATH:/usr/local/go/bin
  • Close & re-open bash window.
  • Download the go installation file.
  • cd path-of-downloaded-file
    sudo tar -C /usr/local -xzf downloaded-file
  • sudo add-apt-repository -y ppa:mercurial-ppa/releases
    sudo apt-get install -y mercurial g++
    libgmp-dev libreadline-dev
  • go get github.com/tools/godep
    go get github.com/ethereum/go-ethereum/cmd/ethereum

    cd ~/go/src/github.com/ethereum/go-ethereum
    git checkout develop
    godep go install -v ./cmd/ethereum
  • ethereum account new
    (and enter a passphrase)
  • Take a snapshot of the VM. Name it: "go-ethereum develop branch".

    • Take a snapshot of the VM. Name it: "chrome browser". 

    • Install ethereum.js, this is necessary to make your JavaScript communicate with your contracts.
    • Take a snapshot of the VM. Name it: "ethereum.js".


    • Install a web server (so we can access the go-ethereum clients):
      (Substitute yellow highlights with appropriate info.)

      Download XAMPP web server from here.

      cd path-where-xampp-was-downloaded
      chmod 755 xampp-filename
      sudo ./xampp-
      filename
      Accept all defaults when installing XAMPP.
    • Make the web server launch at boot-up every time:
      sudo ln -s /opt/lampp/lampp /etc/init.d/lampp
      sudo update-rc.d lampp start 80 2 3 4 5 . stop 30 0 1 6 .
       
    • Take a snapshot of the VM. Name it: "xampp web server".

    • Get the files that will be served up:
      mkdir -p ~/src && cd ~/src

      mkdir -p ~/src/gists && cd ~/src/gists


      git clone https://gist.github.com/2b57ad41419908cf6b8c.git

      git clone https://gist.github.com/a9b10d3c58f7f434c0f1.git


      sudo mkdir -p /opt/lampp/htdocs/dev


      npm install bignumber.js
      sudo cp -R
      ~/node_modules/bignumber.js/*.js
      /opt/lampp/htdocs/dev
      npm install ethereum.js
      sudo cp ~/node_modules/ethereum.js/dist/*.js /opt/lampp/htdocs/dev

      sudo cp ~/src/gists/2b57ad41419908cf6b8c/balance.html /opt/lampp/htdocs/dev

      sudo cp ~/src
      /gists/a9b10d3c58f7f434c0f1/contract.html /opt/lampp/htdocs/dev 
    • Take a snapshot of the VM. Name it: "files to be served". 

    • sudo add-apt-repository -y ppa:ethereum/ethereum-qt
    • Build the develop branch of cpp-ethereum -- while following the build instructions, if any issues crop up (such as packages held back, unable to upgrade, etc), then address them first before proceeding.
    • sudo ln -s ~/src/cpp-ethereum/build/eth/eth /usr/bin/eth
    • sudo ln -s ~/src/cpp-ethereum/build/alethzero/alethzero /usr/bin/alethzero
    • Take a snapshot of the VM. Name it: "build cpp-ethereum develop branch".


    • Install cpp-ethereum from the Ubuntu PPA (so you can use solc, the Solidity compiler):
      sudo add-apt-repository -y ppa:ethereum/ethereum-qt
      sudo add-apt-repository -y ppa:ethereum/ethereum

      sudo apt-get dist-upgrade -y &&
      sudo apt-get update -y
      sudo apt-get install -y cpp-ethereum
    • Take a snapshot of the VM. Name it: "cpp-ethereum ppa".


    • From the Terminal, run the GUI client:
      alethzero
    • Make sure this menu item is check-marked:
      Debug > Force Mining
    • Also, make sure this menu item is check-marked:
      Debug > Use Private Chain...
      (Enter the name for your private chain as "PrivateChain".)
    • Exit Ubuntu and take a snapshot of the VM. Name it: "Local Testnet".
    • From now on, every time you launch AlethZero these settings should already be set this way.
    • Take a snapshot of the VM. Name it: "alethzero settings". 

    • wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
    • git clone https://github.com/ethereum/pyethereum.git
    • cd pyethereum && python setup.py install


    Launch the tools that allow us to start developing smart contracts

    • Close all programs and re-boot the VM.
      (The web server automatically launches at boot-up.)
    • From a Terminal window, run:
      alethzero
      Minimize AlethZero to put it in the background.
    • From a Terminal window, run:
      ethereum account(and copy the address that appears in curly braces -- edit the address by removing every "0x" that occurs prior to each two-digit hex value. So, for example, the address "0x7f0xe00x01..." needs to be changed to "7fe001...")
    • ethereum --mine --rpc --unlock=address:password
      Wait for it to generate DAG -- this takes a long time.
      DAG generation is done when it displays messages: "Hash rate: x Khash", where x is non-zero -- this also takes a long time.
    • Launch the Chrome browser and go to:
      http://localhost/dev/balance.html
    • Click the button "watch balance"
      If it displays a non-zero balance, then you have successfully communicated from a JavaScript program to a contract on Ethereum!
    • Continue with steps 5 through 8 in this forum posting here -- but remember that you must wait at least 12 seconds after loading each contract before you can interact with it.

      To compile solidity code, you can either use the web-based compiler you bookmarked earlier or you can call solc as follows:
      solc --input-file mySource.sol --json-abi file --binary file
      (two files will be created that contain the abi and binary info respectively.)

      Every time you create a contract from JavaScript you must: (1) Confirm a popup window from AlethZero that asks you to "Reject" or "Allow" the contract -- click on "Allow". (3) Open AlethZero and note the first few characters of the pending contract. (4) In AlethZero, click "Mine" then click "Go" and wait for the pending contract to become a contract. (5) Go back to the Chrome browser and continue to interact with the contract.

    Sunday, March 1, 2015

    How to build cpp-ethereum PoC-8

    The instructions at this page:
    https://github.com/ethereum/cpp-ethereum/wiki/Building-on-Ubuntu
    are excellent, but are missing a few steps.

    Before you begin, create a VirtualBox VM with Ubuntu 14.04.1 installed in it.
    Before you begin take a snapshot of the VM. Name it: "Before poc-8".

    I've shortened the instructions by only describing how to install on 64-bit Ubuntu (the whole process took me more than an hour):

    sudo apt-get -y update && sudo apt-get -y dist-upgrade
    sudo apt-get -y install language-pack-en-base

    sudo dpkg-reconfigure locales
    sudo apt-get -y install software-properties-common

    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -

    sudo add-apt-repository -y "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5-binaries main"

    sudo add-apt-repository -y ppa:ethereum/ethereum
    sudo add-apt-repository -y ppa:ethereum/ethereum-dev

    sudo apt-get -y update

    got a signature verification error, so "some index files failed to download"

    sudo apt-get -y dist-upgrade

    sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev libjsoncpp-dev libargtable2-dev clang-3.5 lldb-3.5

    sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget libjsoncpp-dev libargtable2-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev clang-3.5 lldb-3.5


    Download the latest Qt:

    mkdir -p ~/src && cd ~/src

    wget http://download.qt-project.org/official_releases/online_installers/qt-opensource-linux-x64-online.run

    chmod +x qt-opensource-linux-x64-online.run


    For the following command, accept the installation defaults.
    (This took more than ten minutes to complete.)

    sudo ./qt-opensource-linux-x64-online.run

    Add the following to ~/.bashrc (but replace the yellow highlight with the correct folder name):

    export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib:$LD_LIBRARY_PATH
    export PKG_CONFIG_PATH=$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH

    export CMAKE_PREFIX_PATH=~/Qt/5.4/gcc_64

    Then close and re-open your Terminal window.


    Build JSON-RPC library:
    mkdir -p ~/src
    cd ~/src
    git clone https://github.com/cinemast/libjson-rpc-cpp
    cd libjson-rpc-cpp && git checkout tags/v0.3.2
    mkdir -p build && cd build && cmake .. && make
    sudo make install
    sudo ldconfig


    Get the ethereum cpp source code and build it:
    cd ~/src && git clone https://github.com/ethereum/cpp-ethereum
    cd cpp-ethereum && mkdir -p build

    Execute the following line any time you want switch to another PoC build, just replace the yellow highlight with the appropriate tag ID (call  git tag  to list all IDs):
    cd ~/src/cpp-ethereum/build && git checkout poc-8-tag && cmake .. && make -j2

    While building neth, I got these errors:
    npm ERR! fetch failed https://registry.npmjs.org/win-release/-/win-release-1.0.0.tgz
    npm ERR! fetch failed https://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz



    Take a snapshot of the VM. Name it "cpp-ethereum poc8".


    Now you can call "alethzero" to run the GUI, or call "eth" for the command-line.
    Read here for the CLI (command-line interface) instructions.

    Wednesday, February 25, 2015

    How to do Ethereum Contract Development using the PoC-7 VMWare Image

    Please use the instructions at this page instead -- I was never able to get a return value from a contract using the setup described below.


    These are my instructions for a fast setup of an environment that allows you to learn by doing without explaining what's under the hood -- in essence I'm trying to do the Ethereum equivalent of letting people drive cars without having to learn how an internal combustion engine works.

    So, this setup is intended for people who want to develop Ethereum contracts (not for developing Ethereum itself).
    Please let me know if there are any mistakes, missing information or dead links.

    First, download the VMWare image from here


    magnet:?xt=urn:btih:524badd3fc667452dde3e7a72f67b86d261aaae8&dn=Ethereum%20VM&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce

    Also, you need to download the appropriate VMWare software:

    While those are downloading here's some info you may be interested in

    • Once I set up the VMWare image, I tried to upgrade Ubuntu which resulted in the VM being unable to boot afterwards -- I recommend never upgrading Ubuntu in this VMWare image.
    • I tried to load the VMWare image into VirtualBox without success (it resulted in an Ubuntu VM with no Ethereum software installed) -- I'm avoiding using this in VirtualBox until Ethereum releases a more stable system.

    Set up the VM -- you only need to perform these steps one time

    • Take a snapshot of the VM. Name it: "Before setting up contract dev".
    • Launch the VM. (the VM password is "password".)

    • Modify  keyboard so that "Text entry settings" are for US instead of UK -- otherwise the double-quote and pipe characters will be mapped to the wrong keys.


    • WARNING: Do not install the Mist browser because it breaks AlethZero.
      Install the Mist browser -- you will use Mist for uploading contracts. Included with Mist is the "ethereum" command which supports JSON-RPC for the JavaScript/HTML GUI that runs in Chrome.


    • Install a web server (so we can access the go-ethereum clients):
      (Substitute yellow highlights with appropriate info.)

      Download XAMPP web server from here.

      cd path-where-xampp-was-downloaded
      (In my case I downloaded: xampp-linux-x64-5.6.3-0-installer.run)
      chmod 755 xampp-linux-x64-5.6.3-0-installer.run
      sudo ./xampp-linux-x64-5.6.3-0-installer.run

      Accept all defaults when installing XAMPP,
      but at the very end do not launch XAMPP.

      Get the files that will be served up:
      mkdir -p ~/src && cd ~/src
      git clone https://github.com/MikeMcl/bignumber.js.git
      git clone https://github.com/ethereum/ethereum.js.git
      git clone https://gist.github.com/2b57ad41419908cf6b8c.git
      git clone https://gist.github.com/a9b10d3c58f7f434c0f1.git
      sudo mkdir -p /opt/lampp/htdocs/dev
      sudo cp -R ~/src/bignumber.js/* /opt/lampp/htdocs/dev
      sudo cp ~/src/ethereum.js/dist/* /opt/lampp/htdocs/dev
      sudo cp ~/src/2b57ad41419908cf6b8c/balance.html /opt/lampp/htdocs/dev
      sudo cp ~/src/a9b10d3c58f7f434c0f1/contract.html /opt/lampp/htdocs/dev


      Make the web server launch at boot-up every time:
      sudo ln -s /opt/lampp/lampp /etc/init.d/lampp
      sudo update-rc.d lampp start 80 2 3 4 5 . stop 30 0 1 6 .


      Open Chrome browser and bookmark these two locations:
      http://localhost/dev/balance.html
      http://localhost/dev/contract.html


    • On the desktop, double-click on "Link to alethzero".
    • Make sure this menu item is check-marked:
      Debug > Force Mining
    • Also, make sure this menu item is check-marked:
      Debug > Use Private Chain...
      (Enter the name for your private chain as "PrivateChain".)
    • Exit Ubuntu and take a snapshot of the VM. Name it: "Local Testnet".
    • From now on, every time you launch AlethZero these settings should already be set this way.

    • Take a snapshot of the VM. Name it: "Contract dev environment". 
    Note: A lot of these setup details came from a forum posting by drcode.

    Launch the tools that allow us to start developing smart contracts

    • Optional: To delete a previous blockchain, type this into a terminal window:
      rm -rf /home/ethereum/.ethereum
    • From a Terminal window, run:
      ethereum
      (Note: You can run Mist (misted) or the "ethereum" app (ethereum), but you can not run both at the same time.)
    • Launch the Chrome browser and go to:
      http://127.0.1.1/balance.html
    • Click the button "watch balance" (NOT WORKING)


    • Double-click the desktop icon called "Link to alethzero".
    • To compile solidity code:
      cd
      ~/src/cpp-ethereum/build/solc && ./solc

    Mine some fake Ether

    • After launching AlethZero, click the "Mine" button so it's enabled (depressed).
    • Then click the "Go" button.
      (If at any time the "Mine" button does not do anything, then also click the "Go" button.)
    • Once you've got about 15,000 Finney, click the "Mine" button again so it's disabled.
    • Basically we only mine when we need to get some currency units to run tests or to get a transaction (including contract submission and execution) to go through. Otherwise we keep mining disabled so we don't waste CPU cycles.

    Send Ether from one account to another

    • Choose menu item: Tools > New Address
      (You should see a new address appear on the left side in "Owned Accounts".)
    • To copy the new address into your copy buffer double-click on it -- yeah, I know that's not standard behavior.
    • Then paste the address into the "To" field.
    • Enter an Amount that's less than what you have -- remember to set the units: the smallest units are at the top of the list.
    • Delete all info from the "Data" field.
    • Click "Execute".
    • Click on the "Mine" button so it enables mining.
      Wait for the transaction to disappear from "Pending".
    • Wait some more for an amount to appear at the new address -- where it used to say "0 wei" it should now show the amount you sent.
    • Click on the "Mine" button so it disables mining.


    Manually load a contract

    • For now I only load Serpent contracts because some fundamental aspects Solidity didn't work at all when I tried it last time (on PoC-7 & PoC-8).
    • Paste the Serpent code into the "Data" field in the upper-left and click the "Execute" button.
    • Make absolutely certain that the indentations are perfect when using Serpent. Do not mix tabs and spaces (I only use spaces). And each level of indentation must be the same throughout the code. When I pasted code it usually messed up the spacing so I always had to re-edit the code.
    • Here's the sample code I tested:
    def code():
        return(msg.data[0]*2)
    • You will always see the message "LLL Parse error" -- ignore it.
      As long as you see compiled code below the LLL error then it compiled correctly.
    • Remember that you cannot submit a contract unless the "To" field is blank.
    • Make sure the "Mine" button is still disabled, then press "Execute".
    • On the right side you will see your contract appear in the "Pending" window. Make note of the first few characters of the contract address.
      For example, mine shows: 5e70af27... +> 7790f06c...
      So, in my example the contract address begins with "7790".
      When you get lots of contracts loaded it will be important to write this info so you can keep things straight.
    • Click on the "Mine" button so it enables mining.
      Wait for the contract to disappear from "Pending" and appear in "Contracts".
    • Click on the "Mine" button so it disables mining.

    Manually call the contract

    • Copy the address of the contract by double-clicking on the contract address on the right side.
    • Paste the address into the "To" field.
    • Delete the code from the "Data" field and replace it with the parameters you wish to pass to the contract, one parameter per line.
      In our example contract it only takes one parameter, so enter an integer (Ethereum does not currently handle floating point numbers by the way).
      Also, if you have a parameter that is an Ethereum address, you must put "0x" before the address for it to understand it properly.
    • To call the contract, press the "Execute" button -- if the Execute button is disabled, simply set "Amount" to zero and the button should re-enable (I wasted many hours figuring that one out).
    • You will again see the calling message appear in the "Pending" section.
    • Click on the "Mine" button so it enables mining.
      Wait for the message to disappear from "Pending".
    • Click on the "Mine" button so it disables mining.
    • Note that we don't have any way of retrieving the return value when calling manually. For that we need to call from JavaScript.

    Call the contract from JavaScript

    • This is a mystery to me. I've been trying to do this for months without success. I'll update this blog post once I get something to work.

    Learn more


    This blog post is intended to get you up and running without much explanation.
    For a detailed explanation of what's really going on, be sure to check out KenK's three excellent tutorials:

    Tutorial 1:
    https://forum.ethereum.org/discussion/1634/tutorial-1-your-first-contract/p1

    Tutorial 2:
    https://forum.ethereum.org/discussion/1635/tutorial-2-rainbow-coin

    Tutorial 3 (JavaScript API for Ethereum):
    https://forum.ethereum.org/discussion/1636/tutorial-3-introduction-to-the-javascript-api

    Monday, February 23, 2015

    How to Install Mist

    Please use the instructions at this page instead -- I was never able to get a return value from a contract using the setup described below.



    I was able to install Ethereum's DApp browser, called Mist, by following these steps.

    WARNING: When I installed Mist it broke my AlethZero installation -- I do not know how to get both working at the same time.
    First, create an Ubuntu 14.04.1 VM using VirtualBox.
    Before you proceed, take a snapshot of your VM.

      Install Prerequisites for Mist

      sudo apt-get install -y golang
      mkdir -p ~/go; echo "export GOPATH=$HOME/go" >> ~/.bashrc
      echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc
      source ~/.bashrc

      sudo apt-get install -y libgmp3-dev libreadline6-dev

      sudo apt-get install -y mesa-common-dev libglu1-mesa-dev
      sudo apt-get install -y pkg-config
      sudo add-apt-repository -y ppa:beineri/opt-qt541-trusty
      sudo apt-get update -y
      sudo apt-get install -y qt54quickcontrols qt54webengine
      source /opt/qt54/bin/qt54-env.sh

      sudo apt-get install -y g++ 
      go get -u github.com/obscuren/qml
      cd $GOPATH/src/github.com/obscuren/qml && git checkout v1 
      go build
      sudo add-apt-repository -y ppa:mercurial-ppa/releases
      sudo apt-get install -y mercurial meld


      Install Mist & Ethereum-App

      go get -u github.com/ethereum/go-ethereum/cmd/mist

      We must use the "develop" branch so we have synchronous RPC support:
      cd $GOPATH/src/github.com/ethereum/go-ethereum 
      git checkout develop
      cd cmd/ethereum && go build


      Create a new file that launches Mist:
      gedit $GOPATH/bin/misted

      And put this text inside of the file:
      #!/usr/bin/env bash
      cd $GOPATH/src/github.com/ethereum/go-ethereum/cmd/mist && mist


      And make it executable:
      chmod +x $GOPATH/bin/misted

      Make sure Mist launches by typing this at the Terminal:
      misted


      Create a new file that launches the "ethereum" app:
      gedit $GOPATH/bin/ethereumed

      And put this text inside of the file:
      #!/usr/bin/env bash
      cd $GOPATH/src/github.com/ethereum/go-ethereum/cmd/
      ethereum
      ./ethereum -mine -rpc

      And make it executable:
      chmod +x $GOPATH/bin/ethereumed

      Make sure the "ethereum" app launches by typing this at the Terminal (there is no GUI with this app):
      ethereumed


      Take a snapshot of your VM. Save it as "Mist installed".

      Tuesday, February 17, 2015

      How to build cpp-ethereum PoC-7

      Please use the instructions at this page instead -- I was never able to get a return value from a contract using the setup described below.


      The instructions at this page:
      https://github.com/ethereum/cpp-ethereum/wiki/Building-on-Ubuntu
      are excellent, but are missing a few steps.

      Before you begin, create a VirtualBox VM with Ubuntu 14.04.1 installed in it.
      Also, take a snapshot of the basic OS install.

      I've compacted the instructions for someone who wants to only install a headless version (no GUI) of PoC-7:

      sudo apt-get -y update && sudo apt-get -y install language-pack-en-base
      sudo dpkg-reconfigure locales
      sudo apt-get -y install software-properties-common
      wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
      sudo add-apt-repository -y "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5-binaries main"
      sudo add-apt-repository -y ppa:ethereum/ethereum
      sudo add-apt-repository -y ppa:ethereum/ethereum-dev
      sudo apt-get -y update && sudo apt-get -y upgrade
      sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget libjsoncpp-dev libargtable2-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev clang-3.5 lldb-3.5
       
      mkdir -p ~/src
      cd ~/src
      git clone https://github.com/cinemast/libjson-rpc-cpp
      cd libjson-rpc-cpp && git checkout tags/v0.3.2
      mkdir -p build && cd build && cmake .. && make
      sudo make install
      sudo ldconfig

      cd ~/src && git clone https://github.com/ethereum/cpp-ethereum
      cd cpp-ethereum && git checkout poc-7
      mkdir -p build && cd build
      cmake .. -DHEADLESS=1 -DEVMJIT=1
      make -j2
      
      
      Take a snapshot of the VM. Name it "cpp-ethereum poc7".
      Now play around with the "eth" command.

      How to install ethereum.js

      The installation instructions on this page:
      https://github.com/ethereum/ethereum.js
      are missing some steps.

      Here are the full instructions for installing ethereum.js on Ubuntu 14.04.1:
      sudo apt-get install -y curl
      curl -sL https://deb.nodesource.com/setup | sudo bash -
      sudo apt-get install -y nodejs
      npm install ethereum.js

      Sunday, February 15, 2015

      How to Set up a Test Network for Ethereum

      Please use the instructions at this page instead -- I was never able to get a return value from a contract using the setup described below.

       

       

      Why set up the Testnet

      The purpose of this setup is so you can develop smart contracts -- not for developing Ethereum itself.

      Set up the VM

      Create a VirtualBox Virtual Machine and install Ubuntu 14.04.1 inside of it -- name this VM "EthDev".
      The VM should have 4096 MB of Base Memory.
      Launch the EthDev VM and run these commands:

      sudo add-apt-repository ppa:ethereum/ethereum
      sudo apt-get update
      sudo apt-get install ethereum

      At this point you should make sure Ubuntu is set up exactly the way you like it, because we are going to clone the VM and you don't want to have to set that stuff up twice. (I like to make sure that VirtualBox Guest Additions are installed and that various command line settings that I prefer have also been set up.)

      Now that your VM is set up, exit the VM.
      Go to the VirtualBox Manager and open the Settings window.
      Tick "Enable Network Adapter" for only one Adapter and be sure it is "Attached to" "Bridged Adapter".

      Clone VM

      Clone the VM and name it "EthTestNet" and tick "Reinitialize the MAC address of all network cards".
      Launch the EthTestNet VM and run this command:

      sudo gedit /etc/hostname
      sudo gedit /etc/hosts

      In the editor, change the name of the machine to "EthTestNet" and save the file.
      Exit the VM.
       Go to the VirtualBox Manager and change the EthTestNet VM's Base Memory to 3072 MB.
      Re-launch the EthTestNet VM.


      Launch EthTestNet

      Figure out what your IP address is by typing:

      ifconfig

      Make a note of the EthTestNet IP address.
      (In my case it is: 192.168.0.2)
      From the command line run:

      which eth
      Make a note of the path to the eth program.
      (In my case it is located at: /usr/bin)
      From the command line run the following, but replace the highlighted text with the IP and path for your machine:

      cd /usr/bin && ./eth -u 192.168.0.2 -l 30300 -d /tmp --upnp off

      Minimize the EthTestNet VM so it keeps running in the background.

      Launch EthDev

      EthDev is where you will run the GUI client program, AlethZero.
      This is where you can do all your development of smart contracts.

      From the command line run:



      alethzero

      When the GUI client appears, choose menu: Network > Use UPnP (un-check)
      Then: Network > Connect to Peer...
      Then enter this peer (but substitute the highligted text with your own IP):

      192.168.0.2:30300
      Note that the port is "30300" (which is different from the default "30303").

      Now click the "Go!" button.
      You should see, at the bottom of the window, the text that used to say "0 peer(s)" now shows you connected to peers.

      Mine (fake) Ether

      Select menu item: Debug > Force Mining (should have a check next to it).
      Then click the "Mine" button.
      You should see, at the bottom of the window, the text that used to say "0 wei" now shows you mining fake Ether (the smallest unit is wei).

      Develop Smart Contracts

      Now you're ready to develop smart contracts.