1.建一个目录
2.编写配置文件
eric@eric-virtual-machine:~/ethdev2$ pwd /home/eric/ethdev2 eric@eric-virtual-machine:~/ethdev2$ cat piccgenesis.json { "config": { "chainId": 15, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 }, "coinbase" : "0x0000000000000000000000000000000000000000", "difficulty" : "0x40000", "extraData" : "", "gasLimit" : "0xffffffff", "nonce" : "0x0000000000000042", "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp" : "0x00", "alloc": { } }
3.初始化
eric@eric-virtual-machine:~/ethdev2$ geth --datadir "./chain" init piccgenesis.json
WARN [01-18|00:10:53] No etherbase set and no accounts found as default
INFO [01-18|00:10:53] Allocated cache and file handles database=/home/eric/ethdev2/chain/geth/chaindata cache=16 handles=16
INFO [01-18|00:10:53] Writing custom genesis block
INFO [01-18|00:10:53] Successfully wrote genesis state database=chaindata hash=a0e580…a5e82e
INFO [01-18|00:10:53] Allocated cache and file handles database=/home/eric/ethdev2/chain/geth/lightchaindata cache=16 handles=16
INFO [01-18|00:10:53] Writing custom genesis block
INFO [01-18|00:10:53] Successfully wrote genesis state database=lightchaindata hash=a0e580…a5e82e
eric@eric-virtual-machine:~/ethdev2$ ll
total 32
drwxrwxr-x 3 eric eric 4096 1月 18 00:10 ./
drwx------ 40 eric eric 12288 1月 18 00:06 ../
drwx------ 4 eric eric 4096 1月 18 00:10 chain/
-rw-rw-r-- 1 eric eric 528 1月 18 00:06 piccgenesis.json
eric@eric-virtual-machine:~/ethdev2$
4.打开控制台
geth --datadir "./chain" --nodiscover console 2>>geth.log
eric@eric-virtual-machine:~/ethdev2$ geth --datadir "./chain" --nodiscover console 2>>geth.log Welcome to the Geth JavaScript console! instance: Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0 >
eric@eric-virtual-machine:~/ethdev2$ tail -f geth.log
INFO [01-18|00:12:34] Disk storage enabled for ethash caches dir=/home/eric/ethdev2/chain/geth/ethash count=3
INFO [01-18|00:12:34] Disk storage enabled for ethash DAGs dir=/home/eric/.ethash count=2
INFO [01-18|00:12:34] Initialising Ethereum protocol versions="[63 62]" network=1
INFO [01-18|00:12:34] Loaded most recent local header number=0 hash=a0e580…a5e82e td=262144
INFO [01-18|00:12:34] Loaded most recent local full block number=0 hash=a0e580…a5e82e td=262144
INFO [01-18|00:12:34] Loaded most recent local fast block number=0 hash=a0e580…a5e82e td=262144
INFO [01-18|00:12:34] Regenerated local transaction journal transactions=0 accounts=0
INFO [01-18|00:12:34] Starting P2P networking
INFO [01-18|00:12:34] RLPx listener up self="enode://e07a3c23250473ae5416fd7441a405859db9d6b366eb25a265a12ccb673ad3a6385ba61b83b9019a6d23f0e26665376a6b186d64ef5135fe30f3363a333dfd36@[::]:30303?discport=0"
INFO [01-18|00:12:34] IPC endpoint opened: /home/eric/ethdev2/chain/geth.ipc
5.开始挖矿
eric@eric-virtual-machine:~/ethdev3$ geth --datadir "./chain" --nodiscover console 2>>geth.log Welcome to the Geth JavaScript console! instance: Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0 > eth.accounts [] > personal.newAccount('123') "0xbd84af58aaf48fcb1821333b0213a48266919bda" > miner.start() null > eth.mining true > eth. (anonymous): Line 2:1 Unexpected end of input > eth.block undefined > eth.blockchain undefined > eth.blockNumber 0 > eth.blockNumber 0 > eth.blockNumber 0 > eth.blockNumber 5537 >