Skip to content

0.3.0: sell as many days as a crawler wants in one payment - #4

Merged
ralyodio merged 1 commit into
mainfrom
multi-day
Sep 5, 2026
Merged

ralyodio merged 1 commit into
mainfrom
multi-day

Conversation

@ralyodio

@ralyodio ralyodio commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What

A crawler could only buy one term per proof. Now ?days=N on the sales page or any gated URL quotes N terms at N times the price, and the days a proof buys are read off the value it authorizes: a whole number of day-prices, up to maxDays (default 30). The pass expires days × passMinutes after the sale.

  • ?days=7 → offer of 7 × price; a standard client paying exactly that gets a 7-day pass
  • a proof for 3 × price on a plain URL → 3-day pass; the money decides, not the URL
  • a value that is not a whole multiple → 402 with the per-day unit, before CoinPay is asked
  • over maxDays → 402
  • replayed multi-day proof bounded by its validity plus the days it bought

Receipt gains days/minutes; the 402 pass object gains days, total, maxDays, buyDays; onSale gains days, totalCents. Page and README updated. daysPaid, paidValueOf exported.

Tests

50 pass (12 new in test/days.test.js).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NSGS7Sy3QmEgTNZDg4eq7g

The gateway sold exactly one term per proof and minted every pass for
`passMinutes`. A crawler that wanted a month paid every morning, and one
that wanted to pay for the month up front had no way to say so.

Two ways in, one rule. `?days=N` on the sales page, or on any 402'd URL,
quotes N terms at N times the price, so a standard client that pays exactly
what the offer asks gets N days. And the days a proof buys are read off the
value it authorizes -- a whole number of day-prices, at most `maxDays`
(default 30) -- so paying three times the price buys three days however it
was asked for, and a value that is not a whole number of days buys nothing
before CoinPay is asked. The pass expires `days * passMinutes` after the
sale; a replayed proof is bounded by its own validity plus the days it
bought, as before. The money decides, not the URL: `?days=7` and a proof
for two days is two days, and CoinPay is asked to verify exactly the value
that was signed, against the offer for that many days.

The receipt carries `days` and `minutes`; the 402 body's `pass` object
carries `days`, `total`, `maxDays` and a `buyDays` template; `onSale` gets
`days` and `totalCents` beside the per-day `priceCents`. The page explains
it and shows the CLI line for a week. New `maxDays` option; `daysPaid` and
`paidValueOf` exported.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSGS7Sy3QmEgTNZDg4eq7g
@ralyodio
ralyodio merged commit 8f9d4ec into main Sep 5, 2026
6 checks passed
@ralyodio
ralyodio deleted the multi-day branch September 5, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant