# How to run a Bee node in ultra-light, light and full modes Bee is a versatile software that caters to a diverse range of use cases. It offers three primary modes of operation - ultra-light, light, and full - each tailored to specific user needs and preferences. In this tutorial, we will guide you through installing, configuring, and running Bee node in each of these modes. By the end of this tutorial, you will be able to set up Bee node to best suit your requirements and join the Swarm network. Let's get started! ## Prerequisites for this guide - a machine running Ubuntu / Debian / any Linux based distribution - latest `node` and `npm` - The following ports must be free and available - **1633** - **1634** - **1635** - **8080** ## Bee Install ### 1. Install Bee using the shell script ``` wget -q -O - https://raw.githubusercontent.com/ethersphere/bee/master/install.sh | bash ``` ``` Preparing to install bee into /usr/local/bin bee installed into /usr/local/bin/bee Run 'bee --help' to see what you can do with it. ``` ### 2. Verify your Bee installation ``` bee version ``` ``` x.xx.x-8e269c88 ``` ## Bee Node Setup ### 3: Create a project directory ``` mkdir bee-node-test cd bee-node-test ``` ### 3: Create a data directory for Bee This directory will be used by Bee to store keys and all other data ```shell mkdir bee-data-dir ``` ### 4. Create a password file Generate a random string and save it to a password file. ``` openssl rand -base64 24 > ./bee-data-dir/password ``` This will be used as the password for Bee. Keep a copy of this password somewhere safe. It will be required for importing / exporting wallets (into Metamask for instance) ## 5. Ultra-Light Mode Ultra light mode is meant for users who want to try out running a node but don't want to go through the hassle of blockchain onboarding. Ultra-light nodes will be able to download data as long as the data consumed does not exceed the payment threshold (payment-threshold in configuration) set by the peers they connect to. ### Running Bee in ultra-light mode Open a terminal and run: ``` bee start \ --verbosity 5 \ --data-dir ./bee-data-dir \ --password-file ./bee-data-dir/password \ --debug-api-enable=true \ --swap-enable=false \ --full-node=false ``` This will spin up a Bee node in ultra light mode and generate 3 key files in the `bee-data-dir/keys` folder to be used by the Bee node. ``` . └── bee-data-dir ├── keys │   ├── libp2p_v2.key (private key used to secure the p2p communication between nodes) │   ├── pss.key (private key for signing messages) │   └── swarm.key (private key for funding wallet) ``` ### Install Swarm CLI Open a new terminal and run: ``` npm install --global @ethersphere/swarm-cli ``` ### Check Bee node status ``` swarm-cli status ``` ``` Bee Status ------------------------------------------------------------------------------------------------------------------------ Bee API URL: http://localhost:1633 Bee Debug API URL: http://localhost:1635 ------------------------------------------------------------------------------------------------------------------------ [OK] Bee API Connection [OK] Bee Debug API Connection [FAILED] Bee Version Compatibility Bee Version: 1.16.1-8e269c88 Tested with: 1.13.0 (1.13.0-f1067884) ------------------------------------------------------------------------------------------------------------------------ Gateway Mode: undefined Bee Mode: ultra-light ======================================================================================================================== Topology ------------------------------------------------------------------------------------------------------------------------ Connected Peers: 148 Population: 3489 Depth: 9 ``` Our Bee node is running in ultra-light mode as seen in `Bee Mode: ultra-light` ## 6. Light Mode A bee node running in light mode may be thought of as simply not participating in the activity of forwarding or storing chunks for other members of the swarm, these nodes are strictly consumers, who will pay xBZZ in return for services rendered by full nodes - those contributing towards moving data around the network. ### Running a Bee node in light node Open the terminal where Bee is running and press `CTRL+C` to stop the Bee node. Light nodes and full nodes require a blockchain RPC enpoint to interact with the Gnosis blockchain. The best option to run your own Gnosis node for the sake of decentralization. Alternatively you may use any of the endpoints from the [RPC providers](https://docs.gnosischain.com/tools/rpc/) listed on the Gnosis website. ``` bee start \ --verbosity 5 \ --data-dir ./bee-data-dir \ --password-file ./bee-data-dir/password \ --debug-api-enable=true \ --swap-enable=true \ --blockchain-rpc-endpoint https://rpc.gnosis.gateway.fm \ --full-node=false ``` The Bee node should fire up and pause momentarily with a log message requesting atleast `min_xdai_amount` in `xDAI` to be sent to the wallet `address` on the [Gnosis](https://www.gnosis.io/) Chain. This will be used to pay gas fees when the node's chequebook is deployed on the blockchain. ``` "time"="2023-05-25 00:54:22.443084" "level"="warning" "logger"="node/chequebook" "msg"="cannot continue until there is at least min xDAI (for Gas) available on address" "min_xdai_amount"="0.00081" "address"="0x9d87aB29da51D7910E07572E6809E6Bfc4B0d94C" ``` Once the wallet has been funded with the minimum funds, Bee will proceed to sync with the Swarm network. ### Check Bee node status ``` swarm-cli status ``` ``` Bee Status ------------------------------------------------------------------------------------------------------------------------ Bee API URL: http://localhost:1633 Bee Debug API URL: http://localhost:1635 ------------------------------------------------------------------------------------------------------------------------ [OK] Bee API Connection [OK] Bee Debug API Connection [FAILED] Bee Version Compatibility Bee Version: 1.16.1-8e269c88 Tested with: 1.13.0 (1.13.0-f1067884) ------------------------------------------------------------------------------------------------------------------------ Gateway Mode: undefined Bee Mode: light ======================================================================================================================== Topology ------------------------------------------------------------------------------------------------------------------------ Connected Peers: 150 Population: 3703 Depth: 9 ``` Our Bee node is running in light mode as seen in `Bee Mode: light` ## 6. Full-Node Mode ### Running a Bee full node Open the terminal where bee is running and press `CTRL+C` to stop the Bee node. Run the following to start Bee in full-node mode ``` bee start \ --verbosity 5 \ --data-dir ./bee-data-dir \ --password-file ./bee-data-dir/password \ --debug-api-enable=true \ --swap-enable=true \ --blockchain-rpc-endpoint https://rpc.gnosis.gateway.fm --full-node=true \ ``` ### Check Bee node status ``` swarm-cli status ``` ``` Bee Status ------------------------------------------------------------------------------------------------------------------------ Bee API URL: http://localhost:1633 Bee Debug API URL: http://localhost:1635 ------------------------------------------------------------------------------------------------------------------------ [OK] Bee API Connection [OK] Bee Debug API Connection [FAILED] Bee Version Compatibility Bee Version: 1.16.1-8e269c88 Tested with: 1.13.0 (1.13.0-f1067884) ------------------------------------------------------------------------------------------------------------------------ Gateway Mode: undefined Bee Mode: full ======================================================================================================================== Topology ------------------------------------------------------------------------------------------------------------------------ Connected Peers: 150 Population: 3945 Depth: 9 ``` Our Bee node is now running in full mode as seen in `Bee Mode: full`. Congratulations! You have successfully set up and started your Bee node in full mode. Now you can explore and interact with your Bee node by checking out these additional resources. ## Additional Resources - [Uploading and Downloading Data on Swarm](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download) - [Host your website on Swarm](https://docs.ethswarm.org/docs/access-the-swarm/host-your-website) - [Interacting with your Bee node using Swarm CLI](https://github.com/ethersphere/swarm-cli/blob/master/README.md) - [Staking BZZ with your Bee node](https://docs.ethswarm.org/docs/working-with-bee/staking) - [Light Nodes](https://docs.ethswarm.org/docs/access-the-swarm/light-nodes) - [Ultra Light Nodes](https://docs.ethswarm.org/docs/access-the-swarm/ultra-light-nodes)