How to run a private Ethereum Blockchain with Jthereum

Step 1

Launch one EC 2 Ubuntu 16 LTS or Launch one VM instance on GCP.

If you wish to use AWS, here is how you set up an instance:

AWS EC Ubuntu 16 LTS Setup.

Running the Machine

If you want to use GCP, that is how your set up looks like:

Google cloud platform : Ethereum Instances.

Step 2

Open the inbound ports 30301–30399 in the security group

Step 3

SSH into the Node (ie. Machine)

Click on (Open in browser window).

Step 4

On both server Install Geth (ie. Machine)

sudo apt-get install software-properties-common

sudo add-apt-repository -y ppa:ethereum/ethereum

sudo apt-get update

sudo apt-get install ethereum

After installation ensure that both servers have geth properly install by running this commands.

geth –help

Step 5

On the server Install Geth (ie. Machine)

Initialize Genesis Block (0th Block) in genesis.json inside /home/ubuntu/eth-dev/ directory.

cd ~

mkdir eth-dev

cd eth-dev

nano genesis.json

Paste the below line into the nano’s window.

{ “config”: { 
“chainId”: 88881, 
“homesteadBlock”: 0, 
“eip155Block”: 0, 
“eip158Block”: 0 }, 

“coinbase” : “0x0000000000000000000000000000000000000000”, 
“difficulty” : “0x10”, 
“extraData” : “”, 
“constantinopleBlock“: “5“,
“petersburgBlock“: “6“,
“gasLimit” : “0x2fefd8”, 
“nonce” : “0x0000000000000088”, 
“mixhash” : “0x0000000000000000000000000000000000000000000000000000000000000000”, 
“parentHash” : “0x0000000000000000000000000000000000000000000000000000000000000000”, 
“timestamp” : “0x00”, “alloc”: {} }

Step 5.1

****Initialize the chain data with below command:

geth — datadir ~/eth-dev/ init genesis.json

Step 5.2

Start the Ethereum Machine 1 with the below command

geth — datadir ~/eth-dev/ — networkid 45634 — verbosity 3 — ipcdisable — rpc — port 30301 — rpcport 8545 — rpcaddr <Public DNS address of your Node 1> console 2>> ~/eth-dev/eth.log


geth — datadir ~/eth-dev/ — networkid 88881 — verbosity 3 — ipcdisable — rpc — port 30301 — rpcport 8545 –rpcaddr console 2 >> ~/eth-dev/eth.log

You would see the logs created by the geth client.

Step 6

Now go to machine 1 and execute the cmds.

admin.addPeer( “enode://5b81114a01d9a382cfc101f13e177f3a784864d6cd9f33eafd33f9fd838fd8c83004766fa90a3cff8ead55d5847e8cd30a0311186b548a12e348449faebe2cbb@” )

If above command return “true” after executing above command, then it means you have added the machine 2 as a peer to machine 1.

Check the peers details by running below cmd:

>  net.peerCount1> admin.peers[{ caps: [“eth/63”], id: “91233bfe9c817a325ee85c0041bb6db8a6645c9a0e2a6d38fa49e7d3824249c6a32c487cd710980efd5791d05ff06629fe499186132a2e7e9ac7e63502dd683f”, name: “Geth/v1.8.8-stable/linux-amd64/go1.9.4”, network: { inbound: true, localAddress: “”, remoteAddress: “”, static: false, trusted: false }, protocols: { eth: “handshake” }}, { caps: [“eth/63”], id: “f2c435410be202a7dd9f20b23eb23d767f51756be23d9d599b468df7680e212ec543430580b7971184652be03d5e38076f86a09cc29f9f6133eb64fcd80a691e”, name: “Geth/v0.0.7-akroma-ccecfba1/linux-amd64/go1.9.2”, network: { inbound: false, localAddress: “”, remoteAddress: “”, static: false, trusted: false }, protocols: { eth: “handshake” }}]>

Step 7

Other Geth console Cmds

admin.nodeInfo.enodenet.listeningnet.peerCountadmin.peerseth.coinbaseeth.getBalance(eth.coinbase)personaleth.accountsminer.setEtherbase(web3.eth.accounts[0])miner.setEtherbase(“0xae13d41d66af28380c7af6d825ab557eb271ffff”)miner.start()miner.stop()miner.hashrateeth.getBlock(0)eth.getBlock(“latest”)eth.blockNumber web3.eth.getBlock(BLOCK_NUMBER).hasheth.syncingdebug.verbosity(6)

Step 8

Connect your new blockchain network to Jthereum.

Go to jthereum.config file (it is located in your Jthereum installation folder).



(it will be our new blockchain that we have just created).

Add properties for the private key and Web3JS URL:

NEW_PrivateKey = 0xf5adeb6e95cf25a72b7ebe842f17197e594a646afc7f56cba67f315a5787259a
NEW_Web3j_URL =

NOTE : Your private key and Web3JS URL will be different from test data provided above.