A Comprehensive Guide to Ethereum Blockchain (Part 2)

  1. Create a new folder on your desktop called Private Chain.
  2. Open command prompt in this folder and create a data directory for your chaindata by typing mkdir chaindata.
  3. Next, you need to create and save your genesis.json block in your Private Chain folder, as the genesis block will be used to initialize your private network and store data in the data directory chaindata.
  4. Open Notepad, copy & paste the code below into a new file called genesis.json and save this file in your Private Chain folder.
{
"coinbase" : "0x0000000000000000000000000000000000000001",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00",
"alloc": {},
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
}
}
geth --nodiscover --networkid 1999 --datadir=./chaindata/ init ./genesis.json
geth --datadir=./chaindata/

Mist Browser

pragma solidity ^0.4.16;
contract HelloWorld {

uint256 counter = 5; //state variable we assigned earlier
function add() public { //increases counter by 1
counter++;
}

function subtract() public { //decreases counter by 1
counter--;
}
function getCounter() public constant returns (uint256) {
return counter;
}
}
geth attach
miner.start();
miner.start();

--

--

Aion is a financial technology company specializing in digital banking platforms. It is headquartered in Bahrain with business presence across the GCC.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aion Digital

Aion Digital

Aion is a financial technology company specializing in digital banking platforms. It is headquartered in Bahrain with business presence across the GCC.