Swarm
世纪大撸!

Swarm空投Bee节点安装及运行教程

推荐:全球第二大交易所OKEx欧意,邀请链接: https://www.ouyi.fit/join/1837888  能交易XCH,BZZ,BTC,ETH等等安全交易,新用户能开合约。

Bee节点是Swarm的一部分,运行Bee节点,就可以加入到Swarm全球网络中来了。因为Swarm是以太坊的“亲儿子”,以太坊基金会的项目,并且有空投奖励的缘故,目前测试网,全球已经有51000个节点了(截止2021年5月6日),说明全球广大区块链相关人员,对这个项目极其热情。
下面就是Bee节点的安装及运行教程,主要分两种方法,一种是用官方快速安装(官方程序已经集成了运行服务,可以直接运行服务),一种是docker安装。
  1. 前期准备:
首先准备一台云服务器,这里我选择的是于德国的16核cpu+32G内存+360G固态+20T流量的云服务器,系统为Ubuntu20.04,一个月费用为50欧元,网址如下:
https://console.hetzner.cloud/
img_url_201877_162149363055867
  1. 方法一、快速安装:
登录云服务器,并首先安装bee-clef(clef为以太坊的签名程序,因为bee程序需要频繁收支代币,所以官方做了一个bee版本的clef),再安装bee(顺序不能颠倒)
从官方GitHub网址获取bee及bee-clef的最新版本并下载到服务器中,网址如下:
https://github.com/ethersphere/bee/releases/
https://github.com/ethersphere/bee-clef/releases/
img_url_201877_162149363058557
img_url_201877_162149363057729
从图中可以看到,最新版本分别是bee-v0.5.3和bee-clef-v0.4.10,找到我们x86服务器对应的版本下载下来:
$ wget https://github.com/ethersphere/bee/releases/download/v0.5.3/bee_0.5.3_amd64.deb
$ wget https://github.com/ethersphere/bee-clef/releases/download/v0.4.10/bee-clef_0.4.10_amd64.deb
安装bee-clef-v0.4.10:
$ sudo dpkg -i bee-clef_0.4.10_amd64.deb
img_url_201877_162149363055814
运行bee-clef服务:
$ sudo systemctl start bee-clef.service
开机自动运行:
$ sudo systemctl enable bee-clef.service
查看bee-clef服务状态:
$ sudo systemctl status bee-clef.service
img_url_201877_162149363055841
查看日志:
$ journalctl –lines=100 –follow –unit bee-clef
img_url_201877_162149363057688
一切正常的话,接着安装bee:
$ sudo dpkg -i bee_0.5.3_amd64.deb
img_url_201877_162149363124169
确定节点的以太坊地址:
$ sudo bee-get-addr
img_url_201877_162149363125515
如图所示,我的这个bee节点的以太坊地址为
0x1348b564b72dda717d7b9fc702ccfdc677bb0f9e
然后把生成的这个节点的私钥和密码保存下来,运行如下命令:
$ sudo bee-clef-keys
img_url_201877_162149363131528
可以看到,节点的json文件及密码,已经保存下来了,这个要保存好,如果弄丢,节点是找不回来的!
可以运行sz命令,把这两个文件下载保存到本地桌面:
$ sz /root/bee-clef-key-1620288501.json
$ sz /root/bee-clef-password-1620288501.txt
下面登录Chrome浏览器的metamask插件(metamask插件怎么安装不再累述,自行百度),导入节点钱包:
首先点击右上角,我的账户中,点击导入账户:
img_url_201877_16214936312992
在导入账户中,选择json文件,导入刚刚保存在本地电脑中的节点json文件,并输入刚刚保存下来的密码:
img_url_201877_162149363137193
如图所示保存成功,可以更改一下名称:
img_url_201877_162149363143828
更改名称在此处:
img_url_201877_162149363198716
img_url_201877_162149363203614
领取测试币
A.可以去官方Discord的水龙头频道(#faucet-request)领取测试币,地址如下:
https://discord.gg/eKr9XPv7
输入
sprinkle 0x1348b564b72dda717d7b9fc702ccfdc677bb0f9e
机器人会给你打币
B.或者去网页领取测试币,地址如下:
https://bzz.ethswarm.org/
img_url_201877_162149363206172
点击连接钱包,连接上一步导入metamask的节点钱包。然后点击获取测试币。
C.还有一个网页可以领取测试币,地址如下:
https://faucet.ethswarm.org/
img_url_201877_162149363215480
运行节点
当你得到测试币以后,你就可以运行节点了,运行如下命令:
$ sudo systemctl start bee.service
开机自动运行:
$ sudo systemctl enable bee.service
查看节点服务是否正常,运行如下命令:
$ sudo systemctl status bee.service
img_url_201877_162149363217868
运行如下命令,查看bee节点运行日志:
$ journalctl –lines=100 –follow –unit bee
img_url_201877_162149363263525
日志看到开始连接peers了,一切正常。
运行如下命令,日志瘦身,使bee及bee-clef的日志都仅保留5天的:
$ sudo journalctl –vacuum-time=5days
收取支票,即赚取节点收益
bee节点正常运行以后,就可以坐等收取支票了,但是要注意,我们要理解bee的机制,bee的机制是别人往你的节点存东西,你会收到支票,别人从你的节点取东西(即你往别人的节点存东西),你会发送支票,所以swarm的挖矿机制很有意思,如果僧多粥少,很可能入不敷出。
从官方下载脚本并运行脚本,查看我节点的支票:
$ wget -O cashout.sh https://gist.githubusercontent.com/ralph-pichler/3b5ccd7a5c5cd0500e6428752b37e975/raw/b40510f1172b96c21d6d20558ca1e70d26d625c4/cashout.sh
$ chmod +x cashout.sh
$ ./cashout.sh
如图所示是我未兑换的支票:
img_url_201877_162149363275344
运行命令:
$ ./cashout.sh cashout-all 1
收取所有未兑换的支票。
可以查看以太坊浏览器,查看我们刚刚收取的支票。
登录https://goerli.etherscan.io/,输入我们的节点钱包地址,查看,如图所示:
img_url_201877_162149363281623
如此,快速安装步骤完成!

方法二:docker安装:

安装docker-ce
首先确保系统有没有安装docker及其附件,有的话自动卸载掉,命令如下:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
接着,安装docker官方索引包、添加docker的官方GPG密钥,从而从docker官方下载安装docker,命令如下:
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo \
“deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
通过运行hello-world映像来验证是否正确安装了docker-ce:
$ sudo docker run hello-world
结果如图所示,说明安装成功:
img_url_201877_162149363282949
通过docker安装bee,并设置密码
$ docker run \
-p 1635:1635 \
-p 1634:1634 \
-p 1633:1633 \
–rm -it ethersphere/bee:0.5.3 \
start \
–welcome-message=”Bzzzz bzzz bzz bzz. ” \
–swap-endpoint https://rpc.slock.it/goerli \
–debug-api-enable
如下图所示,设置bee节点密码:
img_url_201877_162149363285371
通过docker-compose快速安装多个bee节点及其bee-clef签名程序(1:1对应关系)
首先安装docker-compose
$ sudo apt-get update
$ sudo apt install docker-compose
然后下载官方的docker-compose.yaml配置文件
$ wget -q https://raw.githubusercontent.com/ethersphere/bee/v0.5.3/packaging/docker/docker-compose.yml
并修改docker-compose.yaml配置文件,如下所示,我搞了两个bee和两个bee-clef(一个bee和一个bee-clef,1:1对应),下图中红色文字是重点需要修改的地方:
version: “3”
services:
clef-1:
image: ethersphere/clef:0.4.9
restart: unless-stopped
environment:
– CLEF_CHAINID
volumes:
– clef-1:/app/data
command: full
clef-2:
image: ethersphere/clef:0.4.9
restart: unless-stopped
environment:
– CLEF_CHAINID
volumes:
– clef-2:/app/data
command: full
bee-1:
image: ethersphere/bee:beta
restart: unless-stopped
environment:
– BEE_API_ADDR
– BEE_BOOTNODE
– BEE_BOOTNODE_MODE
– BEE_CLEF_SIGNER_ENABLE
– BEE_CLEF_SIGNER_ENDPOINT=http://clef-1:8550
– BEE_CONFIG
– BEE_CORS_ALLOWED_ORIGINS
– BEE_DATA_DIR
– BEE_DB_CAPACITY
– BEE_DB_OPEN_FILES_LIMIT
– BEE_DB_BLOCK_CACHE_CAPACITY
– BEE_DB_WRITE_BUFFER_SIZE
– BEE_DB_DISABLE_SEEKS_COMPACTION
– BEE_DEBUG_API_ADDR
– BEE_DEBUG_API_ENABLE
– BEE_GATEWAY_MODE
– BEE_GLOBAL_PINNING_ENABLE
– BEE_NAT_ADDR
– BEE_NETWORK_ID
– BEE_P2P_ADDR
– BEE_P2P_QUIC_ENABLE
– BEE_P2P_WS_ENABLE
– BEE_PASSWORD
– BEE_PASSWORD_FILE
– BEE_PAYMENT_EARLY
– BEE_PAYMENT_THRESHOLD
– BEE_PAYMENT_TOLERANCE
– BEE_RESOLVER_OPTIONS
– BEE_STANDALONE
– BEE_SWAP_ENABLE
– BEE_SWAP_ENDPOINT
– BEE_SWAP_FACTORY_ADDRESS
– BEE_SWAP_INITIAL_DEPOSIT
– BEE_TRACING_ENABLE
– BEE_TRACING_ENDPOINT
– BEE_TRACING_SERVICE_NAME
– BEE_VERBOSITY
– BEE_WELCOME_MESSAGE
ports:
– “${API_ADDR:-1633}${BEE_API_ADDR:-:1633}”
– “${P2P_ADDR:-1634}${BEE_P2P_ADDR:-:1634}”
– “${DEBUG_API_ADDR:-127.0.0.1:1635}${BEE_DEBUG_API_ADDR:-:1635}”
volumes:
– bee-1:/home/bee/.bee
command: start
depends_on:
– clef-1
bee-2:
image: ethersphere/bee:beta
restart: unless-stopped
environment:
– BEE_API_ADDR
– BEE_BOOTNODE
– BEE_BOOTNODE_MODE
– BEE_CLEF_SIGNER_ENABLE
– BEE_CLEF_SIGNER_ENDPOINT=http://clef-2:8550
– BEE_CONFIG
– BEE_CORS_ALLOWED_ORIGINS
– BEE_DATA_DIR
– BEE_DB_CAPACITY
– BEE_DB_OPEN_FILES_LIMIT
– BEE_DB_BLOCK_CACHE_CAPACITY
– BEE_DB_WRITE_BUFFER_SIZE
– BEE_DB_DISABLE_SEEKS_COMPACTION
– BEE_DEBUG_API_ADDR
– BEE_DEBUG_API_ENABLE
– BEE_GATEWAY_MODE
– BEE_GLOBAL_PINNING_ENABLE
– BEE_NAT_ADDR
– BEE_NETWORK_ID
– BEE_P2P_ADDR
– BEE_P2P_QUIC_ENABLE
– BEE_P2P_WS_ENABLE
– BEE_PASSWORD
– BEE_PASSWORD_FILE
– BEE_PAYMENT_EARLY
– BEE_PAYMENT_THRESHOLD
– BEE_PAYMENT_TOLERANCE
– BEE_RESOLVER_OPTIONS
– BEE_STANDALONE
– BEE_SWAP_ENABLE
– BEE_SWAP_ENDPOINT
– BEE_SWAP_FACTORY_ADDRESS
– BEE_SWAP_INITIAL_DEPOSIT
– BEE_TRACING_ENABLE
– BEE_TRACING_ENDPOINT
– BEE_TRACING_SERVICE_NAME
– BEE_VERBOSITY
– BEE_WELCOME_MESSAGE
ports:
– “${API_ADDR:-11633}${BEE_API_ADDR:-:1633}”
– “${P2P_ADDR:-11634}${BEE_P2P_ADDR:-:1634}”
– “${DEBUG_API_ADDR:-127.0.0.1:11635}${BEE_DEBUG_API_ADDR:-:1635}”
volumes:
– bee-2:/home/bee/.bee
command: start
depends_on:
– clef-2
volumes:
clef-1:
clef-2:
bee-1:
bee-2:
上图中以此类推可以搞N个节点。
再下载官方docker环境变量文件:
$ wget -q https://raw.githubusercontent.com/ethersphere/bee/v0.5.3/packaging/docker/env -O .env
修改环境变量文件,如下所示,下图中红色文字是重点需要修改的地方,其中“BEE_PASSWORD=”,改成上一步设置的密码:
# Copy this file to .env, then update it with your own settings
### CLEF
## chain id to use for signing (1=mainnet, 3=ropsten, 4=rinkeby, 5=goerli) (default: 12345)
CLEF_CHAINID=5
### BEE
## HTTP API listen address (default :1633)
# BEE_API_ADDR=:1633
## initial nodes to connect to (default [/dnsaddr/bootnode.ethswarm.org])
# BEE_BOOTNODE=[/dnsaddr/bootnode.ethswarm.org]
## cause the node to always accept incoming connections
# BEE_BOOTNODE_MODE=false
## enable clef signer
BEE_CLEF_SIGNER_ENABLE=true
## clef signer endpoint
# BEE_CLEF_SIGNER_ENDPOINT=
## config file (default is /home/<user>/.bee.yaml)
# BEE_CONFIG=/home/bee/.bee.yaml
## origins with CORS headers enabled
# BEE_CORS_ALLOWED_ORIGINS=[]
## data directory (default /home/<user>/.bee)
# BEE_DATA_DIR=/home/bee/.bee
## db capacity in chunks, multiply by 4096 to get approximate capacity in bytes
# BEE_DB_CAPACITY=5000000
## number of open files allowed by database
# BEE_DB_OPEN_FILES_LIMIT=200
## size of block cache of the database in bytes
# BEE_DB_BLOCK_CACHE_CAPACITY=33554432
## size of the database write buffer in bytes
# BEE_DB_WRITE_BUFFER_SIZE=33554432
## disables db compactions triggered by seeks
# BEE_DB_DISABLE_SEEKS_COMPACTION=false
## debug HTTP API listen address (default :1635)
# BEE_DEBUG_API_ADDR=:1635
## enable debug HTTP API
# BEE_DEBUG_API_ENABLE=false
## disable a set of sensitive features in the api
# BEE_GATEWAY_MODE=false
## enable global pinning
# BEE_GLOBAL_PINNING_ENABLE=false
## NAT exposed address
# BEE_NAT_ADDR=
## ID of the Swarm network (default 1)
# BEE_NETWORK_ID=1
## P2P listen address (default :1634)
# BEE_P2P_ADDR=:1634
## enable P2P QUIC protocol
# BEE_P2P_QUIC_ENABLE=false
## enable P2P WebSocket transport
# BEE_P2P_WS_ENABLE=false
## password for decrypting keys
BEE_PASSWORD=yourpassword
## path to a file that contains password for decrypting keys
# BEE_PASSWORD_FILE=
## amount in BZZ below the peers payment threshold when we initiate settlement (default 10000)
# BEE_PAYMENT_EARLY=10000
## threshold in BZZ where you expect to get paid from your peers (default 100000)
# BEE_PAYMENT_THRESHOLD=100000
## excess debt above payment threshold in BZZ where you disconnect from your peer (default 10000)
# BEE_PAYMENT_TOLERANCE=10000
## ENS compatible API endpoint for a TLD and with contract address, can be repeated, format [tld:][contract-addr@]url
# BEE_RESOLVER_OPTIONS=[]
## whether we want the node to start with no listen addresses for p2p
# BEE_STANDALONE=false
## enable swap (default true)
# BEE_SWAP_ENABLE=true
## swap ethereum blockchain endpoint (default http://localhost:8545)
BEE_SWAP_ENDPOINT=https://rpc.slock.it/goerli
## swap factory address
# BEE_SWAP_FACTORY_ADDRESS=
## initial deposit if deploying a new chequebook (default 100000000)
# BEE_SWAP_INITIAL_DEPOSIT=100000000
## enable tracing
# BEE_TRACING_ENABLE=false
## endpoint to send tracing data (default 127.0.0.1:6831)
# BEE_TRACING_ENDPOINT=127.0.0.1:6831
## service name identifier for tracing (default bee)
# BEE_TRACING_SERVICE_NAME=bee
## log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace (default info)
# BEE_VERBOSITY=info
## send a welcome message string during handshakes
# BEE_WELCOME_MESSAGE=
配置完docker-compose.yaml及.env配置文件,运行如下命令,后台运行bee节点:
$ docker-compose up –d
运行如下命令查看日志,从而掌握节点运行情况
$ docker-compose logs -f –tail=50 bee-1
$ docker-compose logs -f –tail=50 bee-2
img_url_201877_162149363299312
后面就跟前面一样了,把节点的钱包秘钥秘钥及密码备份好,去官方水龙头领币,及定期查看节点运行情况、定期兑换支票。

推荐:全球第二大交易所OKEx欧意,邀请链接: https://www.ouyi.fit/join/1837888  能交易XCH,BZZ,BTC,ETH等等安全交易,新用户能开合约。

赞(0) 打赏
未经允许不得转载:Swarm之家 » Swarm空投Bee节点安装及运行教程

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

国内服务器VPS云主机

进去看看!优惠码

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏