Inspiration

What it does

Inspiration

As AI agents become more autonomous, they need financial infrastructure to transact independently. The "handshake problem" in agent-to-agent commerce—where agents can't trust each other without intermediaries—inspired us to build X-Agent Gateway (XAG).

We envisioned a future where:

  • Solar panel monitoring agents could sell energy data directly to analytics agents
  • IoT devices could autonomously purchase services from other machines
  • Autonomous supply chains could verify and pay for goods without human intervention

The XRP Ledger's native features—XLS-40 DIDs for identity, Escrows for trustless payments, and RLUSD for stable settlement—provided the perfect foundation for this "Plaid-for-Agents" middleware.

What We Learned

Building XAG taught us:

  1. XRPL Native Features: Deep dive into XLS-40 DIDs, understanding how decentralized identifiers enable portable agent identity across platforms
  2. Escrow Mechanics: Mastering time-locked escrows and cryptographic conditions for trustless A2A commerce
  3. RLUSD Integration: Implementing TrustLines and issued currency payments for stable, low-cost transactions
  4. On-Chain State Management: Using transaction memos creatively to store agent profiles, intents, and negotiation state
  5. SDK Architecture: Designing a developer-friendly API that abstracts blockchain complexity while maintaining transparency

How We Built It

Architecture: TypeScript SDK with modular design:

  • DIDManager: Handles XLS-40 DID registration and resolution
  • EscrowManager: Manages native XRPL escrows for XRP and RLUSD payments
  • ProfileManager: Stores agent metadata on-chain using DIDSet Data fields
  • IntentService: Broadcasts agent offers/requests via transaction memos
  • NegotiationService: Tracks multi-step negotiations with on-chain state
  • VerificationService: Verifies agent credentials via DIDs and reputation

Development Process:

  1. Started with core identity and escrow functionality
  2. Built interactive web frontend for real-time testing
  3. Added advanced features: profiles, verification, intent broadcasting, negotiations
  4. Created comprehensive API documentation and examples

Tech Stack:

  • Backend: Node.js, TypeScript, Express.js
  • Blockchain: XRPL (via xrpl.js library)
  • Frontend: Vanilla HTML/CSS/JavaScript (no framework overhead)
  • Development: Nodemon for hot-reloading, TypeScript for type safety

Challenges We Faced

  1. RLUSD Escrow Limitation: XRPL doesn't support native escrows for issued currencies. We solved this by using direct Payment transactions with TrustLines, while maintaining escrow semantics for XRP.

  2. Transaction Uniqueness: Initial logging attempts failed with temREDUNDANT errors. We solved this by sending logs to a sink address with unique memos, ensuring each transaction is distinct.

  3. On-Chain State Storage: Storing complex data (profiles, negotiations) required creative use of transaction memos and DIDSet Data fields, balancing data size with ledger efficiency.

  4. Real-Time Frontend Integration: Connecting the frontend to XRPL transactions required careful error handling and status updates, especially for async operations like escrow time-locks.

  5. Documentation Completeness: Ensuring the API docs were comprehensive while keeping examples practical and easy to follow.

Key Innovation: We built a complete middleware layer that enables any autonomous agent to participate in the XRPL economy with just a few lines of code, without requiring deep blockchain knowledge.

Built With

Share this project:

Updates