Running a Bee Node on a Raspberry Pi
A Step-by-step Guide on Installing and Running a Bee Node on a Raspberry Pi
Bee is a Swarm client implemented in Go. It’s the basic building block for the Swarm network. To understand the motivation behind Swarm, visit swarm.ethereum.org.
The following guide demonstrates the instructions on running a Bee node on a Raspberry Pi. Please refer to the original Swarm Bee documentation for more information and instructions on running a Bee node on a different OS.
Hardware requirements:
- At least 1 GB RAM
- 64 GB microSD
- Stable internet connection
Software (at the time of writing):
- Bee v0.5.3
- Bee-clef v0.4.9
Step 1. Install Raspberry Pi OS
- Download Raspberry Pi OS image here. Choose Raspberry Pi OS with desktop if you require desktop utilities. Choose Raspberry Pi OS Lite if you prefer a headless installation without desktop utilities.
- Flash OS onto a microSD card with Etcher.
- Attach peripheries to your Raspberry Pi. Insert flashed microSD card and turn on the power.
- Follow on-screen instructions to complete OS installation and updates.
- Raspberry Pi’s default user = “pi” and default password = “raspberry”. Change the default password and disable auto login as pi.
- To add new user (optional):
sudo adduser username
- Add user to sudoers list:
sudo usermod -aG sudo username
Step 2. Download and install Bee-clef
Bee-clef is an external service that signs transactions for Bee’s automated processes. Check for new releases here. Install the latest stable version; your version number may vary.
Download Bee-clef
wget https://github.com/ethersphere/bee-clef/releases/download/v0.4.9/bee-clef_0.4.9_armv7.deb
Install with dpkg
sudo dpkg -i bee-clef_0.4.9_armv7.deb
Check Bee-clef status
systemctl status bee-clef
To follow Bee-clef logs
journalctl -f -u bee-clef.service
You may require sudo permission to run this.
Step 3. Download and install Bee
Check for new releases here. Install the latest stable version; your version number may vary.
Download Bee
wget https://github.com/ethersphere/bee/releases/download/v0.5.3/bee_0.5.3_armv7.deb
Install with dpkg
sudo dpkg -i bee_0.5.3_armv7.deb
Check Bee status
systemctl status bee
To follow Bee logs
journalctl -f -u bee.service
You may require sudo permission to run this.
Permission error (optional)
If you encounter permission error (read from Bee logs) when running your Bee node, try the following:
sudo chown -R bee:bee /var/lib/bee
sudo systemctl start bee
Step 4. Fund your Bee node
A SWAP enabled Bee node requires both gETH and gBZZ to begin operation. The current version of Swarm incentives is running on the Ethereum Goerli testnet. To acquire free gBZZ tokens from the Bzzaar, follow the steps below.
Create / Unlock your wallet
Use a MetaMask or Portis wallet.
Get some gETH
Request for some gETH from a goerli testnet faucet.
Find your Bee node’s Ethereum address
sudo bee-get-addr
Visit the Bzzaar
Navigate to the link shown in your logs: https://bzz.ethswarm.org/?transaction=buy&amount=10&slippage=30&receiver=0xbee467355...
Your Bee node’s Ethereum address should match the receiver’s address.
Connect your wallet
Once connected, you should be able to see your gETH balance.
Buy some gBZZ
Enter at least 10 in the gBZZ field. Exchange gETH for gBZZ. When the transaction is complete, your Bee node should be funded with gBZZ.
Fund your node with gETH
Transfer the rest of the gETH from your wallet to your Bee node.
Check Bee status
Your Bee node should now begin deploying your chequebook contract.
Restart your Bee node (optional)
If your node has stopped polling for updates, you may need to restart it. Run sudo sytemctl start bee
Step 5. Important endpoints
The API-endpoint exposes all functionality to upload and download content to and from the Swarm network. By default, it runs on port :1633
. Detailed information about Bee API endpoint can be found here. The Debug API runs on port :1635
by default.
Check connectivity (peers)
curl -s http://localhost:1635/peers | jq ‘.peers | length’
Check balances
- Node’s current balance:
curl http://localhost:1635/chequebook/balance | jq
- Balances with peers:
curl http://localhost:1635/balances | jq
Cash out checks manually
curl -XPOST http://localhost:1635/chequebook/cashout/{peer_id}
Cashout script
- Download script:
wget -O cashout.sh https://gist.githubusercontent.com/ralph-pichler/3b5ccd7a5c5cd0500e6428752b37e975/raw/7ba05095e0836735f4a648aefe52c584e18e065f/cashout.sh
- Make the file executable:
chmod +x cashout.sh
- List uncashed checks:
./cashout.sh
- Cash out all checks worth more than 5 gBZZ (run this every few days):
./cashout.sh cashout-all 5
Withdraw gBZZ from the chequebook contract back into your node’s wallet
curl -XPOST http://localhost:1635/chequebook/withdraw\?amount\=1000 | jq
Deposit extra gBZZ into the chequebook contract
curl -XPOST http://localhost:1635/chequebook/deposit\?amount\=1000 | jq
Step 6. Join the hive
At the time of writing, the Swarm network consists of over 37,000 nodes. Your node will now contribute to this global effort in decentralizing the internet. Give us a shout out on Twitter @ontime_oto when you get your Bee node running.
This concludes the guide on installing and running a Bee node on a Raspberry Pi.
Visit ontimefoundation.org for more information.