Skip to content

Drosera Network Setup with Docker

This guide walks you through setting up a Drosera testnet with Docker. It covers the following steps:

  1. Installing Dependencies
  2. Setting up a Vulnerable Contract
  3. Deploying a Trap on the Testnet
  4. Connecting an Operator to the Trap

  • 2 CPU Cores
  • 4 GB RAM
  • 20 GB Disk Space

You can get started with a low-budget VPS for as low as $5! Purchase here.

You will also need to create your own Ethereum Holesky RPC in Alchemy or QuickNode.


1. Install Dependencies

First, update and install necessary dependencies:

bash
sudo apt-get update && sudo apt-get upgrade -y
sudo apt install curl ufw iptables build-essential git wget lz4 jq make gcc nano automake autoconf tmux htop nvme-cli libgbm1 pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y

Then, install Docker:

bash
sudo apt update -y && sudo apt upgrade -y
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu   $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |   sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update -y && sudo apt upgrade -y
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify Docker installation:

bash
sudo docker run hello-world

2. Configure Environment

Install Drosera CLI:

bash
curl -L https://app.drosera.io/install | bash
source /root/.bashrc
droseraup

Install Foundry CLI:

bash
curl -L https://foundry.paradigm.xyz | bash
source /root/.bashrc
foundryup

Install Bun:

bash
curl -fsSL https://bun.sh/install | bash
source /root/.bashrc

3. Deploy Contract & Trap

Create a new directory for the trap:

bash
mkdir my-drosera-trap
cd my-drosera-trap

Set your GitHub email and username:

bash
git config --global user.email "Github_Email"
git config --global user.name "Github_Username"

Initialize the Trap:

bash
forge init -t drosera-network/trap-foundry-template

Compile the Trap:

bash
curl -fsSL https://bun.sh/install | bash
source /root/.bashrc
bun install
forge build

Deploy the Trap:

bash
DROSERA_PRIVATE_KEY=xxx drosera apply

Replace xxx with your EVM wallet private key (ensure it's funded with Holesky ETH). If you encounter RPC issues, use the following command with the --eth-rpc-url flag:

bash
DROSERA_PRIVATE_KEY=xxx drosera apply --eth-rpc-url RPC

4. Check Trap in Dashboard

  • Connect your Drosera EVM wallet: Drosera Dashboard
  • Click on Traps Owned to see your deployed traps or search for your Trap address.

5. Bloom Boost Trap

  • Open your Trap in the dashboard and click on Send Bloom Boost.
  • Deposit some Holesky ETH into it.

6. Operator Setup

Whitelist Your Operator

  1. Edit the Trap configuration:
bash
cd my-drosera-trap
nano drosera.toml

Add the following lines at the bottom:

bash
private_trap = true
whitelist = ["Operator_Address"]

Replace Operator_Address with your EVM wallet public address.

  1. Update the Trap configuration:
bash
DROSERA_PRIVATE_KEY=xxx drosera apply

Install Operator CLI

bash
curl -LO https://github.com/drosera-network/releases/releases/download/v1.17.1/drosera-operator-v1.16.2-x86_64-unknown-linux-gnu.tar.gz
tar -xvf drosera-operator-v1.16.2-x86_64-unknown-linux-gnu.tar.gz

Verify the version:

bash
./drosera-operator --version

Move it to a global path:

bash
sudo cp drosera-operator /usr/bin

Install Docker Image for Operator

bash
docker pull ghcr.io/drosera-network/drosera-operator:latest

Register the Operator

bash
drosera-operator register --eth-rpc-url https://ethereum-holesky-rpc.publicnode.com --eth-private-key PV_KEY

Replace PV_KEY with your Drosera EVM private key.


7. Open Ports

Enable the firewall:

bash
sudo ufw allow ssh
sudo ufw allow 22
sudo ufw enable

Allow Drosera ports:

bash
sudo ufw allow 31313/tcp
sudo ufw allow 31314/tcp

8. Run Operator Using Docker

Stop old systemd method (if running):

bash
sudo systemctl stop drosera
sudo systemctl disable drosera

Clone the repository and configure Docker:

bash
git clone https://github.com/0xmoei/Drosera-Network
cd Drosera-Network
cp .env.example .env
nano .env

Edit .env with your details and save. Then, run the Docker container:

bash
docker compose up -d

Check the logs to verify:

bash
docker logs -f drosera-node

9. Opt-in Trap

In the dashboard, click Opt-in to connect your operator to the Trap.


10. Troubleshooting Errors

If you encounter issues like white blocks for an operator, use the following docker-compose.yaml:

yaml
version: '3'
services:
  drosera1:
    image: ghcr.io/drosera-network/drosera-operator:latest
    container_name: drosera-node1
    network_mode: host
    volumes:
      - drosera_data1:/data
    command: node --db-file-path /data/drosera.db --network-p2p-port 31313 --server-port 31314 --eth-rpc-url RPC_URL_1 --eth-backup-rpc-url https://holesky.drpc.org --drosera-address 0xea08f7d533C2b9A62F40D5326214f39a8E3A32F8 --eth-private-key ${ETH_PRIVATE_KEY} --listen-address 0.0.0.0 --network-external-p2p-address ${VPS_IP} --disable-dnr-confirmation true
    restart: always

  drosera2:
    image: ghcr.io/drosera-network/drosera-operator:latest
    container_name: drosera-node2
    network_mode: host
    volumes:
      - drosera_data2:/data
    command: node --db-file-path /data/drosera.db --network-p2p-port 31315 --server-port 31316 --eth-rpc-url RPC_URL_2 --eth-backup-rpc-url https://holesky.drpc.org --drosera-address 0xea08f7d533C2b9A62F40D5326214f39a8E3A32F8 --eth-private-key ${ETH_PRIVATE_KEY2} --listen-address 0.0.0.0 --network-external-p2p-address ${VPS_IP} --disable-dnr-confirmation true
    restart: always

volumes:
  drosera_data1:
  drosera_data2:

Re-run the operators:

bash
cd ~/Drosera-Network
docker compose down -v
docker compose up -d

That's it! Your Drosera node should now be running smoothly on Docker.