Ethereum
Ethereum
Course 1 covered the basic blockchain concepts, structure, operational details, algorithms and
techniques. We explored some of the blockchain concepts such as hashing and public-key cryptography
in the quizzes associated with the module1, 2 and 3. In this course project, we will explore the following
operations on a blockchain: create nodes on a private Ethereum blockchain, create accounts, unlock
accounts, mine, transact, transfer Ethers, and check balances.
Approach
We have provided a virtual image (VM) that has a preinstalled Ethereum client (Go Language Ethereum –
geth) and graphical user interface (GUI) to invoke the commands to accomplish project tasks. Please
understand that this is not a simulation. You are actually working on local Ethereum nodes on your laptop/
computing device. We have used a virtual image so that the project provides same instructions
irrespective of the computing systems that our diverse learners are working on. It does not require you
to use command line interface (CLI) commands, since the commands are encoded as buttons. This lab
provides quick and easy accessibility to the commands. If you are curious about the list of commands we
used for this lab, it is provided at the end of this lab description.
Learning outcomes
Demonstrate that you can follow the steps to transact on a blockchain, with the concepts learned in the
course such as account, account balance, node, peers, peer-to-peer transaction, genesis block, ethers,
mining and interacting with a private blockchain.
5. Read the instructions and explanations at each step of the interface. You need to click on the buttons
in each of the steps to execute the operation. Learn as you go. Associate the steps you are executing
with lessons in the video. Execution of each operation takes some time depending on the resources
(such as RAM memory) on your computer. Be patient. Pay attention to the notifications request you
to wait until the operation is completed. We have allocated arbitrarily long/generous duration for
each operation to complete. This is to accommodate any computation power variances of the
learners.
In case your interaction stalls due to some reason please do not hesitate to go back and restart. There
are many options for restart, partial or full restart from the beginning. Grading is based on the steps
you complete and not how many times you restarted. You can refer to troubleshooting tips in case
you run into any issues.
Observe the enode values, address[0] or coinbase address of accounts, peer details in JSON format,
creation of accounts in a single node and miner operations. Genesis block is the very first block of a
blockchain. You will observe DAG or directed acyclic graph generation when a miner is started. This
process is needed for the memory based proof of work consensus of Ethereum.
6. Starting and Stopping the Miner
In this project, there is only one miner that is started on the first node. Do not stop the miner until
you complete the transactions. Recall from the lesson a miner is needed to confirm your transactions.
The transactions will never be confirmed if you do not have a miner running.
8. Exploring beyond
This project is always available for you to explore and learn. Do not hesitate to explore further and
try different transactions. We have provided only one miner. You can always restart the VM and try
out various operations including CLI commands given at the end of the document. The same VM will
be used in the Course 3 for development of a Decentralized Application or Dapp.
Summary
In this exercise, you got a feel for setting up your own Ethereum client and working on some basic
operations. We strongly encourage using the Online Discussions to discuss the project with other
students and to resolve any problems you may face.
In the next two courses, you will get to design and develop applications for the Ethereum
blockchain.
Extra Material
In this project, we have already installed geth in the “Ethereum Ubuntu.ova” virtual appliance provided
to you. To make things easier, we have provided a web interface to help you out in interacting with
the geth instance running in the backend. If you are curious here are commands behind those buttons
you clicked. We will learn more details about geth commands and the supporting APIs in Course 3.
1. Create new Accounts: geth account new --datadir ~/Node_1 and geth account new --datadir ~/Node_2
2. Initialize Genesis File: geth init customGenesis.json --datadir ~/Node_1 and geth init
customGenesis.json --datadir ~/Node_2
3. Start Geth:
NODE_1:
geth --datadir ~/Node_1 --maxpeers 95 --networkid 13 --nodiscover --rpc --rpccorsdomain "*" --port 30301
--rpcport 8544 --rpcapi="txpool,db,eth,net,web3,personal,admin,miner"
NODE_2:
geth --datadir ~/Node_2 --maxpeers 95 --networkid 13 --nodiscover --rpc --rpccorsdomain "*" --port 30302
--rpcport 8545 --rpcapi="txpool,db,eth,net,web3,personal,admin,miner"
4. Connect Peers: admin.addPeer(<eNode of the other node>);
5. Peer Count: net.peerCount
6. Peer Details: admin.peers
7. Create New Accounts: personal.newAccount(<password>)
8. List accounts: eth.accounts
9. Check Balance: eth.getBalance(<account>)
10. Start Miner: miner.start(4)
11. Stop Miner: miner.stop()
12. Unlock Accounts: personal.unlockAccount(<address>,<password>,<duration in sec>)
13. Send Transaction: eth.sendTransaction({from:<address>, to:<address> , value: <value>})
14. Check Transaction Status: txpool.status