Q402 (Sign-to-Pay) Protocol
The Q402 protocol is Quack AI’s gasless payment infrastructure for EVM chains, built on EIP-7702 + EIP-712. It replaces the traditional “approve → transfer → pay” pattern with a single signature flow that is:
Gasless for users (Q402 relayer sponsors all gas fees)
Works with any ERC-20 (no token upgrades, no ERC-3009 dependency)
Policy-aware (spend limits, expiry, whitelists, jurisdictional rules)
Fully verifiable (on-chain receipts via X-PAYMENT-RESPONSE headers)
Roadmapped for x402 ecosystem interoperability (future releases)
This system forms the execution backbone of Quack AI’s AI Economy — powering governance automation, agent-to-agent transactions, and RWA settlements across 7 EVM mainnets.
For developers, the entire implementation — including core contracts, SDKs, middleware, and facilitator services — is available here:
🔗 GitHub: github.com/bitgett/Q402-Institutional
🔗 Live Platform: https://q402.quackai.ai
📖 SDK: v1.6.0 · Manifest: v1.6.0
📧 Contact: business@quackai.ai
Repository Structure
The Q402 repository is organized into modular packages for flexible integration:
/packages/core
Core SDK and client utilities for creating and signing Q402 payment headers
TypeScript
/packages/facilitator
Standalone gas relay and settlement service for executing delegated transactions
Node.js / Docker
/packages/middleware-express
Express.js middleware for instant 402 payment validation
TypeScript
/packages/middleware-hono
Lightweight middleware for Hono-based APIs
TypeScript
/examples
Demo apps showing how to integrate Q402 with APIs or dApps across 7 EVM mainnets
JavaScript / Express
/docs
Architecture, standards, and deployment guides
Markdown
/specs
Core EIP-7702 implementation logic
Solidity + TS bindings
Each package is published under the @q402 namespace and can be installed independently via pnpm or npm.
Core Developer Flow
Developers can use the Q402 stack through three main integration paths:
Client SDK
Apps or wallets generating sign-to-pay transactions
@q402/core
Server Middleware
APIs requiring payment validation or premium access
@q402/middleware-express or @q402/middleware-hono
Facilitator Service
Independent relay handling verification and gas sponsorship
@q402/facilitator
All flows support EIP-712 + EIP-7702 standards, use short-lived authorization tuples, and output a verifiable X-PAYMENT header that can be traced on-chain.
Example Use Cases
Gasless API access (e.g., premium endpoints)
Express middleware using @q402/middleware-express
DAO proposal execution with policy checks
Governance API + Facilitator
RWA payouts and treasury automation
Governance API + Q402 SDK
Subscription renewals for data agents
Facilitator + EIP-7702 integration
Merchant or marketplace settlement
Batch transactions via Facilitator Service
Each transaction includes a receipt hash linking signature → transaction → policy execution — providing a transparent audit trail for compliance and governance monitoring.
Last updated