Guides

Payer modes

Who pays on chain for each session, and why the grant keeps the on-chain record with your wallet.

View as Markdown

Every session opens a payment channel on chain. The account that opens it is the channel's payer, recorded in the channel's agent field. floprouter has two ways to pay: grant and credit. You choose per key (new keys start in grant), and can override per request with "flop": {"payer": "credit"}.

Switch a key's mode on the account page or with PATCH /v1/auth/keys/{id} and {"payer": "grant"} or {"payer": "credit"}.

GrantBalance
Payer on chainyour walletthe router's wallet
What you signone grant, oncenothing per request
Escrow paid fromyour walletyour router balance
Router fee paid fromyour router balanceyour router balance
Best forpeople and agents that want the on-chain record in their own namequick scripts and agents

Every response says who paid, in flop.payer:

JSON
"payer": {"address": "5...", "kind": "session-key"}

kind is session-key when your wallet paid through a grant, and router-wallet when the router's wallet paid.

Live

You sign one extrinsic with your wallet: flopSessionKeys.createSession. It names a delegate key held by the router and sets limits: a total spending cap, a per-transaction limit, a daily cap, a duration in blocks, and the pallets the delegate may use. floprouter asks only for ComputeChannel.

After that, for each request, the router signs flopSessionKeys.executeViaSession with its delegate key. The chain runs the inner call, opening the channel, as your account. So:

  • The channel's payer on chain is your address, not the router's. The explorer shows your address as the payer.
  • The escrow comes from your wallet.
  • Your wallet signs nothing during the session. The router holds the per-channel session key and does everything after the open.

Grant mode opens channels only against a miner's signed offer. When no ready miner has a live offer, or the grant cannot pay, a grant-mode request fails. To have it run in balance mode instead, send "flop": {"fallback_payer": "credit"}. It is off by default, so your wallet stays the payer unless you ask otherwise.

What the delegate can and cannot do

  • It can open compute channels to any miner, at any escrow, within your caps. The chain enforces the caps.
  • It cannot transfer your funds or call anything outside ComputeChannel.
  • It stops working when the grant expires or when you revoke it with flopSessionKeys.revokeSession, signed by your wallet.

Limits

The chain limits how long a grant lasts and how many grants one delegate key can hold. GET /v1/grants/params returns the delegate address, the caps the router asks for (amounts), the chain's limits (limits), and the exact call to sign, both as call (pallet, method, arguments) and as encoded call_data. Without a key, pass ?address=<your address>. GET /v1/grants returns your grant's state: sessions left and expiry. After you sign, POST /v1/grants/sync asks the router to read it from the chain at once.

Shell
curl https://api.floprouter.com/v1/grants/params -H "Authorization: Bearer $FLOPROUTER_API_KEY"
curl https://api.floprouter.com/v1/grants -H "Authorization: Bearer $FLOPROUTER_API_KEY"
curl -X POST https://api.floprouter.com/v1/grants/sync -H "Authorization: Bearer $FLOPROUTER_API_KEY"

The account page does all three and builds the transaction for your wallet to sign.

Signing the same delegate again replaces the old grant, so renewing is the same one signature.

Balance mode (credit)

Live

The router's wallet opens the channel and the cost, escrow plus fee, is taken from your prepaid balance. Nothing to sign per request. On chain, the payer of each session is the router, not you.

What the current server offers

GET /health lists the payer modes the server offers in payer.modes, and the router wallet's address in payer.router_wallet. Every response says who actually paid, in flop.payer.