Go to course navigation

2 - Ethereum Tooling

What is blockchain?

Simply put, a blockchain is a linked list of records, or blocks. The first block of the chain is called the genesis block. Each block, except for the genesis block, refers to the previous block. Each block contains multiple valid transactions, the hash of the previous block and its own hash. Blocks are validated and mined using proof of work or proof of state mechanisms. Each new block contains the link to the parent block, an address, and the information about the winning miner together with their list of transactions.

Blockchain properties


Blockchains are governed and validated by (usually) a majority of nodes that are able to communicate with each other directly with no central authority involved in their communication. The governing nodes introduce a definition of what a valid block looks like and all nodes participating in the blockchain follow it. For a transaction to be valid, it must be included in a valid block, in practice at least in 6 or 7 blocks.

Distributed ledger

Blockchain is a type of distributed ledger. Distributed ledgers are virtually lists of transactions distributed over all nodes of the blockchain. Each block carries its own transactions and a link to its predecessor block so the whole history of transactions can be easily reconstructed. Distributed ledger is a subordinate term to distributed database, in which two nodes work together. A good example of a distributed database is Google Search, where the data is distributed over several nodes that work together to satisfy the search query. However, the information updates of Google Search are centralized. In blockchain, a majority of nodes must agree on an action.


New blocks of a blockchain can only be appended to the end of the blockchain. The blockchain, or the individual blocks, can never be changed retroactively, because all the subsequent blocks would have to change too. You could, theoretically, rewrite the blockchain’s history if you governed at least 51% of the hashing power in the network (Bitcoin).


Ethereum is a public blockchain platform with its own programming language Solidity and its own cryptocurrency, called Ether (ETH). It was launched in 2015. The original Ethereum whitepaper was written by Vitaly Dmitriyevich “Vitalik” Buterin already in 2013. Unlike Bitcoin, Ethereum is not only a storage database for transactions but contains its own Turing-complete programming code as well. It has two account types – normal and smart-contract account.

Ethereum Virtual Machine (EVM)

The Ethereum Virtual Machine is the environment for transaction execution in Ethereum. Ethereum is not just a distributed ledger like other blockchains. Because it uses smart contracts, it’s a more complex system. The Ethereum website describes it as a distributed state machine and more thoroughly as follows: “[It] is a large data structure which holds not only all accounts and balances, but a machine state, which can change from block to block according to a predefined set of rules, and which can execute arbitrary machine code.” Unlike Bitcoin, which is simply a chain of blocks, Ethereum also includes program states that change. The EVM code cannot be changed, unless there is consensus of the nodes during the proposal phase. The number of tokens stored by individual accounts is contained in the account storage. The smart contracts are also included.

Mnemonic (back-up phrase)

A mnemonic phrase is a set of 12 or more memorable words generated when a cryptocurrency wallet is created. In case your wallet died, was lost or stolen, you can use the mnemonic phrase to restore it. Store your mnemonic carefully! Ethereum mnemonic uses BIP39 protocol.

Test Networks

Testnest are networks used by developers to test both protocol upgrades as well as potential smart contracts in a production-like environment before deployment to Mainnet. Most testnets use a proof-of-authority consensus mechanism. Some well known testnets are Ropsten, Kovan and Rinkeby. Ropsten is a proof-of-work testnet and is most similar to Ethereum. Kovan and Rinkeby use the proof-of-authority mechanism and the so-called faucets to acquire ETH.


There are three types of nodes. Full nodes contain the history of all the blocks in a blockchain, which is very demanding as regards storage and processor performance. They receive new transactions and blocks during validation and verify all blocks and states. Fast nodes save only recent history. Light nodes enable you to connect to a different node that gives you access to its history on demand. They are useful for low capacity devices. One of the most common clients for running nodes is Geth – you’ll learn about it in the next chapter.

Hands-on excercise

Tutorial objectives

We will lern how to generate wallets and how to start an own testnet on Ethereum blockchain.

Tutorial pre-requirements


Computers in the laboratory don’t allow to install programs and save their state between login sessions. Please bring your own hardware for these tutorials.

Create a wallet

Let’s create a crypto wallet! We recommend MetaMask combined with MyCrypto. In this example, we’re going to use the Rinkeby testnet.

  • Create a new wallet in Metamask
    • Set up a password
    • Save Secret Backup Phrase (mnemonic)
    • Enable test networks in settings
    • Switch to Rinkeby Test Network
  • Connect your wallet to MyCrypto
    • Open https://app.mycrypto.com
    • Chose Web3 wallet / Metamask
    • See you account balance
    • Request testnet ETH (this can take some time)
    • Tools / Use Tesstnet Faucet
    • See Faucet transaction status, check balance
    • Find your Faucet transaction on https://etherscan.io

Geth is a command line tool to interact with Ethereum blockchain. It has several subcommands, see yourself.

$ geth --help

You can try to connect to public blockchains.

  • Connect to blockchain
    • As a full node (don’t do this)
    • $ geth
    • As a light node
    • $ geth --syncmode=light
    • To Rinkeby testnet
    • $ geth --syncmode=light --rinkeby
    • Start a local RPC server
    • $ geth --syncmode=light --rinkeby --http
    • Get a balance of your Metamask wallet

      curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["my_address", "latest"],"id":1}' -H 'Content-type: application/json'
         - Request some more Faucet, check the balance update
  • Use integrated web3 library (geth console)
    • $ geth console --syncmode=light --rinkeby
    • Try eth.
    • Silence network updates debug.verbosity(0)
    • Get a balance of your Metamask wallet eth.getBalance("my_address");
    • Drop some more Faucet, re-check the balance
    • Check last block number eth.blockNumber;

Geth command Account enables to create new accounts or display local accounts. You can also create new wallets or retrieve the folder in which your wallet is stored.

  • List local accounts
    • $ geth account list
  • Create a new account
    • $ geth account new
    • Check the path if it contains a public and a private key of your new wallet

Wallets from Metamask can be stored exported to Geth. Now, you can import your wallet to Geth using the import command and your private key.

  • Import Metamask account to Geth
    • Go to Metamask
    • Click on the three dots in the upper right corner
    • Choose account details
    • Click on export private key (never share your private key with anyone!)
    • $ geth account import file.key
    • Check the public address
    • Check the balance

Start your own blockchain (using geth)

Create a Genesis block (genesis.json). You can set initial balance to pre-defined wallets (identified by a public key). Note that the public key address in your file is different from the example. It should correspond to the public key of your exported Metamask wallet.

  • Define genesis.json

      "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip155Block": 0,
        "eip158Block": 0
      "difficulty": "0x40000",
      "gasLimit": "2100000",
      "alloc": {
        "public_address_new_account": { "balance": "30000000000" },
        "public_address_metamask_account": { "balance": "40000000000" }
  • Initialise a local chain with genesis block. If it fails on Fatal: Failed to write genesis block: database contains incompatible genesis delete the geth folder (/Users/xxx/Library/Ethereum/geth).
    • $ geth init genesis.json
  • Start a local chain (not discoverable, why?)
    • $ geth console --nodiscover
    • Check existing accounts eth.accounts;
    • Check account balance eth.getBalance(eth.accounts[0])
    • Unlock your account personal.unlockAccount(eth.accounts[0])
    • Send a transaction eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: 111, gas: 60000}) (it’s a trap, why?)
  • Mine some Ether
    • Set base account for mining miner.setEtherbase(eth.accounts[0])
    • Start mining miner.start()
    • Stop the miner after you commit new mining work miner.stop()
    • Check account balances eth.getBalance(eth.accounts[0]) eth.getBalance(eth.accounts[1])
    • Send (again) the transaction eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[0], value: 111, gas: 60000}) (it’s a trap, why?)
    • Check account balances eth.getBalance(eth.accounts[0]) eth.getBalance(eth.accounts[1])
    • See pending transactions eth.pendingTransactions
    • Start mining miner.start()
    • Stop the miner after you commit new mining work miner.stop()
    • See pending transactions eth.pendingTransactions
    • Check account balances eth.getBalance(eth.accounts[0]) eth.getBalance(eth.accounts[1])

Start your own blockchain (using Ganache)

Now we use pre-setup environment by Ganache.

  • Start Ganache
    • Select Quick Start
  • Connect Metamask
    • Select Network, click Add network
    • Enter Ganache RPC address and Network ID
    • Import some account from Ganache
    • Click on Key on Accounts tab in Ganache and reveal private key
    • Click on Import Account in Metamask and enter private key
    • Send a transaction from Metamask to another Ganache account
    • Check the transaction in Ganache