Adding nodes to your private blockchain

In my previous post I showed how to create your private blockchain, but a blockchain of one node is not very useful 🙂 Let’s learn how to connect other nodes.

If you followed the steps of the previous post you should already have Node 1 installed. In Node 1 launch geth console and run admin.nodeInfo.enode. You should get something like this:


This will be the address that you have to give Node 2 so it can connect to Node 1

restart geth on Node 1 setting –maxpeers

geth –mine –networkid 1337 –nodiscover –maxpeers 3 console

Now install geth in Node2 and initialise it using the same genesis block you used to set up Node 1.

geth init genesisBlock.json

In order to connect Node 2 with Node 1 you need to create file static-nodes.json adding the IP and port (which need to be accessible) of Node 1’s machine.

cat > $HOME/.ethereum/static-nodes.json


run geth in Node 2, use the same network id as you did in Node 1

geth –networkid 1337 –nodiscover –verbosity 5 console

if everything has worked you will see in Node2 a message showing successful connection

I0829 22:16:38.318582 eth/handler.go:258] Peer 639d05c6307c25db [eth/63]: peer connected [Geth/v1.4.11-stable-fed692f6/linux/go1.6.2]

let’s transfer some ETH from the wallet in Node 1 to the wallet in Node 2. First create a wallet in Node 2 and save the address

> personal.newAccount()
Repeat passphrase:

in our account in Node 1 we can now send money to the newly created wallet in Node 2

>eth.sendTransaction({from:”0x55a0040fd8ac1177d598e8880cee248c7c9ac1b9″, to:”0x1329560ae07a9fc8a3161c66dfef13da609cfda5″, value:web3.toWei(5,”ether”)})

if either Node 1 or Node 2 are mining blocks you will soon see the transaction happening. You can check your new balance at your account in Node 2



One thought on “Adding nodes to your private blockchain

  1. Pingback: Creating a private ethereum blockchain from scratch | My Map of things

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s