Omnix402
Enabling agents to reach any X402 sellers from any chain through an OFT using custom EIP-3009
Problem Statement
Omnix402 opens the HTTP 402 (Payment Required) protocol to the multichain era, breaking down the barriers that limit AI agents and developers to single-chain ecosystems. We built a protocol that allows users and AI agents to pay for protected resources on one blockchain while the payment seamlessly bridges to another chain where the API endpoint lives.Today’s X402 protocol endpoints are fragmented by chain. An AI agent on Polygon can only access endpoints that accept Polygon payments. An endpoint on Base can only monetize Base users.This fragmentation limits the growth potential of the X402 ecosystem and prevents AI agents from expanding their service catalog beyond their native chain.Omnix402 solves this. Imagine an AI agent with funds on Polygon that needs to call an API endpoint hosted on Base. With Omnix402, it's just a single request. We combined the X402 protocol with LayerZero's OFT (Omnichain Fungible Token) standard to create a seamless cross-chain payment bridge.Our protocol introduces USDO (Omnichain USD), a wrapped version of USDC that can move freely across chains through LayerZero. AI agents and developers simply wrap their USDC into USDO, and can then access any X402 API on any supported chain. The protocol handles all the cross-chain complexity and delivers the protected content.Omnix402 is deployed on Polygon and Base, with a web app that guides developers through the protocol. It features live demonstrations of cross-chain payments and code examples to help developers integrate X402 into their own projects.
Solution
There are three main components to our project:Smart ContractsFour core smart contracts deployed on Polygon and Base:USDO.sol: Our custom OFT (Omnichain Fungible Token) that extends LayerZero's OFT standard. It wraps/unwraps USDC and implements EIP-3009 Extended, our enhanced version of the standard that adds a data field to the transferWithAuthorization and receiveWithAuthorization functions. The standard EIP-3009 doesn't support arbitrary data, but we needed a way to encode destination chain information and routing parameters directly in the payment authorization, to make sure that the user agreed with this information. This modification allows the entire cross-chain flow to be initiated with a single signature. The data field contains the destination chain ID and payment receiver address. This data field allows us to encode cross-chain routing information directly in the payment authorization, enabling users to authorize cross-chain transfers with just a signature, no need to send a transaction first. This upgraded version of the EIP-3009 has a lot of potential applications beyond our specific cross-chain use case. The flexible data field can be leveraged for various scenarios such as payment with conditions or multi-hop transactions or conditional execution paths basedOmnixRouter.sol: Orchestrates the cross-chain flow. When a user signs an EIP-3009 authorization, the router decodes the destination chain info from the data field and calls LayerZero's send() function with the appropriate parameters to initiate the bridge mechanism.OmnixDVN.sol: Our custom Data Verification Network (DVN) for LayerZero. We built an admin-controlled DVN specifically optimized for payment flows. The owner can call verify() and commit() directly.OmnixExecutor.sol: Our custom LayerZero Executor that receives and executes cross-chain messages. It's admin-controlled and includes a special commitAndExecute() function that combines verification commitment and execution in a single transaction for maximum efficiency.All contracts were deployed using Hardhat and LayerZero deployment tools, with Foundry for testing.Backend (Node.js/Express)The backend bridges X402 with LayerZero:Endpoint Routes: Implements the X402 protocol specification:GET /endpoint?endpoint=<url>&network=<chain>: Returns payment requirements modified for cross-chain (402 response)POST /endpoint?endpoint=<url>with X-Payment header: Processes the payment and returns the protected contentCross-chain Orchestration using ethers.js:Submit the EIP-3009 signed authorization to the source chain (Polygon)Listen for LayerZero's PacketSent event to extract packet dataCall DVN verify() on destination chain (Base)Call DVN commit() on destination chainCall Executor commitAndExecute() to finalize the bridgeUse Coinbase CDP SDK to execute the final x402 payment to the desired endpoint in the destination chainParallel Execution: All three destination chain transactions (verify, commit, execute) are signed simultaneously and broadcast together with sequential nonces to minimize latency.Frontend (Next.js//TypeScript)The frontend provides a complete developer experience:DemoStatus: Shows real-time bridge progress with 5 distinct steps (payment, DVN verify, relay, execution, final payment)SwapUSDO: Wrap/unwrap interface for USDC / USDOCodeExample: Syntax-highlighted API usage guide for developerHowItWorks: Step-by-step educational guideWallet Integration: Reown AppKit for wallet connection with network switching.Technologies UsedLayerZero V2: Cross-chain messaging infrastructureSolidity 0.8.22: Smart contract languageHardhat & Foundry: Development & testing frameworksNode.js & Express: Backend APIMongoDB: Database for tracking paymentsNext.js & React: Frontend frameworkReown AppKit: Wallet connectionTailwind CSS: Stylingethers.js: Blockchain interactionsx402-fetch: X402 protocol clientCoinbase CDP SDK: Secure wallet managementBuilt by @0xKairn and @TristanAzlt during Eth Global Buenos Aires
Hackathon
ETHGlobal Buenos Aires
2025
Prizes
- 🏆
Best Use of Payments on Polygon1st place
Polygon
- 🏆
Best Omnichain ImplementationBest Developer Feedback
LayerZero
Contributors
- TristanAzlt
36 contributions
- 0xKairn
34 contributions