16

HECO 火币生态链RPC节点部署搭建说明-mainnet(开发用,非挖矿)

 2 years ago
source link: http://www.blogjava.net/fangw/archive/2021/11/14/436046.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

HECO 火币生态链RPC节点部署搭建说明-mainnet(开发用,非挖矿)

方伟的博客 j2ee技术、网络、web等,同名的人真多,我的QQ是20025404

posts - 20,comments - 14,trackbacks - 0

 1.服务器

需要300G SSD(建议NVMe)硬盘,最好是裸硬盘,不建议用机械盘。

建议国外服务器,10M以上,不需要cn2线路

3.操作系统

建议centos7/8,或ubuntu,这里均以centos为例

4.准备环境:

yum update -y

yum install screen iftop iotop -y

4.1.安装golang

yum install golang -y

或编译安装

*注意:如果使用的 Go 版本是 1.13 及以上 (推荐),如果不设置以下命令编译源码时可能会出错
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct

5.创建一个screen

screen -S heco

*注意1:最后退出时用ctrl+ad(顺序按a和d字母即可),不要用exit或ctrl+d退出会话。

*注意2:退出会话后,可以用screen -x heco重新连接到会话。

6.安装heco客户端

#这里我的数据目录,可以根据需要自行更改

mkdir -p /data/heco/data

#下载最新版本并编译

cd /root
wget -O heco-chain-1.2.1.tar.gz https://github.com/stars-labs/heco-chain/archive/refs/tags/v1.2.1.tar.gz
tar -xvf heco-chain-1.2.1.tar.gz
rm -fr heco-chain-1.2.1.tar.gz
cd heco-chain-1.2.1
make all


7.检查安装是否成功

/root/heco-chain-1.2.1/build/bin/geth  console

8.设置防火墙
firewall-cmd --permanent --zone=public --add-port=32668/tcp
firewall-cmd --permanent --zone=public --add-port=8545/tcp
firewall-cmd --reload
不懂防火墙配置的,可以先禁用防火墙,关于firewalld的使用技巧,之后会单独写一篇教程

9.启动节点

ulimit -n 65535

/root/heco-chain-1.2.1/build/bin/geth --datadir /data/heco/data --syncmode "fast" --cache=8096 --maxpeers 50 --http --http.addr=0.0.0.0 --http.port=8545 --http.api "web3,debug,personal,net,admin,eth" --http.corsdomain "*" --allow-insecure-unlock

*然后按ctrl+ad回到主会话即可

10.测试验证

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://127.0.0.1:8545

(如果已经追上最新高度,result会返回false)

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://127.0.0.1:8545

(节点未同步完成可能会返回0)

11.停止节点

方式1:(建议,毕竟停止后还要启动不是)

screen -r heco

按ctrl+c,等待一会即可看到节点停止

12.接口文档参考(HECO的文档与以太坊基本相同)

RPC接口文档,如:

以太坊JSON RPC手册 / eth_call - 汇智网

其它参考:

HECO链github地址:GitHub - stars-labs/heco-chain: Huobi Eco Chain client based on the go-ethereum fork

主网浏览器:HecoInfo (HT) Blockchain Explorer

13.注意事项

*同步到最高区块所需时间:

需要看网络带宽和磁盘io性能,用NVMe的硬盘,读写1000到2000左右,100M的国外非cn2带宽,从0开始同步,大概需要小半天左右。

*如果2天还没有追上,或者最后100个块始终追不上,极有可能是服务器磁盘io存在瓶颈,不建议用机械盘,不建议用虚拟机(磁盘不建议做虚拟化),否则io速度不够用。

*硬盘目前实际会占用211G左右。

*相比eth,bsc,heco的资源消耗和空间占用非常低,一般可以与eth节点部署在同一台,以节省成本。

posted on 2021-11-14 23:37 方伟的博客 阅读(4) 评论(0)  编辑  收藏 所属分类: 区块链

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK