Step-by-Step Guide To Setting Up An Ethereum Proof Of Stake Node Locally Using Geth And Prysm!

author

Calibraint

Author

July 26, 2023

Last updated: September 29, 2023

Ethereum proof of stake

Ethereum 2.0: A Prologue To Ethereum Proof Of Stake

Welcome, pioneers of the decentralized frontier! If you’ve ever been captivated by the remarkable potential of blockchain technology, then Ethereum 2.0 undoubtedly holds a special place in your heart. Nonetheless, setting up your very own Ethereum proof of stake node is a thrilling endeavor that allows you to become an active participant in this decentralized movement. 

By following this comprehensive step-by-step guide, you will unravel the puzzle surrounding the combination of two powerful companions: Geth and Prysm—the key to unlocking the gates of Ethereum proof of stake node! Throughout this blog, we will also equip you with the knowledge to set up an Ethereum proof of stake node locally, fastening your role as a trustable contributor in the Ethereum universe. 

So are you ready to dive into the depths of blockchain magic, gaining insights into the mechanics of Proof of Stake (PoS) and witnessing the birth of a network that prioritizes efficiency and inclusivity? 

Let’s venture forth and unlock the full potential of Ethereum 2.0—one block at a time! But before we jump right in, let us first understand what Ethereum 2.0 exactly is.

What Is Ethereum 2.0?

Ethereum 2.0, also known as ETH 2.0 or Serenity, is a major upgrade to the Ethereum blockchain network. It is a highly anticipated evolution of the existing Ethereum platform, designed to improve scalability, security, and sustainability. Ethereum 2.0 aims to address some of the limitations of the current Ethereum network, particularly its capacity to handle a growing number of transactions and smart contracts.

What Are The Key Features Of Ethereum 2.0?

The key features and improvements of Ethereum 2.0 include:

Key features of Ethereum 2.0

Proof of Stake (PoS): Ethereum 2.0 is transitioning from the current Proof of Work (PoW) consensus mechanism, where miners solve complex mathematical puzzles to validate transactions, to Proof of Stake. In PoS, validators are chosen to create new blocks and validate transactions based on the number of coins they hold and “stake” as collateral. This shift to ethereum proof of stake is expected to make the network more energy-efficient and secure.

Shard Chains: Ethereum 2.0 introduces a concept called shard chains, which enables the network to process transactions in parallel. The current Ethereum network operates on a single chain, which can become a bottleneck as the number of transactions increases. Shard chains divide the network into smaller pieces (shards) that can process transactions independently, significantly improving scalability.

Improved Scalability: With the combination of Proof of stake ethereum and shard chains, Ethereum 2.0 aims to achieve a much higher throughput of transactions compared to the current Ethereum network. This improvement is crucial for enabling decentralized applications (DApps) and smart contracts to function efficiently even during times of high network activity.

Beacon Chain: The upgrade introduces the Beacon Chain, which serves as the PoS blockchain responsible for coordinating validators, managing consensus, and organizing the network’s PoS protocol. The Beacon Chain operates separately from the current Ethereum chain and is a core component of Ethereum 2.0. 

Enhanced Security: Proof of stake ethereum introduces a mechanism where validators can be penalized for dishonest behavior or attempting to attack the network. This design is intended to enhance the overall security of the network by encouraging honest participation and discouraging malicious activities.

The Ethereum 2.0 upgrade is being implemented in multiple phases to ensure a smooth transition from the current Ethereum network to the new one. The transition from PoW to ethereum PoS network, as well as the introduction of shard chains, represents a fundamental change in how the Ethereum blockchain operates and holds the potential to significantly improve its overall performance and usability.

Now before we get into the in-depth understanding of running an Ethereum 2.0 node with Geth and Prysm in your local system, let us first understand what Geth and Prysm are all about. 

What Is A Geth Client? 

Geth, short for “Go Ethereum,” is one of the most widely used client implementations for the Ethereum blockchain network. It is written in the Go programming language and serves as a command-line interface (CLI) application that allows users to interact with the Ethereum network.

Geth in short functions as an Ethereum client, enabling various operations such as creating and managing Ethereum accounts, sending and receiving transactions, deploying and interacting with smart contracts, and synchronizing with the Ethereum blockchain. It acts as a bridge between users and the Ethereum network, providing access to the decentralized ecosystem.

What Is Prysm?

Prysm refers to an Ethereum proof-of-stake client written in Go. It is one of several clients being developed for Ethereum 2.0, alongside other implementations like Lighthouse (Rust), Nimbus (Nim), and Teku (Java), among others. These different clients provide redundancy and diversity in the network, making it more resilient and decentralized. 

prysm validator

How To Run An Ethereum 2.0 Node With Geth And Prysm In Your Local System? 

Running an Ethereum proof of stake node with Geth and Prysm on your local system requires a bit of setup, but it can be a rewarding experience to participate in the Ethereum network’s Proof-of-Stake consensus. 

In a blockchain network, a DevNet is essentially an independent and isolated network designed specifically for developers. It offers a safe environment where developers can freely experiment with smart contracts, create decentralized applications (dApps), and explore new blockchain features. 

The primary advantage of using a DevNet is that it operates separately from the main blockchain network, ensuring that any tests or trials conducted there do not have any impact on the main network or pose risks to real cryptocurrency. For developers seeking a convenient option for testing and development purposes, these specialized networks which are commonly referred to as devnets or development networks can be of huge help. 

Hence, in this section, we will provide a detailed guide on setting up the Geth and Prysm clients specifically for the Ethereum POS Network. It’s worth noting that there are alternative tools and clients available, and the setup process may differ based on the ones you choose.

Nevertheless, more complicated applications might require a setup that is more akin to the real Ethereum blockchain, in which case creating a local chain from scratch is the preferable course of action. Therefore, we will also cover the steps to build a local Ethereum chain with a proof-of-stake mechanism, starting right from the foundational level.

Embrace the full potential of decentralized technology with our cutting-edge DApp Development services!

Setting Up An Ethereum Proof Of Stake (Pos) Development Network

How to set up an Ethereum proof of stake (Pos)

Setting up an Ethereum Proof of Stake (POS) Development Network involves several steps. Here’s a brief overview of the process:

Install The Ethereum Client Software: Installing the execution and consensus clients is required in order to run an Ethereum node. The two most widely used execution and consensus clients at the moment are Prysm and Geth. 

Configure The Clients: Once you have installed the client software, you will need to configure it to connect to the test network. You will also need to configure the client to use the correct network ID, genesis block, and other parameters.

Generate The Genesis Block: The Genesis Block is the first block of the blockchain, and it contains the initial configuration and settings of the ethereum Proof of Stake network. You will need to generate a Genesis Block that specifies the initial parameters for your development network.

Start The Beacon Chain Node: The Beacon Chain is a separate chain that coordinates the consensus mechanism for the entire ethereum Proof of Stake network. You will need to run a beacon node to participate in the consensus mechanism.

Start The Validator Node: To participate in the ethereum Proof of Stake consensus mechanism, you will need to run a validator node. The validator node will be responsible for validating transactions and blocks on the network.

Connect Validator To Beacon Chain: Once your Validator node is up and running, you will need to connect it to the Beacon Chain node. This connection will allow your validator to participate in the consensus mechanism and validate transactions and blocks.

Test The Network: Once everything is set up, you can start testing your development network by sending transactions and validating blocks.

The Essentials Elements Required To Run An “Ethereum Node”

To run an “Ethereum Node”, two essentials are required:

Execution Client: An execution client in Ethereum is a type of software that participates in the execution of transactions and smart contracts on the Ethereum network. It is in charge of obtaining transactions from other network nodes, checking their legitimacy, and executing them on the blockchain.

Geth is written in Go and is one of the most popular Ethereum clients. It supports both Proof of Work (PoW) and Proof of Stake (PoS) consensus mechanisms and is known for its stability and ease of use.

Consensus Client: Consensus clients are a crucial component of the Ethereum network as they are responsible for participating in the consensus process to reach an agreement on the state of the blockchain. 

Prysm is an Ethereum client that focuses on the Proof of Stake (PoS) consensus mechanism, specifically for Ethereum 2.0. It is written in Go and is designed to be modular, scalable, and easy to use.

Manual Setup Built From Source

A manual installation will require git and the Go programming language. Hence, for the same install the most recent version of Go and then check your installation with:

go version

Next, create a folder named “devnet” and navigate to it.

mkdir devnet && cd devnet

Clone the go-ethereum repository and build it:

git clone https://github.com/ethereum/go-ethereum 
cd go-ethereum
make geth
cp ./build/bin/geth ../geth
cd ..

Clone the Prysm repository and build the following binaries.

git clone https://github.com/prysmaticlabs/prysm 
cd prysm
go build -o=../beacon-chain ./cmd/beacon-chain
go build -o=../validator ./cmd/validator
go build -o=../prysmctl ./cmd/prysmctl
cd ..

You will now have access to every executable required to run the DevNet.

Configuration Files:

For Prysm and Go-Ethereum setup, configuration files are required.

Prysm:

On the Prysm side, make a file called config.yml in your DevNet folder that has the information below:

CONFIG_NAME: interop
PRESET_BASE: interop

# Genesis
GENESIS_FORK_VERSION: 0x20000089

# Altair
ALTAIR_FORK_EPOCH: 2
ALTAIR_FORK_VERSION: 0x20000090

# Merge
BELLATRIX_FORK_EPOCH: 4
BELLATRIX_FORK_VERSION: 0x20000091
TERMINAL_TOTAL_DIFFICULTY: 50

# Capella
CAPELLA_FORK_VERSION: 0x20000092

# Time parameters
SECONDS_PER_SLOT: 12
SLOTS_PER_EPOCH: 6

# Deposit contract
DEPOSIT_CONTRACT_ADDRESS: 0x4242424242424242424242424242424242424242

The configuration mentioned above includes details about the various hard-fork versions that are required for Prysm to function as well as a few custom parameters that will make running your  DevNet simpler. It’s of utmost importance to remember that you have the option to modify any of these settings. Hence, you can alter the entire list of configuration options by visiting this page.

Go-Ethereum:

You must also create a private key on the go-ethereum side so that it may be used to mine and develop the chain from its genesis to the proof-of-stake mode. Within your DevNet folder, create a file called secret.json and fill it out as follows:

2e0834786285daccd064ca17f1654f67b4aef298acbb82cef9ec422fb4975622

Also, save the following file as genesis.json inside your DevNet folder:

The aforementioned file configures genesis configuration for go-ethereum, This launches a validator deposit contract at address 0x4242424242424242424242424242424242424242 which is used for new validators to deposit 32 ETH and join the proof-of-stake chain. It also has some specific accounts with an ETH balance. You can use the ETH balance on the account to run go-ethereum, 0x123463a4b065722e99115d6c222f267d9cabb524, to submit transactions on your DevNet. 

DevNet Execution:

Running go-ethereum in our DevNet folder will be the first step. Then 

./geth –datadir=gethdata init genesis.json
./geth –datadir=gethdata account import secret.json

You will be prompted for a password for your secret key on the final command. You can enter a password if you’d like, or leave it blank by pressing Enter twice. Run “Geth” after that by using the following command.

./geth
–http 
–http.api “eth,engine” 
–datadir=gethdata 
–allow-insecure-unlock –unlock=”0x123463a4b065722e99115d6c222f267d9cabb524″ 
–password=”” 
–nodiscover console 
–syncmode=full 
–mine 
–miner.etherbase=0x123463a4b065722e99115d6c222f267d9cabb524

Note: Any Ethereum address may be used as miner.etherbase. 

Prysm:

A Prysm beacon node and a validator client will then need to be running. Prysm will require a genesis state, or more precisely, some information that informs it about the initial set of validators. Following are the keys from which you can generate a genesis state.

./prysmctl testnet generate-genesis –num-validators=64 –output-ssz=genesis.ssz –chain-config-file=config.yml –override-eth1data=true

You can get more details here on prysmctl and all of the available commands.

In your DevNet folder, genesis.ssz will be created as a result of this. Run the Prysm beacon node next. 

./beacon-chain \

  –datadir=beacondata \

  –min-sync-peers=0 \

  –genesis-state=genesis.ssz \

  –bootstrap-node= \

  –chain-config-file=config.yml \

  –config-file=config.yml \

  –chain-id=32382 \

  –execution-endpoint=http://localhost:8551 \

  –accept-terms-of-use \

  –jwt-secret=gethdata/geth/jwtsecret

After that, start the Prysm validator client:

./validator \

  –datadir=validatordata \

  –accept-terms-of-use \

  –interop-num-validators=64 \

  –interop-start-index=0 \

  –force-clear-db \

  –chain-config-file=config.yml \

  –config-file=config.yml

Expected Output:

The following is how your go-ethereum node should appear:

go-ethereum node code snippet

The next information that ought to appear on your Prysm beacon node is:

Prysm beacon node code snippet

Additionally, your Prysm validator client needs to be operational:

Prysm validator code snippet

Once go-ethereum’s mining difficulty reaches 50, the proof-of-stake mode will be activated, and you will notice a unique panda in your Prysm beacon chain as shown below:

Unique panda in Prysm beacon chain

And there you go! You are now running an Ethereum 2.0 node on your local system using Geth and Prysm!

Wrapping-Up

Running an Ethereum proof of stake node not only empowers you to participate in the network’s consensus and earn rewards but also strengthens the overall security and scalability of the blockchain. 

Remember, the Ethereum ecosystem is constantly evolving, and staying up-to-date with the latest developments is crucial. However, now that you are armed with your very own Ethereum 2.0 node, you’re ready to engage with this cutting-edge technology and become a part of the exciting blockchain revolution. So go ahead, explore, experiment, and embrace the endless possibilities that the Ethereum network has to offer.

Happy blockchain adventuring!

Frequently Asked Questions

What Are The System Requirements For Geth Node?

Minimum 4 CPUs & 8 GB RAM is recommended) for Ethereum blockchain synchronization and operation.

What Is The Difference Between Ethereum And ETH?

Ethereum is a decentralized blockchain platform that enables the creation of smart contracts and decentralized applications (dApps). ETH, on the other hand, is the native cryptocurrency of the Ethereum platform used for transactions and as a reward for miners.

Related Articles

field image

The blockchain landscape is constantly evolving, with new protocols emerging to address specific needs and challenges. In 2024, as several established players like Ethereum 2.0  and Binance Smart Chain continue to dominate, innovative newcomers are vying for attention as they continue to innovate in the dynamic landscape of protocols.  Polkadot Ecosystem and Cosmos Ecosystem, with […]

author-image

Calibraint

Author

22 Apr 2024

field image

Dethroning the Middlemen: Is Blockchain Finance’s Valiant Knight or a Cunning Trickster? Forget Robin Hood. The financial revolution of our time won’t be led by a merry band in tights. It might be driven by a complex string of code: blockchain. This mysterious technology promises a world where middlemen are dethroned, transactions become transparent fortresses, […]

author-image

Calibraint

Author

19 Apr 2024

field image

The Internet is the greatest invention of the 20th Century as it benefited humanity in so many ways. But it still remains to be a double-edged sword for creators as it offers them a global platform to showcase their work, but it also makes it frustratingly easy to steal.  Copyright infringement is rampant, and traditional […]

author-image

Calibraint

Author

02 Apr 2024

field image

Cryptocurrency bull markets are thrilling! Prices soar, everyone seems to be getting rich, and it can feel like easy money. But hold your guns, because with great runs come big mistakes in crypto bull market. Don’t let the excitement cloud your judgment and lead to missed opportunities or worse, lost funds.   If you are […]

author-image

Calibraint

Author

27 Mar 2024

field image

Forget everything you know about traditional business models. Now answer one simple question. Do you believe that the traditional and current business landscape is riddled with inefficiencies and vulnerabilities? If your answer is yes, then even Calibraint believes so, and we help businesses throw down the challenge with our groundbreaking blockchain development solutions.  But what’s […]

author-image

Calibraint

Author

23 Mar 2024

field image

The financial landscape is undergoing a seismic shift. Decentralized Finance is emerging as a revolutionary force, disrupting traditional lending and borrowing models. By leveraging blockchain technology, DeFi empowers users to participate in a peer-to-peer financial ecosystem, unlocking exciting possibilities for both lenders and borrowers.  If you are new to DeFi, we’ll break down every complex […]

author-image

Calibraint

Author

21 Mar 2024

Let's Start A Conversation

Table of Contents