How to set up and set up a private blockchain with Ethereum

28 giu 2023 2 min di lettura
How to set up and set up a private blockchain with Ethereum
Indice dei contenuti


A private blockchain is a custom implementation of a blockchain that allows you to create and manage your own blockchain network, separate from the public blockchain network such as the Ethereum mainnet.

In this tutorial we will see how to install and configure a private blockchain using Ethereum software.


  • Linux operating system (Ubuntu recommended)
  • Login as a user with administrator privileges (root)
  • Internet connection

Installing Geth

Geth is the Ethereum client written in Go and allows you to interact with an Ethereum blockchain. To install Geth, run the following commands:

sudo apt-get update
 sudo apt-get install -y software-properties-common
 sudo add-apt-repository -y ppa:ethereum/ethereum
 sudo apt-get update
 sudo apt-get install -y ethereum

Once the installation is complete, you can verify that Geth was installed successfully by running the command:

geth version

You should see the version of Geth installed.

Creating a new account

An account is required to interact with the blockchain. You can create a new account using the Geth command:

geth account new

You will be prompted to enter a passphrase for the new account. Make sure you remember this passphrase as you will need it to unlock your account later.

After entering the passphrase, a new account will be generated and an Ethereum address associated with it will be shown.

Initialization of a new blockchain

To create a new private blockchain, you need to initialize a block chain using the Geth command:

geth init /path/to/genesis.json

Where `/path/to/genesis.json` is the path to the genesis block configuration file. The genesis block contains the initial information for your blockchain, such as initial token allocation and configuration of network parameters.

You can create your own genesis.json configuration file with your desired specifications. Here's an example of what it might look like:

 "config": {
 "chainId": 1234,
 "homesteadBlock": 0,
 "eip155Block": 0,
 "eip158Block": 0
 "alloc": {},
 "coinbase": "0x0000000000000000000000000000000000000000",
 "difficulty": "0x20000",
 "extraData": "",
 "gasLimit": "0x2fefd8",
 "nonce": "0x0000000000000042",
 "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "timestamp": "0x00"

After the blockchain is initialized, the `.ethereum` directory will be created in your home directory and will contain the data from the blockchain.

Starting Geth

Once the private blockchain is set up, you can start the geth node using the command:

geth --networkid 1234 --nodiscover --maxpeers 0 --datadir /path/to/data --rpc --rpcaddr "" --rpcport 8545 --rpcapi "eth,net,web3,personal" --allow-insecure-unlock console

Where `--networkid` is your private blockchain network ID, `--datadir` is the path to the blockchain data directory, and `--rpcport` is the port on which the RPC API will be exposed.

Upon completion of the command, your Geth node should have started and you will be logged in to the Geth Interactive Console.


You have just successfully set up a private blockchain using Ethereum and Geth. You are now ready to start developing, testing and experimenting with your own private blockchain!

Remember to protect your passphrases and your accounts, as you will have full control over your private blockchain.

Buy me a coffeeBuy me a coffee

Supportaci se ti piacciono i nostri contenuti. Grazie.

Successivamente, completa il checkout per l'accesso completo a
Bentornato! Accesso eseguito correttamente.
Ti sei abbonato con successo a
Successo! Il tuo account è completamente attivato, ora hai accesso a tutti i contenuti.
Operazione riuscita. Le tue informazioni di fatturazione sono state aggiornate.
La tua fatturazione non è stata aggiornata.