$ |
Prepaid escrow accounts for variable-cost web3 payments over HTTP
# The Problem with Fixed Pricing
The exact scheme breaks down when costs are variable
Cost depends on token count — unknown before request
Cost depends on response size — unknown before request
Cost accrues over time — no fixed price possible
# Prepaid Escrow Accounts
Fund once. Pay for what you use.
step 1 :: Discovery
Client requests a resource, receives payment requirements including the facilitator's public key.
step 2 :: Account Creation
Client creates an escrow account governed by a dual-authorization contract. Both client and facilitator must co-sign transfers.
step 3 :: Funding
Client deposits tokens into the escrow account. A single account can hold multiple token types.
step 4 :: Session Key
Client registers a session key for signing payment authorizations. Works with any account type, including smart wallets.
step 5 :: Usage & Holds
Middleware places holds before work begins. Client authorizes via session key. Actual cost is settled after completion.
step 6 :: Settlement
Facilitator batches authorizations on-chain. Pending settlements have a configurable refund window before finalization.
| ASPECT | - exact | + flex |
|---|---|---|
| Payment timing | Per-request, upfront | Post-request, from prepaid balance |
| Amount knowledge | Must know before request | Determined after request |
| On-chain transactions | One per request | Batched settlements |
| Client complexity | Build and sign transactions | Fund account once, authenticate requests |
| Use cases | Fixed-price APIs | Metered usage, streaming, variable pricing |
[ok] Dual authorization — both client and facilitator must co-sign
[ok] Session keys — no private key exposure per request
[ok] Replay protection — monotonically increasing nonces
[ok] Refund window — time to cancel erroneous charges
[ok] Deadman switch — client recovers funds if facilitator goes offline
All checks passed. ✓
$ flex --participants
Client
Makes requests and pays for resources
Middleware
Gates access, generates payment requirements, receives payment
Facilitator
Validates payments, settles on-chain, co-signs escrow transfers
$ Ready to get started?