1. Create a new genesis.json
{
"config": {
"chainId": 666,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"ethash": {}
},
"nonce": "0x0",
"timestamp": "0x5ddf8f3e",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x47b760",
"difficulty": "0x00002",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0x1e82968C4624880FD1E8e818421841E6DB8D1Fa4" : {"balance" : "30000000000000000000"}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
May refer to various parameters explained: https://www.cnblogs.com/wanghui-garcia/p/10256520.html
If there is no section below alloc, may appear: Fatal: Failed to write genesis block: unsupported fork ordering: eip150Block not enabled, but eip155Block enabled at 0 errors
Specific reference: http://www.blogjava.net/waterjava/archive/2019/11/28/434937.html
2. Start
2.1. Initialization
geth --datadir /usr/geth/data init /usr/geth/config/genesis.json
2.2 Start private chain and into the console
geth --datadir /usr/geth/data --networkid 666 console
3. Create an account mining
3.1. Create an account
personal.newAccount () and then follow the prompts to enter your password
personal.newAccount the same time ( "123456") to create an account to specify a password
3.2. Mining
miner.start (1) Do not fill in brackets is the default if the full mining
3.3. Stop
miner.stop () to stop mining