This tutorial is part of a series of articles introduced here.
In part 1, we have installed Ethereum on the RPi.
In this tutorial, we will describe the steps to install Ethereum on your computer.
Installing Geth on a computer is quite straightforward. The installation instructions are available for different target platforms, including Linux, Windows and Mac. You can find them right here.
Here below, we describe all the steps to set up Geth on a Mac, as it is the most common configuration amongst developers.
NB: It is important that what we mean by “private Ethereum blockchain” in this context has absolutely nothing to do with the “private blockchain” championed by Hyperledger, Eris/Monax, or the recently announced Enterprise Ethereum Alliance. These are different codebases with different client applications, so they correspond to different implementations of a different set of concepts. They are private in the sense that they limit who has access to their chain. They are also called permissioned blockchains, and to be perfectly transparent, we wish they were not even called blockchains at all. In this series of articles, what we call “private blockchain” is a private instance of the Ethereum implementation. Same code base, same client application, different network identifier and genesis block. In other words, what we will come to create in this series is a chain with the same rules as the main chain, the same consensus algorithm too, but a different root block. This will become clearer in part 3. For more information about the 3-layer model and differences between concepts, implementations and instances, you can also watch our Devoxx talk and read this article.
Step 1 – Homebrew
Homebrew is a package manager that you should install on your computer:
computer$ brew --version
If Homebrew is not installed on your computer, install it using the following command:
computer$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 2 – Install Geth
In this step, we install the Go implementation of Ethereum protocol (Geth).
Geth can be installed with the following commands:
computer$ brew update computer$ brew tap ethereum/ethereum computer$ brew install ethereum
Check the version of Geth using:
computer$ geth version Geth Version: 1.5.7-stable Git Commit: da2a22c384a9b621ec853fe4b1aa651d606cf42b Protocol Versions: [63 62] Network Id: 1 Go Version: go1.7.5 OS: darwin GOPATH= GOROOT=/usr/local/Cellar/go/1.7.5/libexec
Ensure that the version of Geth is the same as the one installed on your RPi. If not, upgrade your nodes.
Step 2.1 – Update Geth
If Geth was already installed on your computer, update it to the latest version:
computer$ brew update computer$ brew upgrade ethereum
If you have trouble to update Geth, use the following commands to force the update:
computer$ brew tap ethereum/ethereum computer$ brew unlink ethereum computer$ brew install ethereum
Check the version of Geth:
computer$ geth version Geth Version: 1.5.7-stable Git Commit: da2a22c384a9b621ec853fe4b1aa651d606cf42b Protocol Versions: [63 62] Network Id: 1 Go Version: go1.7.5 OS: darwin GOPATH= GOROOT=/usr/local/Cellar/go/1.7.5/libexec
Step 3 – Run Geth
Start Geth using the following command:
computer$ geth I1217 19:38:35.080348 ethdb/database.go:83] Allotted 128MB cache and 1024 file handles to /Users/eloudsa/Library/Ethereum/chaindata ... I1217 19:38:35.492125 p2p/server.go:342] Starting Server ... I1217 19:38:47.719187 eth/downloader/downloader.go:326] Block synchronisation started ...
When you start Geth like that, without any command line argument, it immediately starts synchronizing with the main chain, which takes several days.
Press CTRL-C to stop the Ethereum server.
Summary
At this stage, Ethereum is installed on your computer and able to synchronise with the live chain (mainnet).
The blockchain (chaindata) is located right here:
- Mac: ~/Library/Ethereum/chaindata
- Windows: %APPDATA%\Ethereum
- Linux: ~/.ethereum
Your accounts will be stored in a wallet located in this folder:
- Mac: ~/Library/Ethereum/chaindata/keystore
- Windows: %APPDATA%\Ethereum\keystore
- Linux: ~/.ethereum/keystore
Congratulations! Your computer is an Ethereum node.
Part 3 describes how to setup a private chain and a miner node.
Hi Said!!
A really good tutorial!!
I’m trying to install an Ethereum node on my Windows pc, but Homebrew is just for Mac.
You might know how can I do?
Thanks
Hi Leonardo
Thanks for your feedback.
You can install Geth on Windows using the bundle available here: https://ethereum.github.io/go-ethereum/downloads/
Best,
Said
The instructions above worked on my Mac, however when I tried them on my Ubuntu machine they did not. If anyone has trouble installing Ethereum on Linux try the instructions here:
https://www.ethereum.org/cli
Specifically they are:
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
Hi,
Thank you very much for this tutorial! It helped a lot of for my diploma:)
I have one question, maybe you can help me.
I have now one node on raspberry pie. Raspberry Pie is connected now via Ethernet. I connect to Raspberry Pie via terminal using 192.168.0.10 address. It works.
But the problem is, that I try to connect to this node via web3.js using:
var ethWeb3 = new Web3(new Web3.providers.HttpProvider(‘http://192.168.0.220:8042’));
If I check ethWeb3.isConnected() it returns false.
Maybe you can advice me, where can be a problem?
Thanks in advance:)
Hi Thank you so much for detailed tutorial on Integration of Ethereum and IoT.
0
I created two nodes node1 node2 and created two accounts for each node, one being the coinbase
I have created a runnable script to start my nodes like startnode1.sh with the following commands
geth –networkid 4321 –mine –datadir “~/iotproject/node1” –nodiscover –rpc –rpcport “8545” –port “30303” –rpccorsdomain “*” –nat “any” –rpcapi eth,web3,personal,net –unlock “0” –password ./password.sec –ipcpath “~/.ethereum/geth.ipc”
When run the command ./startnode1.sh iam getting the following error
INFO [04-01|21:03:42.160] Maximum peer count ETH=25 LES=0 total=25
INFO [04-01|21:03:42.161] Starting peer-to-peer node instance=Geth/v1.8.23-stable-c9427004/linux-amd64/go1.10.4
INFO [04-01|21:03:42.161] Allocated cache and file handles database=/home/sathi/iotproject/node1/geth/chaindata cache=512 handles=524288
INFO [04-01|21:03:42.293] Initialised chain configuration config=”{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: 7280000 ConstantinopleFix: 7280000 Engine: ethash}”
INFO [04-01|21:03:42.293] Disk storage enabled for ethash caches dir=/home/sathi/iotproject/node1/geth/ethash count=3
INFO [04-01|21:03:42.293] Disk storage enabled for ethash DAGs dir=/home/sathi/.ethash count=2
INFO [04-01|21:03:42.294] Initialising Ethereum protocol versions=”[63 62]” network=4321
INFO [04-01|21:03:42.356] Loaded most recent local header number=0 hash=d4e567…cb8fa3 td=17179869184 age=49y11mo2w
INFO [04-01|21:03:42.356] Loaded most recent local full block number=0 hash=d4e567…cb8fa3 td=17179869184 age=49y11mo2w
INFO [04-01|21:03:42.356] Loaded most recent local fast block number=0 hash=d4e567…cb8fa3 td=17179869184 age=49y11mo2w
INFO [04-01|21:03:42.356] Loaded local transaction journal transactions=0 dropped=0
INFO [04-01|21:03:42.356] Regenerated local transaction journal transactions=0 accounts=0
INFO [04-01|21:03:42.547] New local node record seq=9 id=7beb0be874851b4a ip=127.0.0.1 udp=0 tcp=30303
INFO [04-01|21:03:42.547] Started P2P networking self=”enode://234946b999f54c55f3faeaf892930e0e601049375740364ed63e423dc0cc6aaa68fdc3a5d787c8c336d07dbb776db63178a0de395d61cfe77f8767b02f1593a8@127.0.0.1:30303?discport=0″
INFO [04-01|21:03:42.548] IPC endpoint opened url=/home/sathi/.ethereum/geth.ipc
INFO [04-01|21:03:42.549] HTTP endpoint opened url=http://127.0.0.1:8545 cors=* vhosts=localhost
WARN [04-01|21:03:42.549] ——————————————————————-
WARN [04-01|21:03:42.549] Referring to accounts by order in the keystore folder is dangerous!
WARN [04-01|21:03:42.549] This functionality is deprecated and will be removed in the future!
WARN [04-01|21:03:42.549] Please use explicit addresses! (can search via `geth account list`)
WARN [04-01|21:03:42.549] ——————————————————————-
Fatal: Could not list accounts: index 0 higher than number of accounts 0
Can you help me out….
Hi Said,
I don’t know if the blog is still responsive but it would be of immense help if you can, by any way get in touch, and sort an issue out for me.
The tutorials are great and I thank you for putting these up in detail.
I’m following your YT video for setting and Eth node on Windows, at 18:17 after the startnode.cmd is run, I’m getting
“flag provided but not defined: – minerthreads”. Please let me know how to proceed from here.
it should be –miner.threads