Access paid in work
An API or MCP server can charge per call in work, with no account and no API key.
The flow
A service states its price as a Z-bit. You pay with Sharenotes bound to that service. The four steps:
| Step | What happens |
|---|---|
| Price | an unpaid call gets 402 Payment Required and a Sharenote-Price header |
| Mine | you or a provider mine notes bound to the service, ahead of time |
| Pay | you repeat the call with the notes in a Sharenote header |
| Serve | the service checks them, marks them spent and serves |
Reading a price
Sharenote-Price: g=sha256d;z=12z00;epoch=7;until=1731003600;period=3600;max=16
This says: pay 12z00 of sha256d work, bound to epoch 7, which ends at that unix time. Epochs last an hour. At most 16 notes per call.
The binding
A payment note's binding is SHA-256(origin) followed by the epoch as 4 bytes. The origin is the scheme and host, like https://api.example, taken from the URL you called, never from the response. So a note pays only the service you chose. It is accepted in its own epoch and the next one, which lets you mine ahead.
Paying with several notes
Notes add by weight. Two 11z00 notes are 2^11 + 2^11 = 2^12, exactly a 12z00 price. A single 11z00 note is refused with amount. Value above the price is not refunded.
Cheap refusals
The service runs ten checks in order. The first nine hash no work: count, size, format, binding, algorithm, duplicates, the spent-set, the amount and the caller proof. Only then does it check each note's work. A replayed, duplicated, underpaying or oversized payment costs the service almost nothing.
Keyed mode
Without it, a note is a bearer payment: whoever presents it first spends it. That includes the provider that mined it and any proxy that sees it. With keyed=1, all notes must share one identity and the call carries a NIP-98 event signed by that identity, covering this exact request and these exact notes. A copied note is then useless.
Sessions and MCP
A service can sell a session: one payment returns a token that covers every call for a set number of seconds. MCP servers use the same headers over HTTP. Over stdio, the client binds notes to the backend origin in its own configuration, never one the server reports, and refuses to pay without one.
For AI agents this means a wallet of prepaid notes replaces a pile of API keys. Mine or order notes for the services you use, and pay each call as it comes.
A 402 round trip: price, mine, pay, get served, and replay to see 'spent'.
