Private Chain Construction
Prepare an Account
Access the working directory /directory/of/geth
$ ./geth account new --datadir ./dataThe keystore file of the new account is located under the path/directory/of/dxc/build/bin/data/keystore.

Import the JSON file in Metamask.

Create genesis.json
Create gensis.json file under
/path/to/dxc/build/bin/Change
chainIdto 72Replace the initial address in
extraDatawith your new account address
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a88548e97af8809afac9dc7a930650c1179510590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
===>>>
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000'your new account'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 4. Set the initial balance in alloc for the new address, at least 0x50c783eb9b5c85f2a80000000
{
"config": {
"chainId": 72,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"dpos": {
"period": 3,
"epoch": 28800
}
},
"nonce": "0x0",
"timestamp": "0x5fc58968",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a88548e97af8809afac9dc7a930650c1179510590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x280de80",
"difficulty": "0x1",
"alloc": {
"0xa88548e97af8809afac9dc7a930650c117951059": {
"balance": "0x50c783eb9b5c85f2a80000000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}Initialize the Genesis Block
$ ./geth init /path/to/genesis.json --datadir ./dataStart the Node
Compile and RunStart Mining
Open the console
./geth attach --datadir ./dataUnlock miner account
personal.unlockAccount("miner address","password",0)Start mining
miner.start()
Multi-nodes Mining
Other nodes use the same
genesis.jsoninitial nodesGet the enode information for the master node
admin.nodeInfoNew node
geth attachOpen the console, add the node information for master node
admin.addPeer("enode info")
Last updated
Was this helpful?