bee swarm 已成功部署主网,本文介绍如何在主网启动 bee 节点。
环境准备
- ubuntu 20.02.
- 2 核 4 G 55G 系统盘
单机器单节点部署
目前 bee 1.0.0 启动 bee-clef (密钥管理工具) 会导致 bee 节点无法启动,所以目前只需要启动 bee,可以通过 exportSwarmKey 导出私钥
安装 bee
1 | wget https://github.com/ethersphere/bee-clef/releases/download/v0.4.13/bee-clef_0.4.13_amd64.deb |
修改配置文件
配置文件默认地址为 /etc/bee/bee.yml
,修改以下字段:
1 | ## Bee configuration - https://gateway.ethswarm.org/bzz/docs.swarm.eth/docs/installation/configuration/ |
修改完成后执行 systemctl restart bee
启动节点
journalctl --lines=100 --follow --unit bee
获取节点 xDai chain 地址- 充值 0.01 XDAI
curl localhost:1635/health
查看节点是否启动成功
导出节点私钥
因为bee-1.0.0 没有部署 bee-clef, 所以如果需要导出私钥,可以使用官方建议的工具exportSwarmKey 导出私钥进行备份。
- 服务器环境需要安装
golang git
git clone https://github.com/ethersphere/exportSwarmKey.git
- 开启国内 go package 代理,
go env -w GOPROXY=https://goproxy.cn,direct
- 导出私钥,
go run pkg/main.go /var/lib/bee/keys/ {bee 节点密码,默认地址为 /var/lib/bee/password}
- 找到对应节点启动地址私钥,通过 Metamask 等以太坊钱包导入
如何自建 xDai Chain 节点
考虑到节点的稳定性,自建 xDai Rpc 是最好的选择
- 安装依赖环境,
apt-get install build-essential cmake libudev-dev
- 下载安装包
wget https://github.com/openethereum/openethereum/releases/download/v3.2.5/openethereum-linux-v3.2.5.zip
- 解压安装包
unzip openethereum-linux-v3.2.5.zip
- 添加执行权限,
chmod u+x openethereum && mv openethereum /usr/bin
- 启动节点
1
nohup openethereum --chain=xdai --base-path=/root/gethnode/xdai --db-path=/root/gethnode/xdai/db --jsonrpc-hosts=all --jsonrpc-interface=all --jsonrpc-threads=8> /root/log.log 2>&1 &
- 同步完成替换
/etc/bee/bee.yml
swap-endpoint 字段为http://localhost:8545