X402R&D
x402 R&D — on-chain refunds, disputes & fraud protection for crypto payments.
Problem Statement
x402 Refund Layer is an on-chain refund and dispute-resolution system designed to bring chargeback-style consumer protection to crypto payments. Today, x402 enables seamless merchant payments, but lacks a formal mechanism for handling refunds, disputes, fraud, or quality-of-service failures. Our project introduces a lightweight protocol layer that lets merchants issue refunds, users file disputes, and neutral agents resolve them using clear rules, evidence, and automated timelines.Merchants integrate one function into their x402 payment flow, and users access a simple interface to request refunds. The system supports partial refunds, auto-approval rules, and AI-assisted decisions for low-value claims. By adding reversibility and trust to on-chain payments, we expand x402 into a safer and more mainstream-ready payments rail.
Solution
I built an escrow and dispute resolution layer extending Polygon's x402 protocol. Smart contracts are in Solidity 0.8.24, developed with Hardhat 2.22, and deployed to Polygon Amoy. The frontend uses Next.js 14 (App Router) with TypeScript, wagmi v2, and RainbowKit for wallet connections, and is deployed on Vercel.Partner technologies:Polygon x402: Extends the payment intent protocol with escrow and refundsHardhat: Development, testing, gas reporting, code coverage, custom CLI tasks, and network forkingGroq API: AI-powered dispute analysis with confidence scoringNotable implementations:Batch dispute resolution to reduce gas costs 1- 4-day timelock: receivers can claim after 14 days unless the sender completes earlierAdmin whitelisting with role-based access controlReal-time payment tracking via contract events and React QueryAI integration: Groq analyzes dispute reasons and suggests outcomes with fallback logicThe architecture separates concerns: smart contracts handle escrow and dispute logic, the Next.js frontend provides the UI, and custom wagmi hooks manage Web3 interactions. TypeChain generates type-safe contract bindings, and Hardhat's testing framework ensures >80% coverage. The system is production-ready with comprehensive error handling, input validation, and security best practices.
Hackathon
ETHGlobal Buenos Aires
2025
Contributors
- Potolski
17 contributions