Want to learn how to run an Ethereum node but dont have $1000s to invest in miners? Would you like to connect, understand and support the ETH network ?

In this tutorial, I am going to show you that by running your own ETH node, it’ll provide you with many benefits. It’ll open up new possibilities, teach you about blockchain technology and how you can help support the ecosystem.
By the time you are finished reading this, you’ll understand how to spin up your own node and take part in validating Ethereum transactions.

Do I need to invest in a Miner?


With the technological advancement of containers, packaged software and the internet, you no longer need to invest in $1000s for ACR miners to run your own Ethereum node. You can either run it on the cloud, on a Raspberry Pi or from your own laptop.

To keep this simple, we will connect to the ETH network using the light sync mode by using your laptop.

However, if you would like to connect to the ETH mainnet, you will need:

  • 4 vCPUs
  • Memory: 16GB RAM
  • Storage: 4TB available space SSD
  • Internet: Broadband connection
  • 2-4 days to fully sync

Which client to use?


The first step in spinning up your node is choosing your approach. You have to choose the client (the software), the environment, and the parameters you want to start with. While there are many mainnet clients(Besu, Go-Ethereum/Geth, Erigon, Nethermind), we have decided to use Geth for this tutorial.

What is Geth?


Geth is a program which serves as a mainnet node for the Ethereum blockchain, where a user can mine Ether and create software which runs on the EVM – the Ethereum Virtual Machine. If you spin up a Geth node with its default values, it will connect to the live Ethereum blockchain (the Mainnet) by default.

Geth has three sync modes.

$ geth --syncmode "full"
$ geth --syncmode "fast"
$ geth --syncmode "light"

"full" runs a full node exactly as you’d expect – your machine initializes a local copy of the EVM in its original clean state, downloads every block since the beginning of the blockchain, and executes every transaction in every block, updating the EVM state until it reaches the present-day EVM state.

** WARNING THIS WILL NEED AT LEAST 2-4TB FOR ARCHIVE

"fast" downloads all blocks, but also downloads a recent snapshot of the EVM state from a peer (currently the state of the EVM 64 blocks in the past), executing transactions in only the most recent blocks until it reaches the current EVM state. The advantage of "fast" is that it takes much less time to synchronize to the present state; however, it relies on a full archival node peer for a state snapshot, so it isn’t verifying everything for itself.


A"light" client or light node is a piece of software that connects to full nodes to interact with the blockchain. Unlike their full node counterparts, light nodes don’t need to run 24/7 or read and write a lot of information on the blockchain. In fact, light clients do not interact directly with the blockchain; they instead use full nodes as intermediaries. Light clients rely on full nodes for many operations, from requesting the latest headers to asking for the balance of an account.

Run A Geth Client In 5 Minutes For Testing

We will use the light mode to quickly start interacting with the blockchain by using Docker:

If you haven’t downloaded it before you can find the instructions here.

To pull the Docker image and start a Geth node in minutes, run these commands:

docker pull ethereum/client-go
docker run -it -p 30303:30303 ethereum/client-go --syncmode "light"

When you run the command, you will get the initial start up like below and start connecting to the mainnet using the light sync mode:

You can easily configure your pathways or by setting the sync mode by adding commands at the end like so:

docker run -it -p 30303:30303 -v /geth-node:/root/.ethereum 
** Please note that you will need to customize your pathway in your Docker.

In addition, if you try to login to the program and run another geth command, it will fail as it can only by ran by one thread only:

Other ways to setup a Geth node

Install on macOS via Homebrew For Testing

The easiest way to install a Geth client is to use the Homebrew tap. If you don’t have Homebrew, install it first.

Run the following commands to add the tap and install geth:

brew tap ethereum/ethereum
brew install ethereum

You can install the master branch using the --devel parameter:

brew install ethereum --devel

The abigenbootnodecheckpoint-adminclefdevp2pethkeyevmfaucetgethp2psimpuppethrlpdump, and wnode commands are also available on your system in /usr/local/bin/.

Find the different options and commands available with geth --help.

Install on Ubuntu via PPAs For Testing

If you are spinning up an ubuntu machine on your laptop, the easiest way to install go-ethereum on Ubuntu-based distributions is with the built-in launchpad PPAs (Personal Package Archives). Here is the single PPA repository that contains both our stable and development releases for Ubuntu versions trustyxenialzesty and artful.

To enable your launchpad repository run:

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

Then install the stable version of go-ethereum:

sudo apt-get update
sudo apt-get install ethereum

Or the develop version via:

sudo apt-get update
sudo apt-get install ethereum-unstable

The abigenbootnodeclefevmgethpuppethrlpdump, and wnode commands are then available on your system in /usr/bin/.

Find the different options and commands available with geth --help.


Conclusion


With these two methods, you would be able to play around with Geth a lot more and validate via the mainnet and also use this for different test networks.

Once you are comfortable with testing these locally or on a machine, we will dive into a more advance way to use a Geth node by using Kubernetes.