blockchain | geth安装
blockchain | geth环境搭建
下载地址:
https://geth.ethereum.org/downloads
使用geth来搭建私链环境。
参考文章:
https://blog.csdn.net/TANGYAO97/article/details/112903323 # windows
https://cloud.tencent.com/developer/article/1612791 # linux
安装好测试一下:
创建创世区块状态(genesis.json):
{
"config": {
"chainId": 15
},
"difficulty": "2000",
"gasLimit": "2100000",
"alloc": {
"7df9a875a174b3bc565e6424a0050ebc1b2d1d82": {
"balance": "300000"
},
"f41c74c9ae680c1aa78f42e5647a62f353b7bdde": {
"balance": "400000"
}
}
}
然后创建一条链子:
geth --datadir C:\Users\thinkpad\Desktop\BlockChainLearn\private_net init C:\Users\thinkpad\Desktop\BlockChainLearn\private_net\genesis.json
启动链子:
geth --datadir C:\Users\thinkpad\Desktop\BlockChainLearn\private_net --networkid 15 # 15要与配置文件中的对应
可以加上--nodiscover停止发现peer。
在启动好链子的时候,可以使用geth attach进去geth控制台:
具体的连接信息在启动链子的时候可以看到。
基本操作参考:https://blog.csdn.net/wonderBlock/article/details/106314759
在输入命令创建账户的时候会发现报错,因为启动链子的时候没有开启ipc的权限:
但是上面的回答不是很对,因为geth已经更新了,需要使用最新的命令。
一同翻阅,网上写的都是依托答辩,真正的原因是personal已经废弃了,除非人为的启用:
--rpc.enabledeprecatedpersonal (default: false)
Enables the (deprecated) personal namespace
那就不用了,直接去整最新的接口。
本文来自博客园,作者:Mz1,转载请注明原文链接:https://www.cnblogs.com/Mz1-rc/p/17283531.html
如果有问题可以在下方评论或者email:mzi_mzi@163.com