当前位置:   article > 正文

以太坊公链Geth同步

geth以太坊链接公链

1、安装所需基础工具

yum update -y && yum install git wget bzip2 vim gcc-c++ ntp epel-release nodejs cmake -y

2、安装Go

  1. wget https://dl.google.com/go/go1.10.linux-amd64.tar.gz
  2. tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz
  3. echo 'export GOROOT=/usr/local/go' >> /etc/profile
  4. echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/profile
  5. echo 'export GOPATH=/root/go' >> /etc/profile
  6. echo 'export PATH=$PATH:$GOPATH/bin' >> /etc/profile
  7. source /etc/profile

验证

  1. $ go version
  2. go version go1.10 linux/amd64

3、克隆编译项目go-ethereum

  1. git clone https://github.com/ethereum/go-ethereum.git
  2. cd go-ethereum
  3. make all

在path中加入geth路径

  1. echo 'export PATH=$PATH:/opt/go-ethereum/build/bin' >> /etc/profile
  2. source /etc/profile

验证

  1. [root@iZrj9hk3x36fkle13532jaZ ~]# geth version
  2. INFO [08-16|10:12:12.117] Bumping default cache on mainnet provided=1024 updated=4096
  3. Geth
  4. Version: 1.9.2-unstable
  5. Git Commit: c9cdf144d55f6bbd75314e812eeefc18d7e8c40e
  6. Git Commit Date: 20190808
  7. Architecture: amd64
  8. Protocol Versions: [63]
  9. Network Id: 1
  10. Go Version: go1.10
  11. Operating System: linux
  12. GOPATH=/root/go
  13. GOROOT=/usr/local/go

4、同步以太坊区块

nohup geth --syncmode "fast" --port "30303" --cache=4096 --datadir /data/geth --rpc --rpcapi db,eth,net,web3,personal,admin,miner --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*"  --maxpeers 999  --maxpendpeers 999 > output.log 2>&1 &

5、进入geth控制台

geth attach ipc:/data/geth/geth.ipc

  

转载于:https://www.cnblogs.com/zhangmingcheng/p/11362306.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/608544
推荐阅读
相关标签
  

闽ICP备14008679号