Skip to content
Ghostline

For API sellers

Charge per call. Settle once.

Put the Ghostline paywall in front of an API. Agents pay each call with a voucher you verify locally, with no chain round-trip. When you’re ready, one transaction collects everything.

Pricing
Fixed, per request or metered
Price step
100 µT
Protocol fee
1% of your payout
Settle fee
≈ 28,808 µT, paid by you

1 · Quote

Answer with a 402.

An unpaid request gets a quote. This example uses placeholder keys and illustrative expiry bounds. The payer checks the scheme, the channel and your key before it signs anything, and binds its voucher to your payout key.

Use the reference server below, or the ghostline-paywall Rust crate for your own routes and pricing.

http
HTTP/1.1 402 Payment Required

{
  "scheme": "ghostline.channel.voucher.v1",
  "price": 300,
  "basis": "metered",
  "unit_price": 100,
  "units": 3,
  "channel_id": "<64 hex>",
  "recipient_key": "<64 hex>",
  "service_output_key": "<64 hex>",
  "min_expiry_epoch": 38578,
  "max_expiry_epoch": 38778
}

2 · Serve

Verify, record, respond.

Each voucher must raise the total and stay under the deposit. The server writes it to the ledger before it serves the response. Replaying the latest voucher charges nothing.

bash
ghostline-paid-api serve --bind 127.0.0.1:8787 \
  --ledger ledger.json --price 1000 \
  --service-key-hex <service-public> \
  --service-output-key-hex <payout-key> \
  --min-expiry-epoch <epoch> --max-expiry-epoch <epoch + 200>

3 · Settle

Collect before expiry.

Dry-run, then submit with the quoted fee. Without --force, settle waits until the channel is close to expiry. Your payout lands on a one-time key your own wallet recognises, so it shows up like any other payment.

Settle before the expiry epoch. After it, the payer can refund the whole deposit and your accepted calls are unpaid.
Settling and payouts →
bash
ghostline channel settle --file channel.json --force --submit --dry-run \
  --seal-key-id-file service-key-id.json --max-fee 100000

ghostline channel settle --file channel.json --force --submit \
  --seal-key-id-file service-key-id.json --max-fee <required_fees + margin>