How to set up an Ethereum private node.

Posted By : Vishal | 31-May-2020

Ethereum is a blockchain, as well as a cryptocurrency, used to facilitate digital payments. It is a blockchain-based decentralized, open-source software platform application development. Ethereum is the most popular digital currency in the world after bitcoin. Currently, one Ether costs $237.19. A Russian-Canadian programmer, Vitalik Buterin, created Ethereum blockchain.

 

Bitcoin is only a peer to peer network-based electronic cash system. So, users use bitcoin mainly for digital transactions only. However, if you want to do more than just digital payments, Ethereum comes into play. With the help of Ethereum, you can convert your centralized application into a decentralized application. Ethereum lets a user create/deploy there smart contract solutions and distributed apps (DApps). To deploy code on Ethereum, you need to use EVM, which comes into use to compile/execute a smart contract code. EVM can facilitate compilation/execution of languages like Solidity by directly converting it into opcode first.

To use Ethereum and develop your DApp, you can sync with the testnet and mainnet provided by Ethereum. Usually, syncing an Ethereum node takes a lot of time. Ethereum provides several testnet options like Ropsten, Kovan, and Rinkeby. You can also create a separate Ethereum node on your local system that provides more control over the node. Ethereum provides libraries that let a user configure a private node on their local system, and it works the same as the main Ethereum node.

 

By following the given steps you can create your own Ethereum node at your local system.

 

 

Prerequisites-
OS: Ubuntu

 

Step 1: Install the required libraries for Ethereum

//Open terminal and type following commands
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-get install ethereum

 

Step 2: Create a separate directory, configure files, and new accounts for the private node

//Open terminal and type following commands

mkdir -p Myethereum && cd Myethereum //Create a directory where all node details will be stored

mkdir -p private && cd private  //Create a sub directory with Mail directory

// Inside private directory enters the following command.

puppeth  // A list be shown to select type of Node you want to create.


// Initialise the genesis block and create account

geth --datadir ~/Myethereum/private init test.json

geth --datadir . account new  //Create new Ethereum account

 

Step 3: Create a shell script to start the node

// Create a new script 

touch node.sh //

// Copy following code inside node.sh. Please update the directory path as per your system.

geth --networkid 4224 --mine --minerthreads 1 --datadir "~/desktop/Username/Myethereum/private" --nodiscover --rpc --rpcport "8545" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net --unlock 0 --password ~/Myethereum/private/password.sec --ipcpath "~/Library/Ethereum/geth.ipc"

// To start a node

chmod +x node.sh //Make script executable

./node.sh  //Run the node

Now, your Private Ethereum node is running and you can it status/logs under terminal.

 

Step 4: Attach the node to the geth console

// Type the following command in a separate console.
geth attach

OR

geth attach http://localhost:8545

// Mining

miner.start()  // Start Minig
miner.stop()   // Stop Minig
eth.minig      // Mining status

 

Conclusion: 

The above command can be used to set up your own Ethereum node. Node created is similar to Ethereum mainnet, and you can mine ether, deploy smart contract, and create new accounts.


Leave a Comment

Name is required

Comment is required

Recaptcha is required.

No Comments Yet.

    Request For Proposal

    By using this site, you allow our use of cookies. For more information on the cookies we use and how to delete or block them, please read our cookie notice.

    We would love to hear from you!

    Oodles | Blockchain Development Company

    Please enter a valid Phone Number

    Please remove URL from text

    Recaptcha is required.