A decentralized pay-per-request HTTP 402 proxy billing gateway for Cardano microservices and AI inferences.
Explore the docs »
Video Demo
·
Report Bug
·
Request Feature
- Presentation: https://drive.google.com/drive/folders/1BoKdu_fDpn0qHoszn8SbSdppP0XQ72iT?usp=sharing
- Video Walkthrough: https://drive.google.com/drive/folders/1dghSpZDKvYgrfFe1V5ZJHGW_5xFdT0cK?usp=sharing
Table of Contents
C402 is an implementation of the HTTP 402 (Payment Required) standard designed for the Cardano blockchain ecosystem. It acts as an intercepting proxy billing gateway that guards pay-per-request API resources, such as machine learning completions or web scraper outputs, demanding micropayments (Lovelaces) before serving client queries.
Key capabilities:
- Decentralized Proxy Interception: Instantly responds with
HTTP 402 Payment Requiredheaders containing payout addresses, pricing models, and signature challenge references. - Double-Spend Mitigation: In-memory tracking lists protect developers from replay attacks and multiple reuse of transaction proofs.
- Preprod Sync Verification: Directly queries Cardano ledger mempool state to authorize endpoint execution in milliseconds.
- SAT Satisfaction Audio Toggle: satisfies the Buddhsentripathi-style Centered glassmorphic design theme with Web Audio API click sound toggles.
- Vite & React 18: Lightweight SPA dashboard interface.
- Node.js & Express: Gateway proxy intercepting middleware.
- Aiken: Cardano smart contracts validator.
- Framer Motion & Lucide Icons: Responsive animation layers.
Follow these steps to run the gateway and sandbox playground locally.
- Node.js v18 or later.
- npm or yarn.
- Lace Wallet Chrome Extension configured for the Cardano Preprod testnet.
- Clone the repository:
git clone https://github.com/Premkumar1845/ProofPair.git cd ProofPair - Install dependencies:
npm install
- Spin up both servers:
- Run the Express server (
backend/):npm run start
- Run the Vite dev server (
root/):npm run dev
- Run the Express server (
- Open the website at
http://localhost:5174/and navigate to the Sandbox Playground. - Select Llama-3 Coder API and trigger Call Protected API to fetch the 402 challenge.
- Paste a Cerebras API Key into the configuration panel to unlock live Llama-3 completions.
- Connect a Cardano preprod-configured Lace wallet and click Sign Payment.
- Approve the signature payload in the Lace extension.
- Click Call Protected API again to submit the transaction token and unlock the code generation response.
- Copy the following valid Preprod testing transaction hash:
2dc9ad62dc9ad62dc9ad62dc9ad62dc9ad62dc9ad62dc9ad62dc9ad62dc9ad62c402
- Configure modular Vite React frontend router
- Implement CIP-30 connection and CBOR-to-Bech32 decoders
- Deploy Node/Express gateway proxy with 402 headers support
- Set up double-spend caching replay verification list
- Integrate live Cerebras Llama-3 code generations
- Add dynamic Blockfrost testnet block height checks
- Implement full client-side ledger transaction serialization
See the open issues for a full list of proposed features and known bugs.
Contributions are welcome. Please adhere to these guidelines:
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the Branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.
Hemanth - hemanthme.in
Prem Kumar - @Premkumar1845
Project Link: https://github.com/Premkumar1845/ProofPair