Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Tutorial deploy node with Ethereum blockchain

Maxime Blaszka – 22/08/2018

OS : linux (ubuntu)

Before that, install ethereum client : https://www.ethereum.org/cli

1) Create directory for your node

$> mkdir ethnetwork

2) Create genesis.json file in ethnetwork

$> touch genesis.json

3) Paste the following code in genesis.json file


{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000033",
"timestamp": "0x0",
"parentHash":
"0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x8000000",
"difficulty": "0x100",
"mixhash":
"0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc":{}
}

4) Init genesis.json file

$> geth --datadir=. init genesis.json


5) Back to parent-folder and launch your node

$> geth --rpc --rpcport {your_port} -rpcaddr {your_ip} --rpccorsdomain "*"


--datadir "ethnetwork/" --identity "Private" --networkid 15 --nodiscover --
maxpeers 0 console

6) Create two accounts inside your node console


$> personal.newAccount("password")
$> personal.newAccount("password")

7) Start mining

$> miner.start(2)

8) Open new terminal, go to ethnetwork folder, open another console

$> geth attach geth.ipc

9) Unlock your accounts

$> web3.personal.unlockAccount(web3.personal.listAccounts[0], "password",


15000);

$> web3.personal.unlockAccount(web3.personal.listAccounts[1], "password",


15000);

10) Send ether to your accounts

$> miner.setEtherbase(personal.listAccounts[0])

$> miner.setEtherbase(personal.listAccounts[1])

11) Test transfer of ethers


$> var sender = eth.accounts[0];
$> var receiver = eth.accounts[1];
$> var amount = web3.toWei(0.001, "ether");
$> eth.sendTransaction({from:receiver, to:sender, value: amount});

You might also like