HookPay

Pay-per-use API billing with off-chain micropayments via state channels.

HookPay

Created At

ETHOnline 2025

Project Description

Description: HookPay is a developer-focused CLI tool that enables API metering and per-call billing using off-chain state channels on the Yellow Network. It allows API providers to set rates (e.g., 0.001 USDC per call) and consumers to automatically pay as they use the API—no subscriptions, no gas per call, and instant settlement when the session ends. The project brings a Stripe-like experience for Web3 but focused on developer infrastructure (B2B) — ideal for metering AI inference, blockchain RPCs, or data feeds. It unlocks new forms of machine-to-machine micropayments, enabling use by IoT devices, drones, and autonomous agents.

Problem: Current issues with API billing: High transaction fees make pay-per-use impractical. Developers rely on subscriptions or prepaid credits, leading to capital lock-in. Dynamic, real-time pricing models (based on load, latency, etc.) are nearly impossible. No direct machine-to-machine payment infrastructure for autonomous systems. On-chain microtransactions (e.g., per-API-call) are too slow and costly.

Solution: HookPay introduces: ⚡ Off-chain, zero-fee micropayments through Yellow state channels (Nitrolite). 💡 True pay-per-use model: pay only for what you consume. 💸 Instant settlement after session close (hourly/daily). 🔄 Dynamic pricing—APIs can change cost on-the-fly based on usage metrics. 🤖 Autonomous payments—suitable for IoT, bots, and M2M systems. 🔓 Redeemable balance—users can withdraw unused funds anytime.

Innovation: We are not just “on-chain billing.” The innovation is in combining metering + off-chain settlement + CLI-based developer UX for: Real-time accounting without blockchain latency. Interoperability across any API (Web2 or Web3). Enabling autonomous economic agents to transact natively. Bringing usage-based billing to decentralized systems — something Stripe and AWS haven’t yet done natively on-chain.

Market: Primary: Developer infrastructure (API providers, SaaS platforms, data or AI APIs). Secondary: IoT, autonomous systems, trading bots, blockchain RPC services. Market trend: shift from subscriptions → usage-based → streaming payments. TAM: multi-billion-dollar API economy (~$180B by 2028) underserved in Web3.

Revenue model: 1–2% protocol fee per settlement. Premium CLI features for analytics, dashboards, and integrations (Stripe-like). Enterprise SDK/API licensing for larger API networks. Optional staking / slashing mechanism to secure payment channels.

How it's Made

HookPay is built with Node.js using the Yellow Nitrolite SDK to integrate state channels for off-chain micropayments. The core logic is split into two Node-based components: Consumer CLI – a lightweight command-line tool built with Node.js using commander.js for command parsing and ethers.js for wallet & signing. It interacts with Yellow’s SDK to open channels, stream signed state updates, and trigger settlement. [WIP] Provider Proxy – a Node.js microservice that connects to the Yellow SDK as a counterparty. It listens over WebSocket for signed API-call states, verifies signatures, executes the backend API, and updates the off-chain channel state in real time.

The CLI and proxy communicate through Yellow’s off-chain P2P messaging layer (ClearNode), while final settlement happens automatically through Yellow smart contracts that custody and release USDC based on the latest valid state.

Internally, the project handles: Channel session management using Nitrolite’s channel abstraction. Cryptographic signing of API call states via ethers.js. Off-chain message streaming through persistent WebSocket sessions. Automatic channel closure and dispute-proof submission via the Yellow SDK.

To test, a local ClearNode and faucet sandbox were used to emulate real channel behavior with mock APIs and microtransactions. The overall result is a self-contained CLI + proxy system that lets any developer wrap an API and start charging per-call instantly, with real-time off-chain metering and trustless on-chain settlement. Currently the project is a work in Currently, the project is a work in progress, with basic functionalities available as of now, focusing on stabilizing the SDK integration and expanding functionality given the large developer infrastructure market opportunity this model unlocks.

background image mobile

Join the mailing list

Get the latest news and updates