Creating your own private ethereum blockchain network

Let’s get our hand dirty on creating a private ethereum blockchain network.

  • Install geth

    Go to https://geth.ethereum.org/downloads/

    Download the installer, follow the wizard.

  • Create a genesis.json file

    Create a genesis.json file which will look like below –

{
  "difficulty" : "0x20000",
  "gasLimit"   : "0x8000000",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}

Open a console and create a folder

C:\>mkdir mychain
C:\>cd mychain

Open a create a folder chaindata, this folder will have all of our blockchain related data in file based storage

C:\mychain>mkdir chaindata

Create a file genesis.json as stated above. Now mychain folder will have a folder chaindata and a file genesis.json

  • Init and bring up your blockchain

Initialise your blockhain

C:\mychain>geth --datadir=./chaindata init ./genesis.json

You should see something like this output:

[INFO] Successfully wrote genesis state

You now have to start geth with that chaindata directory:

C:\mychain>geth --datadir=./chaindata --nodiscover

Congratulations, your first private blockchain is up. Feel free to comment your thoughts.

 

Leave a Reply

Your email address will not be published. Required fields are marked *