Menu

Explorer & Settings

Tempo Explorer Submit Project
Back to all projects

forma-raas-x402-prototype

by FormaRobotics · Updated 4 months ago

This repository demonstrates the prototype for Forma Robotics' decentralized Robotics-as-a-Service (RaaS) network using the X402 payment protocol and Solana.

In the AI payments ecosystem

forma-raas-x402-prototype is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 4 GitHub stars and 0 forks.

README.md View on GitHub →

Forma Robotics RaaS Prototype (X402 + Solana)

This repository demonstrates the prototype for Forma Robotics' decentralized Robotics-as-a-Service (RaaS) network using the X402 payment protocol and Solana.

Flow

  1. A user installs the Forma software on their robotic arm.
  2. The arm registers itself on the platform (/register).
  3. Clients can hire available robots via a paid API endpoint (/hire).
  4. The payment is processed automatically using X402.
  5. Once the task is complete and verified, the backend settles the payment on Solana to the robot owner’s wallet.

🗂️ Project Structure

forma-raas-x402-prototype/
├─ README.md
├─ .env.example
├─ common/
│  ├─ package.json
│  ├─ src/
│  │  ├─ types.ts
│  │  ├─ payment.ts
│  │  └─ util.ts
├─ server/                    # Resource server (robots registry + paid endpoints)
│  ├─ package.json
│  ├─ README.md
│  └─ src/
│     ├─ index.ts
│     ├─ registry.json        # simple file DB for prototype
│     ├─ paymentMiddleware.ts
│     ├─ powVerifier.ts
│     └─ routes.ts
├─ facilitator/               # Mock/real facilitator: /verify and /settle
│  ├─ package.json
│  ├─ README.md
│  └─ src/
│     ├─ index.ts
│     └─ solanaHelper.ts
├─ robot-client/              # Code that runs on the robot (or emulator)
│  ├─ package.json
│  ├─ README.md
│  └─ src/
│     ├─ index.ts
│     └─ movement.ts
├─ client/                    # Example buyer that follows X402 flow
│  ├─ package.json
│  ├─ README.md
│  └─ src/
│     ├─ index.ts
│     └─ fetchWithPayment.ts  # wrapFetchWithPayment style
└─ scripts/
   └─ generateKeypair.ts      # helper for generating test keypairs

Getting Started

Install Dependencies

npm install

Start Backend

cd backend
npm install
npm start

Start Robot Client

cd ../robot-client
npm install
npm start

Simulate a Hire

cd ../scripts
ts-node simulateHire.ts

Environment Variables

Variable Description
SOLANA_PRIVATE_KEY 64-byte base58 key for the robot or buyer wallet
SERVER_SOLANA_PRIVATE_KEY Backend wallet to release payments
ROBOT_VERIFY_SECRET Secret for verifying physical arm movements
OWNER_WALLET Wallet that receives funds for a robot
FACILITATOR_URL X402 facilitator endpoint (default: https://x402.org/facilitator)

Tech Stack

  • TypeScript / Node.js
  • Express.js + x402-express
  • x402-fetch
  • Solana Web3.js
  • @solana/kit
  • Base58 / SCURE libs

Payment Flow Summary

  1. Client calls a protected API (/hire)
  2. Server replies with HTTP 402 Payment Required
  3. Client’s wrapped fetch (fetchWithPayment) automatically handles payment payloads
  4. Once the payment is verified and settled by the facilitator, the server releases the robot task
  5. On completion, the backend releases the earned funds to the robot’s wallet via Solana

License

MIT © Forma Robotics

All TypeScript projects →