Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (2024)

Blockchain technology has revolutionised the way we handle digital assets and information. It provides a secure and decentralised way of recording transactions, which is tamper-resistant and transparent. Ethereum is one of the most popular blockchain platforms, known for its smart contract capabilities. In this blog, we’ll explore what blockchain, Ethereum, Beacon Node, and running a private Ethereum node, and we’ll delve into a practical example using the provided Docker Compose code.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (2)

A blockchain is a distributed ledger technology that stores data in a chain of blocks, each containing a list of transactions. It operates on a decentralized network of computers, ensuring transparency, security, and immutability of data. The blockchain’s consensus mechanism, often Proof of Work (PoW) or Proof of Stake (PoS), helps validate and add new blocks to the chain.

Imagine a digital currency called “DigitalCoin” (DC). When you send DC to someone, that transaction is recorded on the DigitalCoin blockchain.

  1. You decide to send 10 DC to your friend Alice.
  2. This transaction is broadcast to the network for verification.
  3. Nodes in the network check if you have enough DC to send and if the transaction is valid.
  4. Once enough nodes agree that your transaction is valid, it’s added to a new block.
  5. This block is then added to the existing blockchain.
  6. Your friend Alice can now see the transaction on her digital wallet, and she knows she received 10 DC from you.

This process repeats for every transaction on the blockchain. Over time, you get a chain of blocks (the blockchain) that contains all the transactions ever made with DigitalCoin.

Ethereum is a blockchain platform designed for more than just digital currency. It introduced the concept of smart contracts, self-executing contracts with predefined rules. These contracts automate complex tasks, such as transferring assets, without the need for intermediaries. Ethereum’s native cryptocurrency, Ether (ETH), is used to fuel these transactions and execute smart contracts.

Ethereum 2.0 (Eth2) is an upgrade to the existing Ethereum network, aiming to improve scalability, security, and energy efficiency. Beacon Chain is a critical component of Eth2, responsible for managing validators, validating transactions, and maintaining consensus.

Here’s a breakdown of the components:
- Beacon Chain: The core chain in Ethereum 2.0 that coordinates and manages validators. It’s responsible for proposing new blocks and maintaining the overall network consensus.
- Validators: Participants responsible for validating transactions and adding them to the blockchain. Validators are chosen in a decentralized manner, promoting security and decentralization.
- Shard Chains: Eth2 introduces shard chains, each capable of processing its transactions and smart contracts. Beacon Chain coordinates these shards.

There are multiple tools available for setting up a private Ethereum node, but in this documentation, we will focus on using Geth and Prysm to set up the node.

In the provided Docker Compose code, you have two services: `geth` and `beacon-node`, which facilitate running your own Ethereum private node.

  1. Create a folder named “ethereum” and navigate into it.
mkdir ethereum && cd ethereum

2. Generate a secret key for authentication using openssl in the terminal.

sudo openssl rand -hex 32 > jwtsecret 

3. Create a “jwt” folder within the “ethereum” folder, copy the secret key into it.

We generate a JWT secret to establish a communication bridge between the execution client and the beacon client.

mkdir jwt && mv jwtsecret ./jwt/
Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (3)

4. Return to the “ethereum” folder and create a “docker-compose.yml” file with provided code.

Feel free to adjust any additional details or configurations as per your requirements.

touch docker-compose.yml
version: "3.8"

services:
geth:
image: ethereum/client-go:latest
volumes:
- ./eth:/root/.ethereum
- ./jwt/jwtsecret:/jwt/jwtsecret

ports:
- 8545:8545
- 30303:30303
- 8551:8551
restart: unless-stopped
command:
[
"--mainnet",
"--syncmode","snap",
"--datadir=/root/.ethereum",
"--http",
"--http.addr", "0.0.0.0",
"--http.port", "8545",
"--authrpc.addr", "0.0.0.0",
"--authrpc.vhosts=0.0.0.0",
"--authrpc.port", "8551",
"--http.api", "ersonal,eth,net,web3,debug,txpool,admin",
"--authrpc.jwtsecret=/jwt/jwtsecret",
"--cache", "1024",
"--http.corsdomain", "*",
"--maxpeers=500",
"--metrics"
]

beacon-node:
image: gcr.io/prysmaticlabs/prysm/beacon-chain:stable
volumes:
- ./eth2:/data
- ./jwt/jwtsecret:/jwt/jwtsecret

ports:
- 4000:4000
- 13000:13000
- 12000:12000/udp
restart: unless-stopped
command:
[
"--datadir=/data",
"--jwt-secret=/jwt/jwtsecret",
"--execution-endpoint=http://<your-private-ip>:8551", # Enter your private ip for your system
"--mainnet",
"--accept-terms-of-use",
"--rpc-host=0.0.0.0",
"--grpc-gateway-host=0.0.0.0",
"--monitoring-host=0.0.0.0"
]

Run the ifconfig command to fetch your private IP and then input the IP into the Beacon Node service command.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (4)

5. Run docker-compose up -d to start two containers for execution and beacon [ Consensus ] nodes.

docker-compose up -d

Two folders, “eth” and “eth2,” will be created.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (5)

6. After setup, your private nodes will begin execution and start fetching node data.

7. In the initial stage, it will require some time to start

Note: The process may take around 3 days and occupy approximately 660GB of storage.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (6)
  1. Obtain the container ID of the Geth service by running.
docker ps

2. Use the following command to attach to the Geth terminal:

docker exec -it <container-id> geth attach

This will connect you to the Geth terminal.

3. Within the Geth terminal, enter the command

eth.syncing

Initially, it will display “false,” indicating that synchronization hasn’t started yet.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (7)

However, as the process progresses, you will observe real-time syncing data being displayed.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (8)
  • Execution node

Volumes: Here, you define two volumes that Docker will use to store data. Volumes are like directories that can persist data even if the container is stopped or removed.

volumes:
- ./eth:/root/.ethereum
- ./jwt/jwtsecret:/jwt/jwtsecret

1. “- ./eth:/root/.ethereum:” This maps the local directory “./eth” to “/root/.ethereum” inside the Docker container. It’s where Geth will store Ethereum blockchain data.

2. “- ./jwt/jwtsecret:/jwt/jwtsecret:” This maps the local directory “./jwt/jwtsecret” to “/jwt/jwtsecret” inside the Docker container. It’s used to store authentication secrets.

Ports: This section defines which ports from your host machine should. be mapped to ports inside the Docker container.

 ports:
- 8545:8545
- 30303:30303
- 8551:8551

8545:8545: Maps port 8545 on your host to port 8545 inside the container. Port 8545 is typically used for HTTP server and GraphQL API for interacting with Ethereum.

30303:30303: Maps port 30303 on your host to port 30303 inside the container. Port 30303 is used for P2P networking to connect to other Ethereum nodes.

8551:8551: Maps port 8551 on your host to port 8551 inside the container. This port is used to connect to a consensus client (CC).

Command: This section specifies the command and its arguments that should be run inside the Docker container.

command:
[
" - mainnet",
" - syncmode","snap",
" - datadir=/root/.ethereum",
" - http",
" - http.addr", "0.0.0.0",
" - http.port", "8545",
" - authrpc.addr", "0.0.0.0",
" - authrpc.vhosts=0.0.0.0",
" - authrpc.port", "8551",
" - http.api", "ersonal,eth,net,web3,debug,txpool,admin",
" - authrpc.jwtsecret=/jwt/jwtsecret",
" - cache", "1024",
" - http.corsdomain", "*",
" - maxpeers=500",
" - metrics"
]

1. — mainnet: Indicates that this Ethereum node should connect to the Ethereum mainnet, the public Ethereum blockchain.

2. — syncmode snap: Sets the synchronization mode to “snap,” which is a fast way to synchronize the Ethereum blockchain.

3. — datadir=/root/.ethereum: Specifies the data directory where Ethereum blockchain data should be stored inside the container.

4. — http: Enables the HTTP server to allow API access.

5. — http.addr 0.0.0.0: Makes the HTTP server accessible from any IP address.

6. — http.port 8545: Sets the HTTP server’s port to 8545 for API access.

7. — authrpc.addr 0.0.0.0: Allows remote authentication for RPC.

8. — authrpc.vhosts=0.0.0.0: Accepts requests from any virtual host for authentication.

9. — authrpc.port 8551: Sets the port for remote authentication.

10. — http.api personal,eth,net,web3,debug,txpool,admin: Specifies the Ethereum APIs to enable for remote access.

11. — authrpc.jwtsecret=/jwt/jwtsecret: Sets the location of the JWT secret for authentication.

12. — cache 1024: Allocates 1024 MB of memory for caching.

— http.corsdomain *: Allows cross-origin resource sharing from any domain.

13. — maxpeers=500: Sets the maximum number of peers (other Ethereum nodes) to connect to.

14. — metrics: Enables the collection of node metrics.

This Docker configuration sets up an Ethereum node (Geth) with various settings and configurations to allow interaction with the Ethereum mainnet and other Ethereum-related tasks. It uses Docker volumes to store blockchain data and authentication secrets and exposes specific ports for different Ethereum services. The Ethereum node is configured to restart automatically if it stops for any reason.

  • Beacon Node [prysm]

Volumes: This section maps local directories to directories inside the Docker container. It allows data to be persisted and shared between the host system and the container.

volumes:
- ./eth2:/data
- ./jwt/jwtsecret:/jwt/jwtsecret

1. “./eth2:/data:” This maps the local directory “./eth2” to “/data” inside the Docker container.

2. “./jwt/jwtsecret:/jwt/jwtsecret:” This maps the local directory “./jwt/jwtsecret” to “/jwt/jwtsecret” inside the Docker container. It’s used to store authentication secrets.

Port : Required ports as mentioned in prysm documentation

ports:
- 4000:4000
- 13000:13000
- 12000:12000/udp

Command:This section specifies the command and its arguments that should be run inside the Docker container.

command:
[
" - datadir=/data",
" - jwt-secret=/jwt/jwtsecret",
" - execution-endpoint=http://10.26.2.71:8551",
" - mainnet",
" - accept-terms-of-use",
" - rpc-host=0.0.0.0",
" - grpc-gateway-host=0.0.0.0",
" - monitoring-host=0.0.0.0"
]

1. — datadir=/data: This parameter specifies the data directory where the Beacon Chain node will store its data. In this case, it’s set to `/data`.

2. — jwt-secret=/jwt/jwtsecret: This parameter specifies the location of the JWT secret file. JWT (JSON Web Token) is used for authentication and security purposes. Here, it’s configured to use the secret located at `/jwt/jwtsecret`.

3. — execution-endpoint=http://<System-Private-IP>:8551: This parameter defines the execution endpoint that the Beacon Chain node should connect to. It’s specified as `http://<System-private-IP>:8551`. This is likely the endpoint for communication with another service (possibly Geth) running at that IP and port.

4. — mainnet:This parameter indicates that the Beacon Chain node should operate on the Ethereum mainnet. It specifies the network mode.

5. — accept-terms-of-use: This parameter likely signifies that the user accepts the terms of use or licensing agreement associated with using the Prysm Beacon Chain node.

6. — rpc-host=0.0.0.0: This parameter configures the RPC (Remote Procedure Call) host address. Setting it to `0.0.0.0` means that the RPC interface is accessible from any network interface on the host.

7. — grpc-gateway-host=0.0.0.0: Similar to the previous parameter, this one configures the gRPC (Google Remote Procedure Call) gateway host address. It also allows access from any network interface on the host.

8. — monitoring-host=0.0.0.0: This parameter specifies the host address for monitoring. Like the previous two parameters, it’s set to `0.0.0.0`, allowing monitoring from any network interface on the host.

In summary, these command-line parameters configure various aspects of the Prysm Beacon Chain node, such as data directory, authentication, network settings, and endpoint connections. Each parameter serves a specific purpose in tailoring the behavior of the node to your requirements.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (9)

Execution Client in Ethereum 2.0:

In Ethereum 2.0 (Eth2), the blockchain network is designed to be more scalable and efficient than its predecessor, Ethereum 1.0. To achieve this, Eth2 introduces a separation of responsibilities between two crucial components: the execution client and the consensus client. Let’s first delve into the role of the execution client.

The execution client in Eth2 is primarily responsible for processing transactions, executing smart contracts, and managing the state of the shard chains. It’s the component that handles the “execution” aspect of the blockchain. One of the prominent execution clients in Ethereum 2.0 is Geth, which specializes in managing shard chains and executing transactions and smart contracts.

Consensus Client in Ethereum 2.0:

In contrast to the execution client, the consensus client in Ethereum 2.0 is focused on reaching consensus on the state of the blockchain. It validates and agrees upon the order of transactions and blocks in the network, ensuring that all nodes in the network have the same view of the blockchain’s history. The consensus client plays a vital role in maintaining network security and integrity.

A well-known consensus client in Ethereum 2.0 is prysm. Prysm is responsible for managing validators, participating in the consensus mechanism (Proof of Stake in Eth2), and maintaining the Beacon Chain. The Beacon Chain is the core chain that coordinates the network, finalizes blocks, and ensures agreement among validators.

To illustrate the collaborative roles of execution and consensus clients in Ethereum 2.0, let’s consider a practical example:

Alice initiates a transaction on Ethereum 2.0, aiming to send 5 ETH to Bob through a decentralized application (DApp). Here’s how execution and consensus clients come into play:

1. Execution Client (e.g., Geth): Alice’s transaction is picked up by the execution client, which processes the transaction. It updates account balances, executes any associated smart contract code, and prepares the transaction for validation.

2. Consensus Client (e.g., Prysm): The transaction, now prepared by the execution client, is handed over to the consensus client. Prysm validates the transaction, ensuring that Alice has sufficient funds, and verifies that the transaction complies with the network’s rules and security protocols.

3. Consensus and Finalization: The consensus client, Prysm, proposes a new block that contains Alice’s transaction to the Beacon Chain — the heart of Ethereum 2.0. Validators in the network (often managed by the consensus client) verify and vote on the validity of this proposed block.

4. Confirmation: Once a supermajority of validators reaches consensus on the validity of the block, it is finalized and added to the Beacon Chain. This, in turn, confirms Alice’s transaction, ensuring that it is included in the Ethereum 2.0 blockchain.

In this way, execution and consensus clients in Ethereum 2.0 work seamlessly together, with the execution client handling the transaction’s processing and preparation, while the consensus client ensures the transaction’s validation and agreement among network participants. This collaborative effort guarantees the secure and efficient operation of Ethereum 2.0, making it an essential advancement in blockchain technology.

Understanding Blockchain, Ethereum, Beacon Node, and Running a Private Ethereum Node With Docker (2024)

FAQs

What is a beacon node in Ethereum? ›

The beacon-chain node shipped with Prysm is the keystone component of the Ethereum proof-of-stake protocol. It is responsible for running a full Proof-of-Stake blockchain, known as a beacon chain, which uses distributed consensus to agree on blocks both proposed and attested on by validators in the network.

How do you deploy a local private ethereum Blockchain? ›

Below is the step-by-step guide to setting up a private Ethereum network.
  1. Step 1: Install Geth on Your System. ...
  2. Step 2: Create a Folder For Private Ethereum. ...
  3. Step 3: Create a Genesis Block. ...
  4. Step 4: Execute genesis file. ...
  5. Step 5: Initialize the private network. ...
  6. Step 6: Create an Externally owned account(EOA)
Apr 24, 2023

How much money can you make running an Ethereum node? ›

What is the average ETH staking APY? The average ETH staking APY is roughly 4% for validators that do not utilize MEV-Boost. Validators with MEV-Boost enabled average roughly 5.69%.

Can I run my own Ethereum node? ›

To run an Ethereum RPC node, you'll need a computer with sufficient processing power and storage capacity. You can use either Windows, Mac, or Linux operating systems. For a full Ethereum node, the minimum requirement is 8 GB of RAM and at least 1 TB of free disk space.

What is the difference between a beacon node and a validator? ›

A beacon node simply maintains a view of the beacon chain and shard chain, while validators actively mine and validate new blocks (earning rewards in the process). In order to become a validator, you have to stake 32 Eth. You can learn more about staking on ethereum.org and on EthHub.

What are the risks of running an Ethereum node? ›

Cyber attackers continually develop sophisticated methods to target nodes, ranging from Distributed Denial-of-Service (DDoS) attacks to software exploits that can lead to severe data breaches or loss of funds. Beyond external threats, the complexities involved in regular software updates also pose significant risks.

How to fork Ethereum and become a private chain? ›

Steps to Fork Ethereum and Create Your Own Private Chain
  1. Set Up Your Development Environment: Before forking Ethereum, you need to set up your development environment. ...
  2. Clone the Ethereum Repository: The next step is to clone the Ethereum repository from GitHub.
Jul 7, 2024

Can Ethereum be private? ›

There are many options in the Ethereum ecosystem that are available today or are actively being developed to provide various layers of privacy. On Quorum, private information is never broadcast to network participants. Private data is encrypted and only shared directly with relevant parties.

What are the benefits of running your own Ethereum node? ›

Benefits of Running a Node​

Running a node (i.e., Full node) helps keep the network more diverse and decentralized. It also lets you directly interact with Ethereum without relying on other nodes.

Who runs the most Ethereum nodes? ›

Aside from the 69 percent of modes hosted on the Ethereum mainnet, Amazon Web Services (AWS) hosts more than 50 percent of modes. Furthermore, over 15 percent of nodes are hosted by Hetzner, while 4.1 percent are hosted by OVH. Solana is in a similar predicament.

How much does it cost to run an Ethereum validator node? ›

Validadors must stake a minimum of 32 Eth as collateral to participate as a validator and create new blocks. As of this writing, the dollar value of 32 Eth is about $50K, so the startup cost to run an Ethereum node is not an insignificant consideration.

Can I run Ethereum node without staking? ›

It depends on how much ether you have and if you think you'll generate enough returns from staking it. If you only want to participate in the network and are not concerned with returns, you don't need to stake your ether. You can run a node without staking, you just won't get any rewards.

How many people run Ethereum nodes? ›

Quick Take. The 13,900 nodes supporting the Ethereum network are now running more than 1 million validators.

What can you do with an Ethereum node? ›

Transaction Validation: You can run an Ethereum node with the intent of becoming a validator. A validator is responsible for storing blockchain data, processing transactions, and adding new blocks to the blockchain.

What is the difference between Ethereum mainnet and beacon chain? ›

Unlike the Mainnet, the Beacon Chain did not handle transactions or host intelligent contracts. Its primary purpose was to serve as the core of Ethereum 2.0, replacing traditional miners with validators responsible for block validation.

Which two types of nodes are there in Ethereum? ›

A client is an Ethereum implementation that validates all transactions in each block, ensuring the network's security and data accuracy. The three types of Ethereum Nodes are Full, Light, Archive, and Miner Nodes. The three types of Ethereum Clients are Full, Light, and Remote Clients.

How to stake Ethereum on beacon chain? ›

On-chain staking

As a Proof-of-Stake blockchain, the Eth2 Beacon Chain is built and secured by the network's validators. To participate as a Beacon Chain validator, you must stake ETH by sending it to a deposit contract on the Ethereum network.

How does a beacon network work? ›

When a user walks past an area where a positioning system or IoT network with beacons is set up, the nearest beacon sends a code with a message to their mobile device. Then, the beacon recognizes the message pops up as a notification on a user's mobile device with a third-party or branded mobile app.

Top Articles
Pros and Cons of Mobile Payments
Helfire Tincture
WALB Locker Room Report Week 5 2024
Maxtrack Live
San Angelo, Texas: eine Oase für Kunstliebhaber
Craigslist Niles Ohio
What Are the Best Cal State Schools? | BestColleges
Booknet.com Contract Marriage 2
Top 10: Die besten italienischen Restaurants in Wien - Falstaff
THE 10 BEST River Retreats for 2024/2025
Music Archives | Hotel Grand Bach - Hotel GrandBach
Slushy Beer Strain
Diablo 3 Metascore
Aberration Surface Entrances
Highland Park, Los Angeles, Neighborhood Guide
Canvas Nthurston
Sonic Fan Games Hq
Everything We Know About Gladiator 2
Florida History: Jacksonville's role in the silent film industry
Vrachtwagens in Nederland kopen - gebruikt en nieuw - TrucksNL
Lawson Uhs
Trivago Sf
Welcome to GradeBook
Aris Rachevsky Harvard
Wgu Academy Phone Number
Hdmovie 2
Hyvee Workday
Craigslist Northfield Vt
Certain Red Dye Nyt Crossword
Valic Eremit
Jcp Meevo Com
Garden Grove Classlink
Keshi with Mac Ayres and Starfall (Rescheduled from 11/1/2024) (POSTPONED) Tickets Thu, Nov 1, 2029 8:00 pm at Pechanga Arena - San Diego in San Diego, CA
Striffler-Hamby Mortuary - Phenix City Obituaries
Sacramento Craigslist Cars And Trucks - By Owner
Jail Roster Independence Ks
Craigslist Cars And Trucks Mcallen
What does wym mean?
Lichen - 1.17.0 - Gemsbok! Antler Windchimes! Shoji Screens!
Ni Hao Kai Lan Rule 34
Cvb Location Code Lookup
Solemn Behavior Antonym
Afspraak inzien
Snohomish Hairmasters
How To Upgrade Stamina In Blox Fruits
Emulating Web Browser in a Dedicated Intermediary Box
Mlb Hitting Streak Record Holder Crossword Clue
Is Chanel West Coast Pregnant Due Date
Minute Clinic Mooresville Nc
Uno Grade Scale
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 6232

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.