以太坊geth安装并同步主网及测试网区块

以太坊geth客户端安装配置过程,节点启动参数,同步主网及测试网区块。

更多区块链技术与应用分类:

区块链应用    区块链开发

以太坊 | Fabric | BCOS | 密码技术 | 共识算法 | 比特币其他链

通证经济传统金融场景 | 去中心化金融 | 防伪溯源 | 数据共享 | 可信存证

同步主网

代码下载

git clone https://github.com/ethereum/go-ethereum.git

编译

make geth

ethereum/go-ethereum/build/bin目录下生成二进制文件

执行文件放系统目录

sudo ln -s /gopath/src/github.com/ethereum/go-ethereum/build/bin/geth /usr/local/bin/
 
sudo cp /gopath/src/github.com/ethereum/go-ethereum/build/bin/geth /usr/local/bin/

同步主网区块

sudo nohup geth --datadir /data/ethereum_mainNetwork_data --syncmode "fast" --rpc --rpcaddr 0.0.0.0 --rpcport 7545 --rpccorsdomain "*" --rpcapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique --ws --wsaddr 0.0.0.0 --wsorigins "*" --wsapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique > /data/ethereum_mainNetwork_data/ethRunning.log &

连接geth

可通过另一个终端查看

sudo geth attach /data/ethereum_mainNetwork_data/geth.ipc

同步测试网

若要同步测试网数据(ropsten或rinkeby)

先清除

geth --nousb --testnet removedb --datadir /home/user_dev/ethereum/ethereum_ropstenNetwork_data

数据目录设置

mkdir ethereum_rinkebyNetwork_data
 
mkdir ethereum_ropstenNetwork_data
 
sudo chown user_dev ethereum_rinkebyNetwork_data
 
sudo chgrp user_dev ethereum_rinkebyNetwork_data
 
sudo chown user_dev ethereum_ropstenNetwork_data
 
sudo chgrp user_dev ethereum_ropstenNetwork_data

同步rinkeby测试网

sudo nohup geth-rinkeby --datadir /data/ethereum_rinkebyNetwork_data --rinkeby --syncmode "fast" --rpc --port 30313 --rpcaddr 0.0.0.0 --rpcport 18545 --rpccorsdomain "*" --rpcapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique --ws --wsaddr 0.0.0.0 --wsport 18546 --wsorigins "*" --wsapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique --nousb > /data/ethereum_rinkebyNetwork_data/ethRunning.log &

同步ropsten测试网

sudo nohup geth-ropsten --datadir /data/ethereum_ropstenNetwork_data --testnet --syncmode "fast" --rpc --port 30323 --rpcaddr 0.0.0.0 --rpcport 28545 --rpccorsdomain "*" --rpcapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique --ws --wsaddr 0.0.0.0 --wsport 28546 --wsorigins "*" --wsapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique --nousb > /data/ethereum_ropstenNetwork_data/ethRunning.log &

备注

在home目录下,同步ropsten测试网

nohup geth --datadir /home/user_dev/ethereum/ethereum_ropstenNetwork_data --testnet --syncmode "fast" --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --rpccorsdomain "*" --rpcapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique --ws --wsaddr 0.0.0.0 --wsorigins "*" --wsapi web3,personal,admin,db,net,eth,miner,rpc,txpool,clique --nousb > /home/user_dev/ethereum/ethereum_ropstenNetwork_data/ethRunning.log &

另一个终端查看

sudo geth attach /data/ethereum_mainNetwork_data/geth.ipc

geth运行日志查看

tail -f ethRunning.log

原文链接:以太坊geth安装并同步主网及测试网区块 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值