Launch your own private Ethereum Blockchain

Learn how to get going with your very own ethereum blockchain in 5 minutes.





Introduction
In this simple tutorial on Ethereum blockchain. We'll learn how to start our own blockchain network using Ethereum.
Why launch a private Ethereum blockchain?
This is a valid question and needs an answer before we proceed. You can choose your reason out of the following different reasons we've listed:
  1. Connecting to main network requires us to download GBs of data. We may be on a slow network and may not be in a position to download the data
  2. Main network means you need "REAL" ether to make transactions and ether is costly these days.
  3. When we're learners we tend to break things often and doing so on the real or main network is definitely not a good idea.
OK , given so many reasons, it's actually a good idea to start our very own private ethereum blockchain network on our local machine. In the following sections we'll see how to achieve that.
The genesis Block
The first block in a blockchain is called "Genesis Block" and it has no blocks behind it. So we need a way to define some of the attributes in a file. Those attributes are the defining attributes of the blockchain. On your machine create a directory named "my-blockchain" and cd to that directory. Now inside of this directory , create a file named "genesis.json" and add the following content to it.
                                    
{
    "config": {
        "chainId": 14
    },
    "difficulty": "10",
    "gasLimit": "3000000",
    "alloc": {
        "df317d8f4658c7520a66aed31cafb4543278b21d": {
            "balance": "100000"
        }
    }
}
							
								

Launch the Network
Once the above file is defined , use the following command at the terminal to launch your private ethereum blockchain.
                                
geth --datadir ./ethNet init ./genesis.json
                                        
                        
                            
Now is the time to start our node and for that we can use the following command.
                                            
geth --datadir ./ethNet --networkid 1493
                                                    
                                                    
                                    
                                        
And you've done it. You private ethereum network is up and running.