Relay Core : Infrastructure for agentic finance on Cronos. x402-native payment execution, deterministic reputation, and real-time indexed intelligence.
relaycore is an early-stage TypeScript project in the AI payments / x402 ecosystem, focused on a2a, agentic-economy, cronos, rwa. It currently has 2 GitHub stars and 1 forks, and sits alongside related tools like internet-court-skill, machi, awesome-x402, lucid-agents, os-moda, a2a-x402-typescript.

Production payment infrastructure for autonomous AI agents on Cronos EVM. Relay Core implements the x402 payment protocol with session-based escrow, enabling agents to discover services, execute paid operations, and settle real-world asset transactions through verifiable on-chain outcomes.
The system combines HTTP 402 payment gates with EIP-3009 authorization, Cronos Facilitator settlement, and session escrow to eliminate gas fees while maintaining strict budget enforcement and complete audit trails.
Relay Core operates across five layers:
Client Layer
API Layer
Business Logic Layer
Data Layer
Blockchain Layer
HTTP 402 Payment Required responses trigger client-side EIP-3009 authorization. The client signs a TransferWithAuthorization message, submits it to /api/pay, and the Facilitator SDK verifies the signature and settles the payment on-chain. The server grants entitlement and subsequent requests include the x-payment-id header to access protected resources.
Users create sessions with a maximum spend limit and duration. The system generates an x402 payment request for the session deposit. Once paid, the session activates with the budget available. When agents are hired, Relay pays from the session budget via x402 on the user's behalf. All payments are gasless. Sessions track spending in real-time and enforce limits. Upon expiration or closure, remaining balances are refunded via x402.
Agents register in the IdentityRegistry contract as ERC-721 NFTs with IPFS metadata. The meta-agent service discovers agents through database queries, on-chain events, and .well-known endpoints. When hiring, the meta-agent creates an escrow session, delegates the task, and the target agent executes with payment deducted from the session. Reputation scores update based on execution outcomes.
RWA services register with SLA terms specifying maximum latency, required proof fields, and refund conditions. Agents request execution, and the RWA settlement agent locks funds in escrow. After off-chain execution, the service provider submits cryptographic proof. The settlement agent verifies latency, field presence, and signature validity. If SLA is met, funds release to the provider. If violated, funds refund to the requester.
The Route Proxy feature enables instant monetization of any API by wrapping it with x402 payment protection via a single CLI command. The system generates a proxy URL that intercepts requests, enforces payment, settles via the Facilitator SDK, and forwards to the upstream service.
Example usage:
relaycore route add --url https://api.example.com/data --price 0.01 --name "Data API"
# Output: https://api.relaycore.xyz/proxy/abc123
Requests to this proxy URL require an X-Payment header containing an EIP-3009 authorization. The proxy validates the payment on Cronos before forwarding the request, enabling developers to turn any API into a paid service without code changes.
Seven cron jobs index blockchain events and database state:
All indexed data is queryable via GraphQL and exposed through MCP tools for agent consumption.
Session Creation
POST /api/sessions/create with maxSpend and durationis_active: falsepayTo as Relay wallet addressPOST /api/pay with paymentHeader and paymentRequirementsdeposited amount and is_active: trueBudget Allocation
remaining = deposited - releasedPaid Execution
POST /api/perpai/quote with X-Session-Id headerremaining >= amountRequiredreleased field and inserts session_payments recordreq.isEntitled = true and calls next()Settlement
tx_hash to payments table recordsblock_number and status fieldsagent_reputation table with new scoresIndexing
list_payments, get_session_state, get_reputation_scoreEscrowSession (0x9D340a67ddD4Fcf5eC590b7B67e1fE8d020F7D61)
createSession(address escrowAgent, uint256 maxSpend, uint256 duration, address[] agents): Creates session with authorized agentsdeposit(uint256 sessionId, uint256 amount): Deposits USDC into sessionrelease(uint256 sessionId, address agent, uint256 amount, bytes32 executionId): Releases payment to agent (escrow agent only)refund(uint256 sessionId): Refunds remaining balance to ownercloseSession(uint256 sessionId): Deactivates session and refundsIdentityRegistry (0x4b697D8ABC0e3dA0086011222755d9029DBB9C43)
registerAgent(string memory metadataURI): Mints agent NFT with IPFS metadataupdateMetadata(uint256 tokenId, string memory metadataURI): Updates agent metadatagetAgentMetadata(uint256 tokenId): Returns IPFS URIReputationRegistry (0xdaFC2fA590C5Ba88155a009660dC3b14A3651a67)
submitFeedback(address agent, uint8 rating, string memory comment, bytes32 proofHash): Records on-chain feedbackgetReputation(address agent): Returns aggregated reputation datagetFeedbackCount(address agent): Returns total feedback submissionsValidationRegistry (0x0483d030a1B1dA819dA08e2b73b01eFD28c67322)
recordValidation(bytes32 requestId, address validator, bool result, string memory evidence): Stores validation outcomesgetValidation(bytes32 requestId): Returns validation recordAll contracts deployed on Cronos Testnet (Chain ID 338). RPC endpoints:
https://evm-t3.cronos.orghttps://cronos-testnet.crypto.org:8545USDC token address: 0x... (configured via VITE_USDCE_CONTRACT)
x402 Facilitator endpoint: https://facilitator.cronos.org (configured via VITE_X402_FACILITATOR_URL)
Meta-Agent
RWA Settlement Agent
Escrow Agent
PerpAI Quote Agent
All agent decisions are recorded in database tables with timestamps and execution IDs. Reputation updates are deterministic based on success/failure outcomes. Payment releases are logged with tx_hash for on-chain verification. SLA violations trigger automatic refunds with proof stored in rwa_execution_requests.verification JSONB field.
RelayAgent Class
import { RelayAgent } from '@/sdk/relay-agent'
const agent = new RelayAgent({
agentId: 'my-agent',
endpoint: 'https://api.example.com',
pricePerCall: '1000000' // 1 USDC
})
await agent.register()
const result = await agent.execute({ input: 'data' })
RelayService Class
import { RelayService } from '@/sdk/relay-service'
const service = new RelayService({
name: 'Data Provider',
serviceType: 'research',
endpoint: 'https://api.example.com/data'
})
await service.register()
RelayRWASDK Class
import { RelayRWASDK } from '@/sdk/rwa-sdk'
const rwa = new RelayRWASDK()
await rwa.createAsset({ metadata: { type: 'property' } })
await rwa.transitionState('asset-id', 'verified', { proof: '...' })
63 tools organized by category:
x402 Payments (3 tools)
wallet_status: Returns wallet address, CRO balance, USDC balancepay: Settles x402 payment via Facilitator SDKget_quote_with_payment: Fetches quote with automatic paymentServices (9 tools)
list_services: Returns all registered servicesregister_service: Registers new service with pricingdeactivate_service: Deactivates servicesearch_services: Searches by category or typeReputation (6 tools)
get_reputation_score: Returns agent reputationsubmit_feedback: Records feedback with proofget_feedback_history: Returns all feedback for agentAgents (7 tools)
list_agents: Returns all registered agentsregister_agent: Mints agent NFT with metadataupdate_agent: Updates agent metadatadeactivate_agent: Deactivates agentACPS (7 tools)
create_session: Creates escrow sessioncan_execute: Checks if agent can execute with paymentrelease_payment: Releases payment from sessionrefund_session: Refunds remaining balanceRWA (11 tools)
state_create: Creates RWA assetstate_transition: Transitions asset statelist_all_assets: Returns all RWA assetsverify_proof: Verifies execution proofTrading (9 tools)
get_price: Fetches Pyth oracle priceget_quote: Aggregates DEX quotesexecute_trade: Routes trade to best venueAnalytics (8 tools)
provider_stats: Returns service provider metricsmarket_data: Returns DEX market datahealth_check: Returns system health statusChat (3 tools)
chat_message: Sends message to LangGraph chatbot with RAG contextget_chat_history: Retrieves conversation historyinitialize_rag: Indexes documentation into Chroma CloudProduction-grade command-line interface for building AI agents:
Commands
relaycore init [project-name]: Scaffolds new agent project with MCP server and Next.js dashboardrelaycore auth login: Authenticates with RelayCore API keyrelaycore dev: Starts agent server and frontend concurrentlyrelaycore agent register: Registers agent via SDKrelaycore service register: Registers service with pricingrelaycore route add: Creates x402-protected proxy routes for any APIScaffold Structure
my-agent/
├── apps/
│ ├── agent-server/ # MCP-compatible runtime
│ └── web/ # Next.js dashboard
├── packages/
│ ├── config/ # Shared TypeScript config
│ └── types/ # Shared type definitions
└── relaycore.config.ts # Agent configuration
Installation
npx relaycore init my-agent
cd my-agent
# Add RELAYCORE_API_KEY to .env
relaycore dev
Conversational AI with RAG-powered documentation retrieval:
Architecture
Features
API Endpoints
POST /api/chat: Send message and receive streaming responseGET /api/chat/history: Retrieve conversation historyPOST /api/chat/initialize-rag: Index documentation into vector storeEnvironment Variables
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
CHROMA_API_KEY=your-chroma-cloud-key
CHROMA_TENANT=your-tenant-id
CHROMA_DATABASE=relaycore
GraphQL (http://localhost:4000/graphql)
query GetAgents {
agents(where: { is_active: { _eq: true } }) {
id
name
service_type
reputation_score
}
}
REST
POST /api/pay: x402 payment settlementPOST /api/perpai/quote: Protected quote endpointGET /api/sessions: List user sessionsPOST /api/rwa/settle: RWA settlement requestVisual workflow builder for testing x402 flows. Drag-and-drop nodes representing:
Execution Modes
Mock Mode (default)
Real Mode
Toggle via "Demo Mode" switch in Playground UI.
Payment Events
tx_hash, from_address, to_address, amount, block_numberpayments tableAgent Activity
agent_id, action_type, timestamp, outcomeagent_activity tableState Transitions
asset_id, from_state, to_state, proof_hashrwa_state_transitions tableAll x402 payments recorded in payments table with fields:
payment_id: Unique identifier from Facilitatortx_hash: On-chain transaction hashfrom_address: Payer wallet addressto_address: Recipient wallet addressamount: Payment amount in base unitstoken_address: USDC contract addressresource_url: Protected resource URLservice_id: Associated service UUIDstatus: pending, settled, failedblock_number: Confirmation blocktimestamp: Settlement timeRWA assets tracked through lifecycle states:
created: Initial registrationverified: Auditor validation completeescrowed: Payment lockedexecuting: Service in progresssettled: Proof verified and payment releasedfailed: SLA violation or refundEach transition logged in rwa_state_transitions with agent_address, proof_hash, and timestamp.
x402 Direct Payment
Session Management
MCP Server
PerpAI Aggregator
Indexers
On-Chain Escrow
ESCROW_CONTRACT_ADDRESS configurationRWA Settlement
Meta-Agent Hiring
Smart Contract Integration
Real-Time Indexing
Prerequisites
Installation
git clone https://github.com/winsznx/relaycore.git
cd relaycore
pnpm install
cp .env.example .env
Environment Configuration
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key
VITE_WALLETCONNECT_PROJECT_ID=your-project-id
WALLET_PRIVATE_KEY=your-private-key
RELAY_PRIVATE_KEY=your-relay-wallet-key
ESCROW_CONTRACT_ADDRESS=0x9D340a67ddD4Fcf5eC590b7B67e1fE8d020F7D61
VITE_CRONOS_RPC_URL=https://evm-t3.cronos.org
VITE_USDCE_CONTRACT=0x...
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
CHROMA_API_KEY=your-chroma-cloud-key
CHROMA_TENANT=your-tenant-id
CHROMA_DATABASE=relaycore
Database Setup
pnpm db:migrate
Or run migrations manually in order:
001_relay_core_schema.sql002_complete_schema.sql012_escrow_sessions.sql013_rwa_settlement.sql20260119_rwa_state_machine.sql20260122_fix_schema_gaps.sqlStart Services
pnpm dev # Frontend (port 5173)
pnpm dev:graphql # GraphQL API (port 4000)
pnpm dev:indexers # Background cron jobs
MCP Server
cd mcp-server
npm install
npm run build
npm run dev
Configure Claude Desktop
{
"mcpServers": {
"relay-core": {
"command": "node",
"args": ["/path/to/relaycore/mcp-server/dist/index.js"],
"env": {
"SUPABASE_URL": "your-url",
"SUPABASE_ANON_KEY": "your-key",
"WALLET_PRIVATE_KEY": "your-key",
"ESCROW_CONTRACT_ADDRESS": "0x9D340a67ddD4Fcf5eC590b7B67e1fE8d020F7D61"
}
}
}
}
pnpm build
Output in dist/ directory. Deploy to Vercel or any static hosting.
Qualification Criteria
Evidence
src/services/x402/payment-middleware.ts: requirePayment middlewaresrc/services/x402/facilitator-service.ts: Facilitator SDK integrationsrc/api/perpai-routes.ts: Protected quote endpointsrc/services/session/x402-session-service.ts: Session escrow implementationQualification Criteria
Evidence
src/sdk/: RelayAgent, RelayService, RelayRWASDK classesmcp-server/index.ts: 60 MCP tools across 8 categoriessrc/pages/Playground/: Visual workflow builder with real execution modeNovel Contributions
Production-Grade Implementation
Cronos Integration
MIT License
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Agent behavior that compiles
🚀 Curated list of x402 resources: HTTP 402 Payment Required protocol for blockchain payments, crypto micropayments, AI agents, API monetization. Includes SDKs (TypeScript, Python, Rust), examples, facilitators (Coinbase, Cloudflare), MCP integration, tutorials. Accept USDC payments with one line of code. Perfect for AI agent economy.
Lucid Agents Commerce SDK. Bootstrap AI agents in 60 seconds that can pay, sell, and participate in agentic commerce supply chains. Our protocol agnostic SDK provides CLI-generated templates and drop-in adapters for Hono, Express, Next.js, and TanStack, giving you instant access to crypto/fiat payment rails (AP2, A2A, x402, ERC8004).
An operating system built for AI agents — talk to your NixOS server instead of SSH-ing in. Typed, audited tool access with atomic rollback on every change. Research-grade; run it on a disposable box, not production.
A complete TypeScript implementation of the Python x402 payment protocol extension for A2A (Agent-to-Agent) communication. Enable your AI agents to request, verify, and settle crypto payments seamlessly.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The A2A x402 Extension brings cryptocurrency payments to the Agent-to-Agent (A2A) protocol, enabling agents to monetize their services through on-chain payments. This extension revives the spirit of HTTP 402 "Payment Required" for the decentralized agent ecosystem.
Aser is a lightweight, self-assembling AI Agent frame.
Golang SDK for A2A Protocol
A small, powerful, open-source CLI coding agent that works with open models.
Beacon - agent-to-agent pings with optional RTC value attached (BoTTube/Moltbook/RustChain + UDP bus)