This article is mainly a supplement to the previous article, before the operation, we need to prepare two computers with an ethereum environment. Suggest learning Ethereum or other blockchain project preferred Linux or Mac OS, personally feel that CMD is not easy to use, because I have another window system on the computer, so I was on the window to recompile the Ethereum source, in the compilation process encountered some problems, I'll just give the solution to the problem in a short way.
Compiling source code
1.Go language Environment preparation, you can directly go to the official website to download the installation package, installed after the general circumstances of the environment variable is automatically configured, but need to configure $GOPATH
the environment variables, will not be on the Internet to find tutorials.
2. go-ethereum
source code and golang.org\x\net
Source (note window under the road hard separator), the source code must be placed $GOPATH\src
under, the file structure is as follows:
$GOPATH$/src ├── github.com │ └── ethereum │ └── go-ethereum └── golang.org └── x
3. Configuring the GCC
Environment
If there is no configuration environment, the gcc
following error is reported during compilation:
exec: "gcc": executable file not found in %PATH%
Workaround:
Download install GCC, then add the Bin folder under the installation directory to the PATH environment variable, open cmd, enter
gcc -v
If the version information appears, the installation is successful.
Tip: Re-open cmd every time you modify an environment variable
Continue compiling the source code and error message:
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
Workaround:
Download the compiled package directly for installation
- Download Address:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/ mingw-builds/4.8.2/threads-posix/seh/, download the following zip package directly
- Configure the bin in the folder to the path path after decompression
4. Compiling the source code
Switch to the path in CMD $GOPATH\src
, and then execute the command:
go install -v github.com\ethereum\go-ethereum\cmd\gethgo install -v github.com\ethereum\go-ethereum\cmd\evm
After the compilation succeeds $GOPATH\bin
, it geth.exe
appears evm.exe
as shown in the following:
Prepare the creation block
This step is the same as in the previous chapter, note that the content of Genesis.json is the same as the previous one, the file structure is as follows:
Tips:
You can follow the individual likes to put the file in other places, initialize and start the node when you need to follow the full path
Initializing the Genesis block
geth --datadir d:\ethprivatechain\data init d:\ethprivatechain\genesis.json
Start node
1. Go to the geth
console
geth --datadir d:\ethprivatechain\data --networkid 100 console
In order to differentiate the operation, my two computers mac for node 1,win for node 2,mac and win on successively startedgeth
2. mac
get the Enode information on the node
> admin.nodeInfo.enode//输出信息"enode://e08f44fbedfd17b549a5237ebe7548501a891f34859cd71fdf083d99e8de2763902967af54f67423ac632648904674ffa86d7fa6fccee649a992b4942f424b17@[::]:30303"
3. Add the operation of the win
first node on the node
> admin.addPeer("enode://e08f44fbedfd17b549a5237ebe7548501a891f34859cd71fdf083d99e8de2763902967af54f67423ac632648904674ffa86d7fa6fccee649a992b4942f424b17@192.168.111.20:30303")//输出信息true
Note: The Enode information in the [::] is replaced with the first node of the IP, the question mark and the following parts do not need
4. View the connected nodes
//查看连接的节点数量,此处为1> net.peerCount1// 查看连接的节点信息> admin.peers[{ caps: ["eth/63"], id: "e08f44fbedfd17b549a5237ebe7548501a891f34859cd71fdf083d99e8de2763902967af54f67423ac632648904674ffa86d7fa6fccee649a992b4942f424b17", name: "Geth/v1.8.16-unstable/darwin-amd64/go1.10.2", network: { localAddress: "192.168.111.233:64651", remoteAddress: "192.168.111.20:30303" }, protocols: { eth: { difficulty: 17179869184, head: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", version: 63 } }}]
Both node 1 and Node 2 can be dug, and as long as one node is digging, the other node's transactions can be normal.