Used nodes:
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
Linux localhost.localdomain 4.14.5-200.fc26.x86_64 #1 SMP Mon Dec 11 16:29:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Darwin 0mkars-MacBook-Pro.local 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
3 physical machines were used as 3 Ethereum nodes for this experiment. Ethereum node on Raspberrypi was setup to act as bootnode. Other two Ethereum nodes were connected to the bootnode by setting --bootnode
parameter.
Please follow standart setup process or use prebuilt binaries from https://geth.ethereum.org/downloads/
Following the bellow steps we will create our private Ethereum testnet.
Create a genesis.json file:
vi genesis.json
Insert following lines:
{
"config": {
"chainId": 0,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
A genesis block is the first block of a blockchain. Modern versions of Bitcoin assign it block number 0, though older versions gave it number 1. The genesis block is almost always hardcoded into the software. It is a special case in that it does not reference a previous block, and for Bitcoin and almost all of its derivatives, it produces an unspendable subsidy.
For detailed explanation of genesis file component see here.
Setup geth
on your Raspberrypi and run following commands to start bootnode
bootnode --genkey=boot.key
bootnode --nodekey=boot.key
This will start bootnode and we will have our bootnode address
INFO [12-27|15:22:12] UDP listener up self=enode://865655f2a55c792aa4749d00bf24431fc4b3f686948a047c1f1f3b2569b368900a462cb1658e288f513ab42a3aef74d14d1ee1bac445678aab954ed4b8a90fd8@[::]:30301
Iniatialize a geth node with custom genesis
geth --datadir="~/test/" init genesis.json
NOTE: Perform above process on both nodes. genesis.json
needs to be identical on both nodes.
Then we can start our nodes with --bootnode
option as
geth --bootnodes="enode://865655f2a55c792aa4749d00bf24431fc4b3f686948a047c1f1f3b2569b368900a462cb1658e288f513ab42a3aef74d14d1ee1bac445678aab954ed4b8a90fd8@192.168.0.6:30301" --verbosity=6 console
@Etienereum for this guide you can put
genesis.json
anywhere but you have to specify the exact path to the file.