Trickle: Budget-Capped Streaming Micropayments for Fiber Network
By Telmo ·
Hey everyone, sharing Trickle, my submission for the hackathon , and looking for feedback from people building on Fiber. 1. The Problem Fiber settles in milliseconds, but there's still no clean way to bill per unit on it. Two things get in the way: You can't open an HTLC hold for every token, every API call, or every second of usage. The hold locks up liquidity and eventually expires, and a stuck HTLC is a force-close waiting to happen. You can't put a confirmation prompt in front of a human for every fraction of a cent, so anything that wants true per-unit billing needs an authorization step that only happens once, not per tick. This shows up whenever someone wants to charge: Per token for AI inference Per call for an API Per megabyte for bandwidth or a CDN Subscriptions and other pay-as-you-go billing Agent-to-agent payments where an unattended process needs to spend under a ceiling Hold-invoice gateways solve escrow for usage you haven't spent yet. They don't solve settling usage that already happened, under a budget you can reuse across thousands of ticks. That's the gap Trickle fills. 2. How Trickle Works A grant is a signed, off-chain object with no cell and no on-chain footprint: {payee, asset, maxTotal, maxRate, sessionId, nonce, expiry} . The flow: User registers a passkey (or an M-of-N quorum is set up for delegated spending) User picks a budget and signs the grant digest once The grant is handed to an AllowanceSession , which calls stream() Each tick is a keysend send_payment carrying custom_records A local cap check refuses anything over maxTotal or maxRate before it ever reaches the node Keysend on fnn v0.8.1 is spontaneous (random payment_hash , preimage reveals at the far end), so a tick clears and closes on the spot, nothing stays open A SessionMeter on the receiving side watches the channel balance and releases service against value that has actually landed In a recorded run a tick round-tripped in about 150 to 200ms Hit the cap and the stream…