要点:
1、下载go语言,并配置环境变量
2、通过git clone以太坊源码,并编译
3、设置创世区块
1、下载go语言,并配置环境变量
安装Golang 1.9以上版本,yum安装的可以是1.8.3,所以要手动下载安装
国内镜像:https://studygolang.com/dl
#cd /opt/go-ethereum
#wget https://studygolang.com/dl/golang/go1.10.1.linux-amd64.tar.gz
# tar -xzf go1.10.1.linux-amd64.tar.gz
设置环境变量
vim /etc/profile
export PATH=$PATH:/opt/go-ethereum/go/bin
source /etc/profile
2、通过git clone以太坊源码,并编译
#cd /usr
#git clone https://github.com/ethereum/go-ethereum
#cd go-ethereum
#make geth //这个时候会下载很多依赖文件,如果go环境变量设置错误,则这一步会报错
3、设置创世区块
#cd /opt/go-ethereum/ethereum/go-ethereum/build/bin
新建文件,命名:genesis.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": { }
}
初始化区块命令:
# ./geth --datadir "./chain" init genesis.json