无名商贸网 网站首页 资讯列表 资讯内容

bzz一机多节点部署方案|一步轻松搭建多节点bzz bzz节点安装教学

2021-06-23| 发布者: 无名商贸网| 查看: 144| 评论: 3|来源:互联网

摘要: 单节点的部署参考配置相关的文档及资源设置端口防火墙相关的软件包第一步:screen第二步:安装clef第三步:启...

单节点的部署


        参考配置
        相关的文档及资源
        设置端口防火墙
        相关的软件包
            第一步:screen
            第二步:安装clef
            第三步:启动clef-service
            第四步:启动bee
            第五步:获取本机节点的钱包地址
            第六步:启动矿机
        运营相关
            支票操作脚本,保存文件名为:cashout.sh
                查询兑换支票(有返回就代表有可兑换支票)
                兑换支票
                导出私钥到小狐狸钱包
                兑现支票时,发生 null 问题的解决办法:
            查看支票明细,包括废票:
            查看与本节点互相链接的节点:

参考配置

    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

    1
    2

第三步:启动clef-service

创建一个screen 新窗口:

screen -S clef

    1

启动clef-service服务软件:

git clone https://github.com/ethersphere/bee-clef
cd bee-clef
cd packaging
sudo ./bee-clef-service start

    1
    2
    3
    4

第四步:启动bee

创建一个screen 新窗口:

screen -S bee

    1

安装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

    1
    2

第五步:获取本机节点的钱包地址

sudo bee-get-addr

    1

第六步:启动矿机

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

    1

运营相关
支票操作脚本,保存文件名为: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

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93

查询兑换支票(有返回就代表有可兑换支票)

sudo sh ./cashout.sh

    1

兑换支票

sudo sh ./cashout.sh cashout-all 5

    1

导出私钥到小狐狸钱包

bee-clef-keys

    1

兑现支票时,发生 null 问题的解决办法:

https://hackmd.io/95rvXRswSh-xm9Td_Xl2cg?view

    1

查看支票明细,包括废票:

curl http://localhost:1635/chequebook/cheque | jq

    1

查看与本节点互相链接的节点:

curl -s http://localhost:1635/peers | jq '.peers | length'

curl -X GET http://localhost:1635/topology | jq




分享至:
| 收藏
收藏 分享 邀请

最新评论(0)

Archiver|手机版|小黑屋|无名商贸网  

GMT+8, 2019-1-6 20:25 , Processed in 0.100947 second(s), 11 queries .

Powered by 无名商贸网 X1.0

© 2015-2020 无名商贸网 版权所有

微信扫一扫