- Installation go environment
- Https://golang.google.cn/dl/ package from the official website to download the required local, if you can also use wget
- Upload the linux (SCRT use alt + p, then put command), the use of tar codecs
- Configuration environment variable
export JAVA_HOME=/home/hadoop/app/jdk1.7.0_65
export GO_HOME=/home/go
export PATH=$PATH:$JAVA_HOME/bin:$GO_HOME/bin
source /etc/profile
Run go version to see if the installation was successful
Pit: best to GO_HOME written GOPATH
2. Install the geth
- Download the source code from github https://github.com/ethereum/go-ethereum/tags
- Upload to linux, use tar decompression
- Enter the unpacked directory , execute make.
- Configure the environment variables export PATH = $ PATH: $ JAVA_HOME / bin: $ GO_HOME / bin: /home/eth/go-ethereum-1.8.27/build/bin
Verify geth version
3. Create the node creation block chain and run
- Create the initial block chain
{
"config": {
"chainId": 22,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x400",
"ExtraData": "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000038",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
genesis.json
carried out
geth --datadir /opt/data init /opt/eth/genesis.json
/ Opt / the Data Path casually , but back to use , needs to be consistent
carried out
geth --identity "TestNode" --rpc --rpcport "8545" --datadir /home/chain --port "30303" --nodiscover console
geth --datadir /home/data --rpc --rpcaddr 192.168.137.134 --rpcapi "db,eth,net,web3,miner,personal" console
--nodiscover represents private chain do not let the public Internet node discovery
Use web3j, do not forget to turn off the firewall