This article was originally posted on my blog at legobox
Whatโs an ethereum node
With the advent of Bitcoin, blockchain based technologies have gradually become increasingly popular, enabling developers to build decentralized applications which many today view as the solution to a presumably problematic part of the internet, control over data.
Ethereum is unique, in that it attempts to use the same solution of the blockchain to allow anyone the ability to public dapps (decentralized apps) and have them being able to connect directly between providers and clients.
On the ethereum network every client is a node and is a part of the much larger network, therefore in setting up a client, it has to download the entire network's database and transaction readings till date. In this article, we are going to review all there is to the process of setting up an ethereum node on an Ubuntu (Linux) server.
Pre-requisites
Before jumping into configurations and commands related to setting up a node, It's important to be grounded in a few basics, therefore you should know about the following to a somewhat familiar extent.
- The blockchain technology and how it works.
- Managing accounts on the geth clients (thankfully we'll touch on this in the article)
Types of Nodes
There are basically two types of nodes on the network,
- Lightweight nodes
- Full nodes
The Lightweight nodes are meant to run on machines of lower resources and therefore keep a really shallow copy of the blockchain data, while the full node keeps track of all transactions performed on the network and therefore.
In our set up we'll review both systems so as to get a concrete understanding of how to go about the process.
Setting up a Geth Client (Node)
There are many clients for the ethereum blockchain, but the safest and well documented of them all include
- Mist wallet
- Geth wallet The mist wallet is a GUI (graphic user interface) based client, this enables the user to control the wallet via click and all, one can also develop contracts on the mist wallet.
Setting up a mist wallet
To set up the mist wallet, navigate to the etherum home page, then proceed to the download sections, you'll find the download button via which you can download a new version of the mist wallet.
This takes some time to setup because it has to download the blockchain's database, on completion of the download, your computer is effectively at that moment a node on the ethereum network.
Building Contracts on the mist wallet
Building contract on the mist network or the ethereum network, in general, is done in solidity, it's a strongly typed language featuring some symmetricity between C++ and javascript. on the mist wallet creating a contract is as simple as switching to the deployment section and placing your contract's code there and then proceeding to deploy. you can find a good example here.
Setting Up a Geth client wallet.
There are different ways in which one can set up a geth client, for the various operating systems there are.
Setting up for Windows
Ever heard of the Chocolatey package manager, this provides an easy way to get the required build setup and tools installed. to set up and install chocolatey checkout https://chocolatey.org.
Next, we set up the administrator command prompt and install the build tools we need.
C:\Windows\system32> choco install git
C:\Windows\system32> choco install golang
C:\Windows\system32> choco install mingw
Installing these packages will setup the path enviroment variable.
Next, let's ensure Go is installed
C:\Users\xxx> set "GOPATH=%USERPROFILE%"
C:\Users\xxx> set "Path=%USERPROFILE%\bin;%Path%"
C:\Users\xxx> setx GOPATH "%GOPATH%"
C:\Users\xxx> setx Path "%Path%"
C:\Users\xxx> mkdir src\github.com\ethereum
C:\Users\xxx> git clone https://github.com/ethereum/go-ethereum src\github.com\ethereum\go-ethereum
C:\Users\xxx> cd src\github.com\ethereum\go-ethereum
C:\Users\xxx> go get -u -v golang.org/x/net/context
Finally, the command to compile geth
C:\Users\xxx\src\github.com\ethereum\go-ethereum> go install -v ./cmd/...
With all setup, we are good to work with the setup on windows.
Setting up on Linux (Debian)
Installing from ppa
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
If you want to stay on the bleeding edge of things, install the ethereum-unstable
package instead. After installing, run geth account new
to create an account on your node. You should now be able to run geth
and connect to the network.
There are also other options such as building from source
building from source
Build Geth ( command line client )
- Clone the repository to a directory of your choosing
git clone https://github.com/ethereum/go-ethereum
- Install the latest version of Go (v1.7) If you don't have it already
- Building
geth
required Go and C compilers to be installed.
sudo apt-get install -y build-essential golang
- proceed to build using the following command
cd go-ethereum
make geth
- To start the node, run
build/bin/geth
Setting up on Mac
The easiest way to get started with go-ethereum is to run homebrew. to install homebrew check out this
Next, add the tap and install geth
brew tap ethereum/ethereum
brew install ethereum
Managing accounts
always make sure to remember your password
On the geth, client account management is provided via the account command
$ geth account <command> [options...] [arguments...]
This lets you create new accounts, list existing accounts, import private key into a new account, migrating to new key format and changing the password.
We are going to review a few important commands to know.
creating accounts
$ geth account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat Passphrase:
Address: {168sdunina2ee09042d83d7c5811b5334789349934}
Listing accounts
$ geth account list
Account #0: {5afdd78bdacb56ab1dad28741ea2a0e47fe41331} keystore:///tmp/mykeystore/UTC--2017-04-28T08-46-27.437847599Z--5afdd78bdacb56ab1dad28741ea2a0e47fe41331
Account #1: {9acb9ff906641a434803efb474c96a837756287f} keystore:///tmp/mykeystore/UTC--2017-04-28T08-46-52.180688336Z--9acb9ff906641a434803efb474c96a837756287f
Import private key into a node with custom datadir
$ geth account import --datadir /someOtherEthDataDir ./key.prv
The new account will be encrypted with a passphrase.
Please enter a passphrase now.
Passphrase:
Repeat Passphrase:
Address: {7f444580bfef4384839403049823453c9d}
Conclusion
Blockchain technology is still relatively new to many and there's a lot going on in that field, but getting started shouldn't have to be a problem with respect to building dapps and working with decentralized setups. In subsequent writings under this technology, I'd get into the nitty-gritty of solidity and how to go about building and deploying smart contracts.
Top comments (6)
Great tutorial and something I've been interested in setting up myself. Im on the lookout for a service that provides webhook support on to the ethereum network so that I can receive a notification from the hook everytime the balance changes on a particular wallet or wallets. Have you seen anything like this?
Hmm, I'll check this up and get back to you... sounds pretty interesting.
I've been using chain.so for btc ltc doge dash but there's nothing for Eth I've seen yet. Really odd!
The blockchain technologies of Ethereum โ youโre talking about - really impress! There is also a crypto MGO (provided by MobileGo): itโs founded on blockchain and smart contract.
Iโm interested in privacy-based transactions and smart contracts. It also makes me interesting in such cryptocurrencies as ethereum and MGO.
By the way, MobileGo started cooperation with Xsolla not long ago. Itโs expected to be promising for the development of blockchain technologies, payment services, standards of security, etcโฆ
Great instructions, thank you.
Okay what is the next step?
I have it running on my mac using your steps above. While doing so I saw "ETH=25 LES=0 total=25"
Is it safe to say that the accounts were initialized with 25 eth?
If so how do I check the balances?
Check out QuikNode.io -- a Ethereum Node-as-a-Service platform for dApps & developers. Spin up a fully-synced ETH node on MainNet or TestNet (Rinkeby, Ropsten, Kovan) on either Geth or Parity clients in a few minutes. For a fee, but it saves a lot of time and headache managing your own node (time you could invest into developing your application, for example)!