swarm测试极简指南bzz节点部署 - 挖矿单机单节点,版本:0.5.3
Posted weixin_46596227
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swarm测试极简指南bzz节点部署 - 挖矿单机单节点,版本:0.5.3相关的知识,希望对你有一定的参考价值。
挖矿单机单节点的部署
参考配置
- CPU:4核
- 内存:8G
- 硬盘:100G
相关的文档及资源
- 官网文档:https://docs.ethswarm.org/docs/
- 钱包流水及查票地址:https://goerli.etherscan.io/
- 以太坊测试网的goerli接口的获取:https://infura.io/
- Swarm中文白皮书: https://chinapeace.github.io/pdf/latest.bookofswarm.eth.ZH_CN.pdf
- Swarm官网:https://swarm.ethereum.org/
- 节点分布地址:https://beenodes.live/
- 官方twitter地址:https://twitter.com/ethswarm
- 官方博客地址:https://medium.com/ethereum-swarm
设置端口防火墙
- 开放:1633
- 开放:1634
- 封禁:1635
相关的软件包
第一步:screen
GNU’s Screen 官方站点:http://www.gnu.org/software/screen/
命令行模式下的多窗口切换的软件,网上可以搜一下教程
第二步:安装clef
安装clef,这个是密钥通证:
wget https://github.com/ethersphere/bee-clef/releases/download/v0.4.9/bee-clef_0.4.9_amd64.deb
sudo dpkg -i bee-clef_0.4.9_amd64.deb
第三步:启动clef-service
创建一个screen 新窗口:
screen -S clef
启动clef-service服务软件:
git clone https://github.com/ethersphere/bee-clef
cd bee-clef
cd packaging
sudo ./bee-clef-service start
第四步:启动bee
创建一个screen 新窗口:
screen -S bee
安装bee:
wget https://github.com/ethersphere/bee/releases/download/v0.5.3/bee_0.5.3_amd64.deb
sudo dpkg -i bee_0.5.3_amd64.deb
第五步:获取本机节点的钱包地址
sudo bee-get-addr
第六步:启动矿机
sudo bee start --verbosity 5 --swap-endpoint https://rpc.slock.it/goerli --debug-api-enable --clef-signer-enable --clef-signer-endpoint /var/lib/bee-clef/clef.ipc
运营相关
支票操作脚本,保存文件名为:cashout.sh
#1/usr/bin/env sh
DEBUG_API=http://localhost:1635
MIN_AMOUNT=1000
function getPeers() {
curl -s "$DEBUG_API/chequebook/cheque" | jq -r '.lastcheques | .[].peer'
}
function getCumulativePayout() {
local peer=$1
local cumulativePayout=$(curl -s "$DEBUG_API/chequebook/cheque/$peer" | jq '.lastreceived.payout')
if [ $cumulativePayout == null ]
then
echo 0
else
echo $cumulativePayout
fi
}
function getLastCashedPayout() {
local peer=$1
local cashout=$(curl -s "$DEBUG_API/chequebook/cashout/$peer" | jq '.cumulativePayout')
if [ $cashout == null ]
then
echo 0
else
echo $cashout
fi
}
function getUncashedAmount() {
local peer=$1
local cumulativePayout=$(getCumulativePayout $peer)
if [ $cumulativePayout == 0 ]
then
echo 0
return
fi
cashedPayout=$(getLastCashedPayout $peer)
let uncashedAmount=$cumulativePayout-$cashedPayout
echo $uncashedAmount
}
function cashout() {
local peer=$1
txHash=$(curl -s -XPOST "$DEBUG_API/chequebook/cashout/$peer" | jq -r .transactionHash)
echo cashing out cheque for $peer in transaction $txHash >&2
result="$(curl -s $DEBUG_API/chequebook/cashout/$peer | jq .result)"
while [ "$result" == "null" ]
do
sleep 5
result=$(curl -s $DEBUG_API/chequebook/cashout/$peer | jq .result)
done
}
function cashoutAll() {
local minAmount=$1
for peer in $(getPeers)
do
local uncashedAmount=$(getUncashedAmount $peer)
if (( "$uncashedAmount" > $minAmount ))
then
echo "uncashed cheque for $peer ($uncashedAmount uncashed)" >&2
cashout $peer
fi
done
}
function listAllUncashed() {
for peer in $(getPeers)
do
local uncashedAmount=$(getUncashedAmount $peer)
if (( "$uncashedAmount" > 0 ))
then
echo $peer $uncashedAmount
fi
done
}
case $1 in
cashout)
cashout $2
;;
cashout-all)
cashoutAll $MIN_AMOUNT
;;
list-uncashed|*)
listAllUncashed
;;
esac
查询兑换支票(有返回就代表有可兑换支票)
sudo sh ./cashout.sh
兑换支票
sudo sh ./cashout.sh cashout-all 5
导出私钥到小狐狸钱包
bee-clef-keys
兑现支票时,发生 null 问题的解决办法:
https://hackmd.io/95rvXRswSh-xm9Td_Xl2cg?view
查看支票明细,包括废票:
curl http://localhost:1635/chequebook/cheque | jq
查看与本节点互相链接的节点:
curl -s http://localhost:1635/peers | jq '.peers | length'
curl -X GET http://localhost:1635/topology | jq
以上是关于swarm测试极简指南bzz节点部署 - 挖矿单机单节点,版本:0.5.3的主要内容,如果未能解决你的问题,请参考以下文章
swarm测试极简指南如何获得bzz奖励?0.6.2版本手动安装指南