Payout Receipts
A signed receipt of who gets what and which notes counted, so anyone can audit an offer's payout.
Summary
When an issuer splits an offer's reward, it publishes a signed receipt: who gets how much, and exactly which notes it counted. Anyone holding the offer can check that the amounts follow from the stated weights.
With the notes from the offer's relays, anyone can check the weights. Anyone holding a note the receipt leaves out can name it as an omission. A false receipt is proven by the issuer's own signature.
issuersworkersauditors
Kinds and tags
| Kind | Name | How |
|---|---|---|
| 1727 | Receipt | signed by the offer's issuer, published to every relay the offer names |
| 14 | Destination request (NIP-17) | gift-wrapped DM asking for a BOLT11 invoice |
| Tag | Meaning |
|---|---|
| e | the offer id; exactly one |
| reward | equal to the offer's reward; exactly one |
| pay | identity, amount, weight, min H; one per identity |
| n | algorithm:H of one counted note; one per note |
| closed | cutoff, only for an offer without closes |
The receipt
A kind:1727 event with empty content, signed by the offer's issuer.
pay:[identity, amount, weight, min H], one per identity with at least one counted note, even if its amount is 0.weightsums the SNP-01 weightsfloor(2^384 / T);min His the tie-breaker.n:<algorithm>:<H>, H in 64 lowercase hex. A note is named by its key, never by event id.- No two
paytags share an identity or amin H.
The cutoff is when the issuer stopped counting: the offer's closes, else closed, else the receipt's created_at. A receipt exists only for a valid offer with a reward and at least one counted note. Readers find it with {"kinds":[1727], "authors":[<issuer>], "#e":[<offer id>]}.
What the issuer must do
A receipt is malformed, and ignored, if it is not signed by the issuer, has non-empty content, points to an offer without a reward, has closed while the offer has closes, or has a tag missing, repeated or ill-formed.
The issuer must make a well-formed receipt true:
rewardequals the offer's;- amounts follow the SNP-01 split and add up to exactly the reward;
- one
nper counted note, each answering the offer; - weights and
min Hmatch those notes; - every counted note is published to the offer's relays.
Once it publishes a receipt, the cutoff is fixed. Two receipts for one offer with different reward, pay, n or cutoff are an equivocation.
Auditing
| Finding | Needs notes | Means |
|---|---|---|
| amounts do not follow from the receipt's weights | no | provably false |
reward differs from the offer's | no | provably false |
| a key listed twice | no | provably false |
| two receipts differ in reward, pay, n or cutoff | no | equivocation, naming both |
| a listed note does not answer the offer | yes | provably false |
| weights or tie-breakers differ from the notes | yes, all | provably false |
| a listed note found nowhere | yes | unverified |
| an answering note on the relays before the cutoff is not listed | yes | omission |
| an answering note not known on the relays before the cutoff | yes | late; nothing against the issuer |
An auditor holding several receipts audits each against the latest cutoff.
Omission or late
No auditor can know when the issuer first saw a note. So an unlisted note is an omission only if the auditor knows it was on one of the offer's relays before the cutoff: a worker from the relay's OK when it published, anyone from having fetched it there.
Otherwise the note is late. It may have reached the issuer too late to count, and that is no claim against the issuer.
An omission is not proof of fraud: the issuer may say the note never reached it. But whoever holds the note can name it. An issuer gains nothing by republishing with an earlier cutoff: no omission turns late, and the pair proves equivocation.
Asking for a destination
An issuer pays each identity at its SNP-03 Pay announcement. If an identity has no destination for a method the issuer uses, and the unit is sat or msat, the issuer may ask once per receipt by a NIP-17 kind:14 DM tagged p (identity), e (receipt id) and amount.
The identity answers with a kind:14 DM tagged ["e", <request rumor id>] whose content is a BOLT11 invoice. The issuer pays it only if it is for exactly that amount, on the right network, and no invoice was paid for that request before. Until paid, the amount stays owed.
Each n tag is about 80 bytes. Relays often cap events near 64 KB, so a receipt holds several hundred notes; an issuer expecting more sets a larger z.
Worked example
An offer asks for sha256d notes of at least 8z00 and rewards 1000 sat. Alice publishes 8z00 and 9z00 (weight 768), Bob 10z00 (1024), Carol 9z00 (512). Total 2304.
| Receipt | Audit |
|---|---|
| counts all four notes; pays Alice 333, Bob 445, Carol 222 | consistent |
| counts only Alice's and Bob's; pays 429 and 571 | consistent; Carol's 9z00 named as omitted |
| counts all four; pays Alice 383, Bob 395, Carol 222 | provably false: the split gives 333 and 445 |
Why 333/445/222: the floors are 333, 444 and 222, which sum to 999. The leftover unit goes to the largest remainder, Bob's (1000 · 1024 mod 2304 = 1024, against 768 for Alice and 512 for Carol).
Try it
Audit a receipt
Check a payout receipt against the notes. Break it and see what gets caught.
Work offer
Compose an offer and watch work on a post add up into a reward split.
Rendered from soprinter/snps/SNP-05.md. The full text has every rule; this page condenses it.
