How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (2024)

Last Updated : 24 Apr, 2023

Summarize

Comments

Improve

This article focuses on discussing the steps to set up a private Ethereum Network. Before proceeding into the detailed step-by-step guide, let’s have a look at the definition of the basic terminologies.

What is Blockchain?

  • Blockchain is a chain of blocks that contains all information about all the transactions that take place in a network in an encrypted form by using public and private keys.
  • Blockchain technology can strengthen the basic services that are essential in trade finance. The blockchain model works on a decentralized, digitalized, and distributed ledger model. Because of these properties, this is more robust and secure than the proprietary, centralized which are currently used in the trading system.
  • In the simplest of terms, a blockchain is just a new form of a decentralized database.

What is Ethereum?

Ethereum is a decentralized open-source blockchain system that features its own cryptocurrency which is called ether(ETH). It is a platform that can be used for various apps which can be deployed by using Smart Contracts.

Why Build a Private Blockchain Network?

  • In an Ethereum network if the nodes are not connected to the main network then it is known as a Private Ethereum Network.
  • Only the nodes with the right permissions will be able to access this Blockchain.
  • Privacy – Don’t want to key data on a public network that’s why enterprises build a private network.
  • To test the smart contracts and to develop smart contracts.

Steps to Set Up Private Ethereum Network

Below is the step-by-step guide to setting up a private Ethereum network.

Step 1: Install Geth on Your System

  • Click here to Go to the official Geth download page and download setup according to your operating system.

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (1)

  • While installing Geth make sure to select both checkboxes as shown below.

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (2)

  • After installing Geth on your system open PowerShell or command prompt and type geth and press enter, the following output will be displayed.

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (3)

Step 2: Create a Folder For Private Ethereum

  • Create a separate folder for this project. In this case, the folder is MyNetwork.
  • Create a new folder inside the folder MyNetwork for the private Ethereum network as it keeps your Ethereum private network files separate from the public files. In this example folder is MyPrivateChain.

Step 3: Create a Genesis Block

The blockchain is a distributed digital register in which all transactions are recorded in sequential order in the form of blocks. There are a limitless number of blocks, but there is always one separate block that gave rise to the whole chain i.e. the genesis block.

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (4)

As seen in the above diagram we can see that blockchain is initialized with the genesis block.

To create a private blockchain, a genesis blockis needed. To do this, create a genesis file, which is a JSON file with the following commands-

{

“config”:{

“chainId”:987,

“homesteadBlock”:0,

“eip150Block”:0,

“eip155Block”:0,

“eip158Block”:0

},

“difficulty”:”0x400″,

“gasLimit”:”0x8000000″,

“alloc”:{}

}

Explanation:

  • config: It defines the blockchain configuration and determines how the network will work.
  • chainId: This is the chain number used by several blockchains. The Ethereum main chain number is “1”. Any random number can be used, provided that it does not match with another blockchain number.
  • homesteadBlock: It is the first official stable version of the Ethereum protocol and its attribute value is “0”.
  • One can connect other protocols such as Byzantium, eip155B, and eip158. To do this, under the homesteadBlock add the protocol name with the Block prefix (for example, eip158Block) and set the parameter “0” to them.
  • difficulty: It determines the difficulty of generating blocks. Set it low to keep the complexity low and to avoid waiting during tests.
  • gasLimit: Gas is the “fuel” that is used to pay transaction fees on the Ethereum network. The more gas a user is willing to spend, the higher will be the priority of his transaction in the queue. It is recommended to set this value to a high enough level to avoid limitations during tests.
  • alloc: It is used to create a cryptocurrency wallet for our private blockchain and fill it with fake ether. In this case, this option will not be used to show how to initiate mining on a private blockchain.

This file can be created by using any text editor and save the file with JSON extension in the folder MyNetwork.

Step 4: Execute genesis file

Open cmd or PowerShell in admin mode enter the following command-

geth –identity “yourIdentity” init \path_to_folder\CustomGenesis.json –datadir \path_to_data_directory\MyPrivateChain

Parameters-
path_to_folder- Location of Genesis file.
path_to_data_directory- Location of the folder in which the data of our private chain will be stored.

The above command instructs Geth to use the CustomGenesis.json file.

After executing the above command Geth is connected to the Genesis file and it seems like this:

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (5)

Step 5: Initialize the private network

Launch the private network in which various nodes can add new blocks for this we have to run the command-

geth –datadir \path_to_your_data_directory\MyPrivateChain –networkid 8080

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (6)

The command also has the identifier 8080. It should be replaced with an arbitrary number that is not equal to the identifier of the networks already created, for example, the identifier of the main network Ethereum (“networkid = 1”). After successfully executing the command we can see like this-

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (7)

Note:

The highlighted text is the address of geth.ipc file finds it in your console and copy it for use in the next step.

Every time there is a need to access the private network chain, one will need to run commands in the console that initiate a connection to the Genesis file and the private network.

Now a personal blockchain and a private Ethereum network is ready.

Step 6: Create an Externally owned account(EOA)

Externally Owned Account(EOA) has the following features-

  • Controlled by an External party or person.
  • Accessed through private Keys.
  • Contains Ether Balance.
  • Can send transactions as well as ‘trigger’ contract accounts.

Steps to create EOA are:

To manage the blockchain network, one need EOA. To create it, run Geth in two windows. In the second window console enter the following command-

geth attach \path_to_your_data_directory\YOUR_FOLDER\geth.ipc

or

geth attach \\.\pipe\geth.ipc

This will connect the second window to the terminal of the first window. The terminal will display the following-

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (8)

Create an account by using the command-

personal.newAccount()

After executing this command enter Passphrase and you will get your account number and save this number for future use.

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (9)

To check the balance status of the account execute the following command-

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (10)

It can be seen from the above screenshot that it shows zero balance. This is because when starting a private network in the genesis file, we did not specify anything in the alloc attribute.

Step 7: Mining our private chain of Ethereum

If we mine in the main chain of Ethereum it will require expensive equipment with powerful graphics processors. Usually, ASICs are used for this but in our chain high performance is not required and we can start mining by using the following command-

miner.start()

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (11)

If the balance status is checked after a couple of seconds the account is replenished with fake ether. After that, one can stop mining by using the following command-

miner.stop()

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (12)



kamalsagar316

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (14)

Improve

Next Article

How to Add Another Miner to Existing Private Ethereum Blockchain?

Please Login to comment...

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks (2024)

FAQs

How to Setup Your Own Private Ethereum Network? - GeeksforGeeks? ›

Create the Genesis File for our Private Network

The Genesis File contains all the data required to create the genesis block (block 0), that is, the first block of the blockchain. The JSON file contains information such as how many Ether it starts with, etc — the initial state of the blockchain.

How to setup your own private Ethereum network? ›

Create the Genesis File for our Private Network

The Genesis File contains all the data required to create the genesis block (block 0), that is, the first block of the blockchain. The JSON file contains information such as how many Ether it starts with, etc — the initial state of the blockchain.

How do you create a network in Ethereum? ›

Local Ethereum Network
  1. Prereq : Install Geth. For windows : https://ethereum.github.io/go-ethereum/downloads/ ...
  2. Prereq : create /projects. ...
  3. Create local_ethereum_blockchain folder. ...
  4. Create the genesis block config. ...
  5. Initialise an Ethereum node. ...
  6. Start that Ethereum node. ...
  7. Initialise another Ethereum node. ...
  8. Start the 2nd Ethereum node.

How to set up a private Ethereum blockchain and deploy a solidity smart contract on the blockchain? ›

Create and Deploy your Smart Contract
  1. Step 1: Connect to the Ethereum network. ...
  2. Step 2: Create your app (and API key) ...
  3. Step 3: Create an Ethereum account (address) ...
  4. Step 4: Add ether from a Faucet. ...
  5. Step 5: Check your Balance. ...
  6. Step 6: Initialize our project. ...
  7. Step 7: Download Hardhat. ...
  8. Step 8: Create Hardhat project.

How to set up a private Ethereum blockchain proof of authority with go Ethereum part 2? ›

Setup private Ethereum network in cloud
  1. Install go (to each node):
  2. Download and build go-ethereum (on each node):
  3. Setup ethstats.
  4. Setup seal-node-n (repeat to all seal nodes)
  5. Create genesis.json using puppeth (run puppeth on stats-node and follow CLI instruction to generate genesis file)
  6. Init seal-node-n.
  7. Run boot-node:
Feb 13, 2024

How to build a private blockchain network? ›

How to Create a Private Blockchain Platform?
  1. Step 1: Understand Your Business Goals. ...
  2. Step 2: Hiring Blockchain Developers. ...
  3. Step 3: Building a Private Chain. ...
  4. Step 4: Planning for the Required Decentralized Apps. ...
  5. Step 5: Start Prototyping. ...
  6. Step 6: Creating the Backend Part. ...
  7. Step 7: Deployment of Apps to Your Blockchain.
Apr 1, 2024

What is a private network in Ethereum? ›

An Ethereum Private Network is a completely private Blockchain which is isolated from the Main Ethereum network. Ethereum Private Network is mainly created by organizations to restrict the read permissions of the Blockchain. Only the nodes with the right permissions will be able to access this Blockchain.

How to deploy smart contract on Ethereum testnet? ›

Deploying Contract
  1. Connecting to the Ethereum Network.
  2. Create Your App and Obtain an API Key.
  3. Setting Up Your Ethereum Account.
  4. Adding Ether from a Sepolia Faucet.
  5. Initiating Our Project.
  6. Downloading and Setting Up Hardhat.
  7. Creating a Hardhat Project.
  8. Creating Project Folders.

Can you send ETH to a smart contract? ›

In this example, the receive function is defined as external and payable , which means that it can be called from outside the contract and can receive Ether. You will need to send some Ether to your contract first if you want to send that Ether further to any other EOA or smart contract.

How do you make a private transaction on Ethereum? ›

This tutorial will teach you how to use this endpoint to protect your transactions.
  1. 3 Steps to Send a Private Transaction.
  2. Create free Alchemy account.
  3. Create an Alchemy App.
  4. Make sendPrivateTransaction call via the Alchemy SDK.

How do I get my Ethereum private key? ›

Log into your wallet via web-browser. Navigate to Settings - Wallets & Addresses and select Ethereum. Read the warning message and click Show button to view your private key.

How do I setup my ETH 2.0 validator? ›

How to become an ETH2 Validator (step by step practical tutorial)
  1. Step 1 — Full Node of ETH 1.0. ...
  2. Step 2— Generate your ETH2 Deposit Address(es) ...
  3. Step 3 — Make the Deposit(s) via ETH2 Launchpad. ...
  4. Step 4— Setup Prysm — Implementation of ETH 2.0. ...
  5. Step 5— Import the Funded ETH2 Addresses. ...
  6. Step 6— Run your Validator.
Dec 13, 2022

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.

Can I create my own ETH address? ›

Anyone can create an Ethereum account for free.

You just need to install a crypto wallet app. Wallets create and manage your Ethereum account. They can send transactions, check your balances and connect you to other apps built on Ethereum.

How do I get Ethereum private key? ›

To see your Private key
  1. Visit our website at www.myetherwallet.com.
  2. Click on 'Access my wallet' and then click 'Software' on the bottom.
  3. Click your access method: either Mnemonic phrase or Keystore.

Top Articles
What is blockchain and why should records management professionals care?
Cryptocurrency Scams: Recover a Fraudulent Investment - Robinson and Henry
Using GPT for translation: How to get the best outcomes
Pnct Terminal Camera
Google Sites Classroom 6X
Craigslist - Pets for Sale or Adoption in Zeeland, MI
Mr Tire Rockland Maine
7543460065
Paula Deen Italian Cream Cake
Graveguard Set Bloodborne
Heska Ulite
Bill Devane Obituary
Umn Biology
Mercy MyPay (Online Pay Stubs) / mercy-mypay-online-pay-stubs.pdf / PDF4PRO
LeBron James comes out on fire, scores first 16 points for Cavaliers in Game 2 vs. Pacers
Degreeworks Sbu
Wgu Admissions Login
Hair Love Salon Bradley Beach
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Extra Virgin Coconut Oil Walmart
Cambridge Assessor Database
U Arizona Phonebook
Craigslistjaxfl
Apply for a credit card
Kayky Fifa 22 Potential
UPS Store #5038, The
ABCproxy | World-Leading Provider of Residential IP Proxies
18889183540
Culver's Flavor Of The Day Taylor Dr
Sullivan County Image Mate
Tuw Academic Calendar
Violent Night Showtimes Near Johnstown Movieplex
Pacman Video Guatemala
Aid Office On 59Th Ashland
Advance Auto Parts Stock Price | AAP Stock Quote, News, and History | Markets Insider
Verizon TV and Internet Packages
Nicole Wallace Mother Of Pearl Necklace
Maybe Meant To Be Chapter 43
The Blackening Showtimes Near Regal Edwards Santa Maria & Rpx
Page 5662 – Christianity Today
Henry County Illuminate
Keir Starmer looks to Italy on how to stop migrant boats
Janaki Kalaganaledu Serial Today Episode Written Update
Brandon Spikes Career Earnings
Garland County Mugshots Today
Big Brother 23: Wiki, Vote, Cast, Release Date, Contestants, Winner, Elimination
Quest Diagnostics Mt Morris Appointment
What Does the Death Card Mean in Tarot?
Gear Bicycle Sales Butler Pa
28 Mm Zwart Spaanplaat Gemelamineerd (U999 ST9 Matte | RAL9005) Op Maat | Zagen Op Mm + ABS Kantenband
Latest Posts
Article information

Author: Clemencia Bogisich Ret

Last Updated:

Views: 5895

Rating: 5 / 5 (80 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Clemencia Bogisich Ret

Birthday: 2001-07-17

Address: Suite 794 53887 Geri Spring, West Cristentown, KY 54855

Phone: +5934435460663

Job: Central Hospitality Director

Hobby: Yoga, Electronics, Rafting, Lockpicking, Inline skating, Puzzles, scrapbook

Introduction: My name is Clemencia Bogisich Ret, I am a super, outstanding, graceful, friendly, vast, comfortable, agreeable person who loves writing and wants to share my knowledge and understanding with you.