DEV Community

Daniel Ioni
Daniel Ioni

Posted on

🤖 MyZubster Robot: The First Open-Source Robot That Pays Itself with Monero"

🤖 MyZubster Robot: The First Open-Source Robot That Pays Itself with Monero

TL;DR: We built a complete open-source stack where ESP32/Arduino robots autonomously request and pay for recharge using the x402 protocol and Monero. Robot pays, owner earns, community grows.


🌱 The Vision

Imagine this:

  • A lawn mower robot finishes its battery → requests recharge
  • The robot sends a payment request (x402) to the gateway
  • The owner sends 0.01 XMR → robot charges
  • The owner gets 85%, MyZubster takes 2%, Bosco community fund takes 8%, and the referrer gets 5%

This is now a reality. And it's open-source.


🏗️ The Architecture

┌─────────────────────────────────────────────────────────────────┐
│ MyZubster-Robot │
│ Open-source Repository │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ ESP32/ │ │ x402 │ │ Monero Wallet │ │
│ │ Arduino │───▶│ Gateway │───▶│ RPC (Testnet) │ │
│ │ Robot │ │ Node.js │ │ │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Escrow │ │ GitHub │ │ Docker │ │
│ │ (Base) │ │ Bounties │ │ Compose │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
text


💰 How the Payment Flow Works

1️⃣ Register a Robot


bash
curl -X POST http://localhost:10003/api/robot/register \
  -H "Content-Type: application/json" \
  -d '{
    "id": "robot_001",
    "name": "Tagliaerba",
    "owner": "45M4DW1...",
    "walletAddress": "4A2Btest1234567890"
  }'

Response:
json

{
  "success": true,
  "robot": {
    "id": "robot_001",
    "owner": "45M4DW1...",
    "name": "Tagliaerba",
    "walletAddress": "4A2Btest1234567890",
    "batteryLevel": 100,
    "isActive": true
  }
}

2️⃣ Robot Requests Recharge (x402)

When battery < 15%, the robot sends:
bash

curl -X GET "http://localhost:10003/api/robot/ricarica?robotId=robot_001&amount=0.01"

Gateway responds with 402 Payment Required:
json

{
  "status": "payment_required",
  "amount": 0.0115,
  "fee": 0.0002,
  "boscoFee": 0.0008,
  "referralFee": 0.0005,
  "address": "4A2Btest1234567890",
  "memo": "Ricarica robot robot_001"
}

3️⃣ Payment is Made

    85% → Robot owner

    2% → MyZubster (platform maintenance)

    8% → Bosco Community Fund

    5% → Referrer (if the robot was cloned)

4️⃣ Robot Charges

Gateway confirms the payment and the robot recharges.
🧮 Fee Structure
Fee Type    Percentage  Destination
MyZubster Fee   2%  Platform maintenance
Bosco Fee   8%  Community fund
Referral Fee    5%  Referrer (who cloned the robot)
Owner   85% Robot owner

Example: A robot recharge of 0.01 XMR
Component   Calculation Amount
Recharge    0.01    0.01 XMR
MyZubster Fee   0.01 × 0.02    0.0002 XMR
Bosco Fee   0.01 × 0.08    0.0008 XMR
Referral Fee    0.01 × 0.05    0.0005 XMR
Total   0.01 + 0.0002 + 0.0008 + 0.0005 0.0115 XMR
🔄 Referral System

When a robot is cloned, the original owner earns 5% of all recharge fees for 1 year.
Clone a Robot
bash

curl -X POST http://localhost:10003/api/robot/clone \
  -H "Content-Type: application/json" \
  -d '{
    "originalId": "robot_001",
    "newId": "robot_002",
    "name": "Tagliaerba Clone",
    "owner": "45M4DW1...clone..."
  }'

Response:
json

{
  "success": true,
  "robot": {
    "id": "robot_002",
    "name": "Tagliaerba Clone",
    "referrer": "45M4DW1...",
    "walletAddress": "4A2B..."
  },
  "referral": {
    "referrer": "45M4DW1...",
    "expiresAt": "2027-08-02T00:00:00.000Z",
    "feeCollected": 0,
    "message": "5% fee for 1 year on every recharge!"
  }
}

Check Referral Fees
bash

curl http://localhost:10003/api/referral/45M4DW1...

Response:
json

{
  "referrer": "45M4DW1...",
  "totalRobotsCloned": 1,
  "totalFeesCollected": 0.0005,
  "referrals": [...]
}

🤖 ESP32/Arduino Sketch

The robot runs on an ESP32 and automatically:

    Connects to WiFi

    Registers on the gateway

    Monitors battery level

    Requests recharge when < 15%

    Simulates payment (or uses real wallet SDK)

cpp

// x402_robot.ino - Core robot logic
void loop() {
  batteryLevel = readBattery();

  // If battery low → request recharge
  if (batteryLevel < 15.0 && registered) {
    requestRecharge(0.01);
  }

  // Check payment status
  checkPaymentStatus();

  delay(5000);
}

Output on Serial Monitor:
text

=========================================
🤖 MyZubster x402 Robot - ESP32
=========================================
📶 Connecting to WiFi... ✅
📡 IP: 192.168.1.100
📝 Registering robot... ✅
✅ Robot ready!
📌 ID: robot_esp32_001
🔋 Battery: 100.0%
=========================================
🔋 Battery: 14.5%
⚡ Requesting x402 recharge...
💰 402 Payment Required!
📄 Response: {"status":"payment_required",...}
📫 Address: 4A2Btest1234567890
💰 Total: 0.0115 XMR
💸 Fee (2%): 0.0002 XMR
🌳 Bosco Fee (8%): 0.0008 XMR
🔗 Referral Fee (5%): 0.0005 XMR
✅ Payment sent!
🔋 Battery recharged to 100%!

🔗 Links

    Repository: MyZubster-Robot

    Gateway: MyZubsterGateway

    Wiki: MyZubster Wiki

    DEV.to: Follow me

🚀 Getting Started
Clone the Repository
bash

git clone https://github.com/MyZubster-Ecosystem/MyZubster-Robot.git
cd MyZubster-Robot

Start the Gateway
bash

docker-compose up -d

Test the API
bash

curl http://localhost:10003/

Upload to ESP32

    Open arduino-robot-sdk/examples/x402_robot/x402_robot.ino in Arduino IDE

    Set WiFi credentials

    Upload

📄 License

MIT License – fully open source.
💬 Questions?

Drop a comment below or open an issue on GitHub!

Built with ❤️ by Daniel Ioni & the MyZubster Community

#monero #robotics #iot #opensource #web3 #myzubster #arduino #esp32 #blockchain
Enter fullscreen mode Exit fullscreen mode

Top comments (0)