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:
- XRPL Native Features: Deep dive into XLS-40 DIDs, understanding how decentralized identifiers enable portable agent identity across platforms
- Escrow Mechanics: Mastering time-locked escrows and cryptographic conditions for trustless A2A commerce
- RLUSD Integration: Implementing TrustLines and issued currency payments for stable, low-cost transactions
- On-Chain State Management: Using transaction memos creatively to store agent profiles, intents, and negotiation state
- 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 resolutionEscrowManager: Manages native XRPL escrows for XRP and RLUSD paymentsProfileManager: Stores agent metadata on-chain using DIDSet Data fieldsIntentService: Broadcasts agent offers/requests via transaction memosNegotiationService: Tracks multi-step negotiations with on-chain stateVerificationService: Verifies agent credentials via DIDs and reputation
Development Process:
- Started with core identity and escrow functionality
- Built interactive web frontend for real-time testing
- Added advanced features: profiles, verification, intent broadcasting, negotiations
- Created comprehensive API documentation and examples
Tech Stack:
- Backend: Node.js, TypeScript, Express.js
- Blockchain: XRPL (via
xrpl.jslibrary) - Frontend: Vanilla HTML/CSS/JavaScript (no framework overhead)
- Development: Nodemon for hot-reloading, TypeScript for type safety
Challenges We Faced
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.
Transaction Uniqueness: Initial logging attempts failed with
temREDUNDANTerrors. We solved this by sending logs to a sink address with unique memos, ensuring each transaction is distinct.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.
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.
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
- html5
- typescript
- xrpl
Log in or sign up for Devpost to join the conversation.