以太坊私有链搭建等操作
下载软件:geth-windows-amd64-1.8.16-477eb093.zip
Mist-installer-0-11-1.exe
一、安装使用以太坊geth客户端
(1)配置环境变量
二、搭建以太坊私有链
(1)用cmd打开命令行
创建创世区块文件genesis.json,并把内容paste进去,如:
{
"config": {
"chainId": 10,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
(2)创建一个init.bat文件,并写入:
D:
cd D:\geth
geth init ./genesis.json --datadir ./
1.创建一个start.bat,并写入:
D:
cd D:\geth
geth --identity "node1" --rpc --rpcport 1111 --rpccorsdomain "*" --datadir "./" --port 6666 --ipcpath "geth\geth1.ipc" --networkid 10
2.创建一个control.bat,并写入:
D:
cd D:\geth
geth attach \\.\pipe\geth\geth1.ipc
接着,点击init.bat,进行初始化,初始化成功:
点击start.bat,开始运行,启动节点
进入控制台,开始挖矿
三、在私有链上创建账号、开启挖矿
挖矿成功: