Compile & Run


First, you need to install the go development environment and make. This part belongs to the technical scope of go. You can consult related documents by yourself. After the environment is set up, enter the following operations

Enter the project root directory and execute the following command


make all

When the command is executed, binary files such as bootnode, geth, etc. will be generated in build/bin. Just copy these two files to the server to be deployed.

Note: It is best to compile on the server or in the same environment as the server to prevent cross-platform problems

2.bootnode and geth

After finishing the above compilation, you will get two files, bootnode and geth. First, explain what these two files are.

2.1 bootnode

A lightweight node: it does not have any computing functions, and is only used for mutual discovery between other nodes. If you have experience in the development of microservices, you can understand it as [Registration Center], so I should understand.

A blockchain network is composed of a large number of nodes. These nodes discover each other and form a network in series, which is realized by the bootnode node.

2.2 geth

The official node: packaging, calculation, and storage are all done by this node, and these nodes form a complete blockchain network

3.start the node

In order to facilitate the demonstration, I have placed all nodes on one server. In the actual environment, depending on the requirements, many servers may need to be prepared

3.1 Start a bootnode node


// Generate key

./bootnode --genkey=boot.key

// Start the bootnode node

./bootnode --nodekey=boot.key -addr=

// If you want to execute in the background, you can do this

nohup ./bootnode --nodekey=boot.key -addr= >>bootnode.log 2>&1 &

After startup, you will see this passage in the console or log file



Copy it out and change it to this. It will be used when starting geth. If you want to join an existing blockchain network, then this step can be omitted and you can get it from the administrator of the existing network This section of configuration is enough, you don’t need to start the bootnode by yourself



Supplementary description:

1. If you want this bootnode to be used by nodes other than this machine, you must open port 20001 and support the udp protocol (it doesn’t have to be 20001, you just set it after -addr How much is open)

2. If you just want to connect to the existing blockchain network, then you don't need to start the bootnode, just start geth directly

3.2 Start geth node

In order to freely switch back to the console of any node, it is best to install screen


sudo apt-get install screen

In order to save the log to the specified file, the configuration file needs to be modified


vi /etc/screenrc

Add this sentence at the end


logfile /data/xt/runner/logs/geth_%t.log

// The value of %t, set when starting the node

Start the geth node (the default is the mainnet, if you want to start with the configuration of the testnet, you can add a parameter --testnet after ./geth)


screen -L -t Log file name (the value of %t in the previous step) -S console name ./geth --networkid="1024" --identity "test1"

--http --http.port "30080"

--datadir data0

--port "30303" --http.addr


--allow-insecure-unlock --ipcdisable --rpc.allow-unprotected-txs



--http.corsdomain="*" console

--networkid: network ID, must be equal to the networkId configured in cmd/utils/flags.go
--bootnodes: bootnode node information, just copy the paragraph in step 3.1, if you need to configure multiple bootnodes, split them by commas
--identity: name
--http: enable HTTP-RPC server
--http.addr: HTTP-RPC server listening port (default: localhost)
--http.port: HTTP-RPC server listening port (default: 8545)
--http.api: API provided through HTTP-RPC interface (default: eth, net, web3)
--http.corsdomain: A comma-separated list of domains that accept cross-origin requests (enforced by the browser)
--ws: enable WS-RPC server
--ws.addr: WS-RPC server listening port (default: localhost)
--ws.port: WS-RPC server listening port (default: 8546)
--ws.api: API provided in the WS-RPC interface (default: eth, net, web3) accept the source of websockets requests
--ipcdisable: Disable IPC-RPC server
--ipcapiAPI: provided in the IPC-RPC interface (default: admin,debug,eth,miner,net,personal,shh,txpool,web3)
--ipcpath: file name of IPC socket/pipe in datadir (explicit path to escape it)

After startup, you will enter the console and see the startup log. If there is no error, it means success. Press ctrl+a+d to switch to the background. For specific front and background operations, see 3.3 [Command for switching between the front and back of the console]

To start the second, third, and Nth node, you only need to change the port number, name and log output path in the above command

Note: If you want this geth to connect to a network other than this machine, you must open port 30303 and support the udp protocol (not necessarily 30303, you are behind --port Open as many as you set)

3.3 Commands for switching between the front and the back of the console

ctrl+a+d run the console in the background
screen -ls view the console running in the background
screen -r console ID, open the running console
ctrl+d safe stop node


Open one of the node consoles and enter the following commands in the console


personal.importRawKey("Your wallet private key","Your wallet password")

personal.unlockAccount("Your wallet address","Wallet Password",Unlock timeout period)

miner.setEtherbase("Your wallet address")


Supplementary description:

1. Only the node that produces the block needs to execute this command, and the account used must be the validator account you configured

2. Each node can only have one account for mining, and the number of nodes producing blocks must be greater than half of the number of validator accounts, otherwise the network will not be available and no one will process all transactions


Use metamask to connect to any node. If it can be used normally, the deployment is successful.

RCP address: http://server IP:--http.port of any node
Chain ID: 1024 (here according to your own configuration ID)
Symbol: the name you gave the coin


Never use kill to directly kill the process

If you kill the geth process or it crashes, it will not write the latest state of the cache, and will force abandon the 'fast' synchronization state at the next startup and roll back to the last 'complete' 'Status. It will cause the balance to be lost

Elegantly shutdown options: SIGINT, SIGTERM, Ctrl+ D (if running on the console), Ctrl+ C1

Unsafe shutdown options: SIGQUIT, SIGKILL, Windows' [X] button

If there is a balance reset, you can try the following solutions

Stop the node and execute this command


./geth removedb

Delete the data directory corresponding to this node, and then restart the node


[Console Operation Command] (


Environment & Configuration