ubuntu 安装go
自行百度
下载ethererum客户端:github
将ethererum 解压放在GOPATH下
进入 ethererum文件夹
执行:make geth 或者make all
可能会报错:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200804122310643.png)
原因:所下载的库依赖有官方库,而官方被封禁网导致。
解决:设置代理
执行:go env -w GOPROXY=https://goproxy.cn
再执行 make geth 或者 make all
创建初始区块
在GOPATH下创建文件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": { },
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
初始化geth
geth --datadir chain init genesis.json
出错:
![在这里插入图片描述](https://img-blog.csdnimg.cn/2020080412334672.png)
解决:配置环境变量
vim /etc/profile
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200804123538152.png)
启动geth控制台并创建日志文件:
geth --datadir chain console 2>> chain/geth.log
打开新的窗口查看日志文件:
创建geth账户密码为123456
personal.newAccount(“123456”)
启动以太坊开始挖矿(第一次创建可能需要较长时间)
miner.start(1)
停止挖矿
miner.stop()