本文搭建的环境是基于Ubuntu 16.04。私有链的环境搭建还是比较简单。
第一步 安装geth客户端
Ubuntu安装geth客户端很简单,只需要三条命令足以。
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
安装完成后,用命令geth help验证是否安装成功。
输出类似结果即为安装成功
NAME:
geth - the go-ethereum command line interface
Copyright 2013-2018 The go-ethereum Authors
USAGE:
geth [options] command [command options] [arguments...]
VERSION:
1.8.14-stable-316fc7ec
第二步 创建创世区块
准备genesis.json创世文件
vim genesis.json
内容如下
{
"config":
{
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x40000",
"extraData" : "",
"gasLimit" : "0xffffffff",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000