x402-chainlink

Empower AI agents, Web Clients and Machine-2-Machine workflows with gasless Web3 payments using this complete x402 and Chainlink CRE developer toolkit.
Top 12 Projects

What is it?

x402-chainlink is a comprehensive, self-custodian (user controls the funds) payment SDK and smart contract suite that functions as a decentralized "Stripe for Web3". At its core, it is a developer toolkit designed to bridge standard web protocols with blockchain settlement, specifically tailored for the rising "Agentic Economy". It is a developer toolkit that enables the seamless monetization of APIs, digital resources, and AI agent workflows using standard HTTP 402 (Payment Required) protocol. The entire system is secured by the Chainlink Runtime Environment (CRE), allowing for decentralized, trustless verification and settlement. It is designed to caters the "Agentic Economy" by supporting Machine-to-Machine (M2M) payments, allowing headless clients and AI agents to autonomously request and pay for premium resources.

What problem does it solve?

x402-chainlink addresses the fundamental friction points that prevent Web3 payments from achieving the seamless usability of Web2 systems like Stripe, while simultaneously bridging the gap for the emerging AI economy (Check out the demo example here: https://github.com/startup-dreamer/x402-chainlink/tree/master?tab=readme-ov-file#ai-agentbackend-workflow-example) The problems that this project solves are:

  • Friction in Web3 Monetization: Monetizing Web3 APIs typically forces developers to either build a centralized database to track user deposits or forces end-users to sign clunky, expensive on-chain transactions for every single API call.
  • Eliminates Centralized Middlemen: Instead of relying on a centralized payment processor or restrictive escrow contracts, the protocol allows users to maintain absolute custody of their funds.
  • Gasless User Experience: It solves the UX hurdle of paying network gas fees by utilizing EIP-2612 token permits, which eliminates the need for users to execute separate, expensive "Approve" transactions.
  • Interoperability: It solves the need for heavy local RPC infrastructure, as the Chainlink CRE inherently observes multiple networks (Polygon, Base, Ethereum, etc.) to verify payments chain-agnostically.

How does it work?

The SDK abstracts the complexities of EIP-712 signatures, EIP-2612 permits, and smart contract execution into a fast, four-phase sequence based on the standard HTTP request-response cycle (see this diagram for detailed flow: https://github.com/startup-dreamer/x402-chainlink/tree/master?tab=readme-ov-file#architecture--protocol-flow):

  • Discovery & Payment Request: A client (or AI agent) attempts to fetch a protected API resource. The API server intercepts this and responds with an HTTP 402 Payment Required status, attaching the specific payment requirements in the headers.
  • Payment Authorization: The client decodes these requirements. The user's wallet (or the AI agent's funded hot wallet) generates an off-chain cryptographic signature using EIP-712 to authorize the payment intent, alongside an optional EIP-2612 signature for gasless token approval.
  • Verification & Settlement via Chainlink CRE: The client retries the API request, including the signed payload in a PAYMENT-SIGNATURE header. The API forwards this payload to the Chainlink CRE.
  • Off-chain: The CRE trustlessly verifies the EIP-712 signature and checks the user's token balance.
  • On-chain: The Chainlink node broadcasts a settlement report to the X402Facilitator smart contract, which executes the immutable token transfer from the payer to the recipient.
  • Secure Resource Delivery: Once the CRE confirms the successful transaction, it returns a workflow response to the API. The API then returns a 200 OK status and delivers the premium data/resource to the client.

I have wrote a detailed readme as well explaining everything here: https://github.com/startup-dreamer/x402-chainlink/

A Chainlink Hackathon  //  Feb 6 – Mar 8