timestamp: 设置创世块的时间戳
parentHash: 上一个区块的hash值,因为是创世块,所以这个值是0
extraData: 附加信息,随便填,可以填你的个性信息
gasLimit: 该值设置对GAS的消耗总量限制,用来限制区块能包含的交易信息总和,因为我们是私有链,所以填最大。
初始化创世区块
neo@netkiller ~/ethereum % geth init genesis.json
WARN [01-19|17:35:17] No etherbase set and no accounts found as default
INFO [01-19|17:35:17] Allocated cache and file handles database=/home/neo/.ethereum/geth/chaindata cache=16 handles=16
INFO [01-19|17:35:17] Writing custom genesis block
INFO [01-19|17:35:17] Successfully wrote genesis state database=chaindata hash=611596…424d04
INFO [01-19|17:35:17] Allocated cache and file handles database=/home/neo/.ethereum/geth/lightchaindata cache=16 handles=16
INFO [01-19|17:35:18] Writing custom genesis block
INFO [01-19|17:35:18] Successfully wrote genesis state database=lightchaindata hash=611596…424d04
默认目录是 /home/neo/.ethereum/ 你可以通过 --datadir 参数指定目录
neo@netkiller ~/ethereum % geth --datadir data init genesis.json
WARN [01-19|17:38:16] No etherbase set and no accounts found as default
INFO [01-19|17:38:16] Allocated cache and file handles database=/home/neo/ethereum/data/geth/chaindata cache=16 handles=16
INFO [01-19|17:38:17] Writing custom genesis block
INFO [01-19|17:38:17] Successfully wrote genesis state database=chaindata hash=611596…424d04
INFO [01-19|17:38:17] Allocated cache and file handles database=/home/neo/ethereum/data/geth/lightchaindata cache=16 handles=16
INFO [01-19|17:38:17] Writing custom genesis block
INFO [01-19|17:38:17] Successfully wrote genesis state database=lightchaindata hash=611596…424d04
neo@netkiller ~/ethereum % find data
data
data/keystore
data/geth
data/geth/chaindata
data/geth/chaindata/LOCK
data/geth/chaindata/LOG
data/geth/chaindata/MANIFEST-000000
data/geth/chaindata/CURRENT
data/geth/chaindata/000001.log
data/geth/lightchaindata
data/geth/lightchaindata/LOCK
data/geth/lightchaindata/LOG
data/geth/lightchaindata/MANIFEST-000000
data/geth/lightchaindata/CURRENT
data/geth/lightchaindata/000001.log
启动节点
neo@netkiller ~/ethereum % geth --networkid 123456 --rpc --rpccorsdomain “*” --nodiscover console
WARN [01-19|17:47:06] No etherbase set and no accounts found as default
INFO [01-19|17:47:06] Starting peer-to-peer node instance=Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.1
INFO [01-19|17:47:06] Allocated cache and file handles database=/home/neo/.ethereum/geth/chaindata cache=128 handles=1024
INFO [01-19|17:47:06] Initialised chain configuration config="{ChainID: 15 Homestead: 0 DAO: DAOSupport: false EIP150: EIP155: 0 EIP158: 0 Byzantium: Engine: unknown}"
INFO [01-19|17:47:06] Disk storage enabled for ethash caches dir=/home/neo/.ethereum/geth/ethash count=3
INFO [01-19|17:47:06] Disk storage enabled for ethash DAGs dir=/home/neo/.ethash count=2
INFO [01-19|17:47:06] Initialising Ethereum protocol versions="[63 62]" network=123456
INFO [01-19|17:47:06] Loaded most recent local header number=0 hash=611596…424d04 td=131072
INFO [01-19|17:47:06] Loaded most recent local full block number=0 hash=611596…424d04 td=131072
INFO [01-19|17:47:06] Loaded most recent local fast block number=0 hash=611596…424d04 td=131072
INFO [01-19|17:47:06] Loaded local transaction journal transactions=0 dropped=0
INFO [01-19|17:47:06] Regenerated local transaction journal transactions=0 accounts=0
INFO [01-19|17:47:06] Starting P2P networking
INFO [01-19|17:47:06] RLPx listener up self=“enode://9f6490ffb5236f2ddc5710ae73d47c740e0a3644bbd2d67029cf4a6c4693d2f470b642fd2cc3507f7e851df60aaeb730a1270b7a477f91ec5b6b17a8a4b40527@[::]:30303?discport=0”
INFO [01-19|17:47:06] IPC endpoint opened: /home/neo/.ethereum/geth.ipc
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。