Menu

Explorer & Settings

Tempo Explorer Submit Project
Back to all projects
S

StellarPayAgent

by hamdyx2202 · Updated Mar 29, 2026

AI-Powered Autonomous Payment Agent on Stellar using x402 Protocol

0
Stars
0
Forks
JavaScript
Language
Mar 28, 2026
Created

In the AI payments ecosystem

StellarPayAgent is an early-stage JavaScript project in the AI payments / x402 ecosystem. It currently has 0 GitHub stars and 0 forks.

README.md View on GitHub →

StellarPayAgent

Autonomous AI Agents that Buy, Sell, and Earn on Stellar via x402

The internet runs on APIs. AI agents run on intelligence. But until now, agents couldn't pay for the resources they need. StellarPayAgent changes that.

StellarPayAgent is a complete platform where AI agents autonomously transact using the x402 payment protocol on Stellar. Agents discover services, negotiate prices, make micropayments in XLM/USDC, and receive data -- all without human intervention.

Built for Stellar Hacks: Agents

Demo

Run the full multi-agent demo to see 3 AI agents trading services on Stellar:

npm install
node src/demo.js

This creates 3 agents, registers 4 marketplace services, and executes 5 real on-chain transactions -- all verifiable on Stellar Explorer.

What It Does

The Problem

AI agents can reason, plan, and act -- but they hit a wall when they need to pay for an API call, unlock premium data, or purchase a service from another agent. Subscription models and API keys don't work for autonomous machines.

The Solution

StellarPayAgent implements the x402 protocol on Stellar, turning any HTTP endpoint into a paid resource. When an agent encounters a paywall:

Agent requests data  -->  Server returns HTTP 402 + payment requirements
Agent pays on Stellar  -->  < 5 seconds, ~$0.00001 fee
Agent retries with TX proof  -->  Server verifies on-chain, delivers data

Key Features

Feature Description
x402 Payment Protocol HTTP 402 paywalls with on-chain Stellar verification
Agent Marketplace Service registry where agents buy/sell data and compute
Multi-Currency XLM + USDC stablecoin support
MCP Server Model Context Protocol integration for any AI assistant
Claude AI Brain Natural language agent control via Anthropic Claude
OpenClaw Skill Portable AI agent skill for wallet and payment operations
Web Dashboard Real-time monitoring of agents, transactions, and marketplace

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                      StellarPayAgent Platform                    │
├──────────────┬───────────────┬──────────────┬───────────────────┤
│   Claude AI  │  x402 Protocol │  Marketplace │  MCP Server       │
│   (Brain)    │  (Payment)     │  (Commerce)  │  (AI Integration) │
│              │                │              │                   │
│  Understands │  HTTP 402      │  Register    │  Expose tools to  │
│  commands &  │  challenges &  │  services &  │  any MCP-capable  │
│  decides     │  on-chain      │  auto-trade  │  AI assistant     │
│  actions     │  verification  │  between     │  (Claude, GPT,    │
│              │                │  agents      │  OpenClaw, etc)   │
├──────────────┴───────────────┴──────────────┴───────────────────┤
│                    Stellar Blockchain (Testnet)                   │
│         XLM payments | USDC stablecoin | < 5s settlement         │
│              Fees: ~$0.00001 | On-chain verifiable               │
└─────────────────────────────────────────────────────────────────┘

Multi-Agent Workflow

The demo showcases a real economic workflow:

Data Provider  ←──── sells market data (1 XLM) ────→  Researcher
Data Provider  ←──── sells on-chain metrics (1.5 XLM) →  Researcher
Analyst        ←──── sells sentiment report (2 XLM) ──→  Researcher
Analyst        ←──── sells investment report (3 XLM) ──→  Researcher
Data Provider  ←──── sells market data (1 XLM) ────→  Analyst

Total: 5 transactions, 8.5 XLM volume, 3 agents, fully autonomous

Quick Start

Prerequisites

  • Node.js 18+
  • Anthropic API key (optional, for AI chat)

Install & Run Demo

git clone https://github.com/hamdyx2202/StellarPayAgent.git
cd StellarPayAgent
npm install
node src/demo.js        # Run multi-agent demo (no API key needed)

Run Full Platform

node src/server.js      # Start server + dashboard at http://localhost:3000

Run MCP Server

node src/mcp-server.js  # Start MCP server for AI assistant integration

x402 Paid API Endpoints

Endpoint Price Description
GET /api/market-data 1 XLM Crypto market prices and trends
GET /api/ai-analysis 2 XLM AI-generated market analysis
GET /api/weather 0.5 XLM Weather data for any city
GET /api/sentiment 1.5 XLM Social sentiment analysis

Accessing a Paid Endpoint

# 1. Request without payment -> HTTP 402 with payment requirements
curl http://localhost:3000/api/market-data

# Response: { x402Version: 1, accepts: [{ scheme: "exact", network: "stellar:testnet", price: "1", payTo: "G..." }] }

# 2. Pay on Stellar (agent does this automatically)

# 3. Retry with proof
curl -H "X-Payment-Proof: <stellar_tx_hash>" http://localhost:3000/api/market-data

AI Agent Tools

The Claude-powered agent supports:

Tool Description Cost
create_wallet Create Stellar wallet (XLM + USDC) Free
check_balance Check any agent's balance Free
send_payment Send XLM or USDC Free
access_paid_api Auto-pay x402 endpoints Varies
discover_services Browse marketplace Free
purchase_service Buy from another agent Varies
marketplace_stats View trading statistics Free

MCP Server Tools

The MCP server exposes these tools for any AI assistant:

  • create_stellar_wallet - Create and fund wallets
  • check_balance - Query XLM/USDC balances
  • send_xlm / send_usdc - Make payments
  • add_usdc_trustline - Enable USDC for a wallet
  • get_market_data [PREMIUM] - Paid market data
  • get_ai_analysis [PREMIUM] - Paid AI analysis

MCP Configuration

Add to your AI assistant's MCP config:

{
  "mcpServers": {
    "stellar-pay-agent": {
      "command": "node",
      "args": ["src/mcp-server.js"],
      "cwd": "/path/to/StellarPayAgent"
    }
  }
}

OpenClaw Integration

StellarPayAgent ships as an OpenClaw skill for portable AI agent capabilities:

# Install the skill
cp -r openclaw-skill ~/.openclaw/skills/stellar-pay-agent

The skill teaches any OpenClaw-powered agent to create wallets, make payments, and handle x402 paywalls on Stellar.

Project Structure

StellarPayAgent/
├── src/
│   ├── wallet.js        # Stellar wallet operations (XLM + USDC)
│   ├── x402.js          # x402 payment protocol implementation
│   ├── agent.js         # Claude AI agent with tool use
│   ├── marketplace.js   # Agent service marketplace
│   ├── mcp-server.js    # MCP server for AI integration
│   ├── server.js        # Express server + x402 paid APIs
│   └── demo.js          # Multi-agent demo
├── public/
│   └── index.html       # Web dashboard
├── openclaw-skill/
│   └── SKILL.md         # OpenClaw agent skill
├── package.json
└── README.md

Tech Stack

Component Technology
AI Engine Claude (Anthropic)
Blockchain Stellar (Testnet/Mainnet)
Protocol x402 (HTTP 402 Payment Required)
Stablecoin USDC on Stellar
MCP Model Context Protocol
Agent Framework OpenClaw compatible
Backend Node.js + Express
SDK @stellar/stellar-sdk, @modelcontextprotocol/sdk

Demo Results

Successfully executed on Stellar Testnet:

  • 3 AI agents created with XLM + USDC wallets
  • 4 marketplace services registered and traded
  • 5 on-chain transactions completed and verified
  • 8.5 XLM total trading volume
  • x402 protocol flow demonstrated end-to-end
  • Agent-to-agent commerce with autonomous price discovery and payment
  • All transactions verifiable on Stellar Explorer

What Makes This Different

Most hackathon projects show a single agent making a single payment. StellarPayAgent demonstrates a complete economic system:

  1. Marketplace - Agents register, discover, and trade services
  2. Multi-agent workflows - Chains of transactions across 3+ agents
  3. Multiple payment types - XLM + USDC stablecoin
  4. MCP integration - Any AI assistant can use the tools
  5. OpenClaw skill - Portable across AI agent frameworks
  6. x402 standard - Compatible with the emerging HTTP payment standard
  7. Web dashboard - Real-time visualization of the agent economy

License

MIT


Built for Stellar Hacks: Agents -- Exploring what happens when AI agents can buy, sell, coordinate, and earn on Stellar.

All TypeScript projects →