Skip to content

About

Nostr commerce scenarios in TypeScript. Payments, escrow, reviews, subscriptions, carts, and disputes.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

nostr-commerce-skill

An agent skill for building commerce on Nostr and Lightning. It maps a plain request ("add escrow to checkout", "let fans subscribe") to one of 79 scenarios, each checked against the current NIPs with a test harness.

CI scenarios verified NIPs licence

79 scenarios in 24 categories · 75 verified · 0 failed · 4 unverified

Who it's for: developers building shops, marketplaces, creator payments, paid relays or paying agents on Nostr, and the coding agents that help them.

Contents

Install

With the skills CLI (works with Claude Code, Cursor, Codex and other agents that read SKILL.md):

npx skills add welliv/nostr-commerce-skill
# pick agents explicitly, or install for all your projects with -g
npx skills add welliv/nostr-commerce-skill -a claude-code -a cursor

Or copy it by hand into your agent's skills folder:

git clone https://github.com/welliv/nostr-commerce-skill .claude/skills/nostr-commerce

For other agents, clone it into that agent's skills folder, or point the agent at SKILL.md. It is plain Markdown with YAML frontmatter, following the Agent Skills format.

Then ask, for example: "Let buyers pay on delivery with a hold invoice" or "Add labelled sponsored listings that don't change ranking".

How it works

  1. The agent reads only the name and description in SKILL.md until a Nostr or Lightning task comes up.
  2. It then loads SKILL.md (about 130 lines): the rules, the workflow, the safety rules and a one-line map of all 79 scenarios.
  3. It opens just the one reference file it needs, for example references/escrow.md, and builds from that scenario's flow.

Each scenario has the same fields: what it does, a use case, who is involved, NIPs and event kinds, payment rail, trust and privacy notes, spec status, test result, the flow step by step, attacks and fixes, gaps and sources.

Scenarios by category

Category Scenarios Verified
Identity ID-01 ID-02 ID-03 ID-04 ID-05 5/5
Listing LS-01 LS-02 LS-03 LS-04 LS-05 LS-06 LS-07 LS-08 LS-09 LS-10 LS-11 LS-12 12/12
Discovery DS-01 DS-02 DS-03 DS-04 DS-05 DS-06 6/6
Pricing PR-01 PR-02 PR-03 PR-04 3/4
Negotiation NG-01 NG-02 NG-03 3/3
Checkout CO-01 CO-02 1/2
Payment PY-01 PY-02 PY-03 PY-04 PY-05 PY-06 PY-07 PY-08 PY-09 PY-10 PY-11 PY-12 PY-13 13/13
Escrow ES-01 ES-03 2/2
Disputes ES-02 0/1
Delivery DL-01 DL-02 DL-03 DL-04 4/4
Receipts RC-01 RC-02 2/2
Compliance and tax RC-03 AD-02 2/2
Reviews RV-01 RV-02 RV-03 3/3
Returns and refunds DR-01 DR-02 2/2
Affiliate AF-01 1/1
Labelled promotion AD-01 1/1
Auctions AU-01 1/1
P2P P2-01 1/1
Memberships and paid relays MB-01 MB-02 MB-03 3/3
Licensing LC-01 LC-02 1/2
Agent-to-agent AG-01 AG-02 AG-03 3/3
Marketplaces and curation MP-01 MP-02 MP-03 3/3
Privacy CP-01 PV-01 2/2
Analytics AN-01 1/1
All 79 scenarios in one table
ID Scenario What it does Spec status Test
ID-01 Merchant or creator profile with verifiable identity Let a buyer check who a seller is before paying. final ✅ verified
ID-02 Declare where to be paid (payment targets) Tell payers every rail you accept, in one place. draft ✅ verified
ID-03 Key custody for shops, staff and agents Sign listings and orders without spreading the shop key to every device or bot. draft ✅ verified
ID-04 Connect a wallet with a spending budget Let an app or agent pay, but only up to a limit. draft ✅ verified
ID-05 Set up an ecash wallet and choose mints Hold small amounts of ecash for tips and micro-payments, with mint choice informed by people you trust. draft ✅ verified
LS-01 Simple classified listing (sell one thing) Put an item or service up for sale and mark it sold later. draft ✅ verified
LS-02 Structured shop catalogue with stock, variants, collections and shipping Run a real shop: stock levels, product types, collections and shipping zones. draft + external spec ✅ verified
LS-03 Drafts and inactive listings Prepare listings privately and park unsold ones. draft ✅ verified
LS-04 Legacy NIP-15 stalls, products and checkout (migrate away) Read old NIP-15 shops and move them to NIP-99 / market-spec. unrecommended ✅ verified
LS-05 Services, gigs and job offers Offer time-based work (per hour or per month). draft ✅ verified
LS-06 Rentals and bookable time slots Rent a room, tool or studio for set dates. draft ✅ verified
LS-07 Event tickets Sell entry to a gig or conference and check people in. no spec yet ✅ verified
LS-08 Digital files for sale (ebooks, samples, stems) Describe a file by its hash so buyers know exactly what they get. draft ✅ verified
LS-09 Music tracks and releases Publish a track with credits and payment splits that any player can read. PR only ✅ verified
LS-10 Podcasts with value-for-value Publish a show and episodes that listeners can tip. draft ✅ verified
LS-11 Limited-time offers, delisting and corrections Make an offer expire on its own, and remove listings cleanly. draft ✅ verified
LS-12 Storefront website hosted on Nostr Give a shop its own website without a host. draft ✅ verified
DS-01 Search and filter listings (text, tags, place) Find items by words, category or area. draft ✅ verified
DS-02 Find a seller's whole catalogue across relays Load everything a shop sells from the right relays. draft ✅ verified
DS-03 Curated lists, gift guides and marketplace front pages Let anyone (a shop, a fan, a marketplace) publish a curated shelf of products. draft ✅ verified
DS-04 Wishlists and saved carts Save items to buy later, publicly (gift list) or privately. draft ✅ verified
DS-05 Rank sellers by web of trust Sort results by how trusted the seller is in your network, not by who paid. draft ✅ verified
DS-06 Pick an app that can open a listing Open any product link in a shop app the buyer likes. draft ✅ verified
PR-01 Fiat-priced items paid in bitcoin Price in EUR or JPY, take sats at checkout. draft ✅ verified
PR-02 Custom quote or request for quote Agree a bespoke price privately. draft + external spec ✅ verified
PR-03 Pre-order demand test with a poll Ask fans which variant or price they would buy before making it. draft ✅ verified
PR-04 Discount codes and coupons Give a code that lowers the price at checkout. no spec yet ⚠️ unverified
NG-01 Private buyer–seller chat Ask questions and agree terms without the world seeing. draft ✅ verified
NG-02 Public questions and answers on a listing Ask in public so other buyers see the answer. draft ✅ verified
NG-03 Shop community and support group Run a customer group with moderators. draft ✅ verified
CO-01 Private order, payment request and status (market-spec checkout) Place a multi-item order with shipping and get a payment request, all encrypted. draft + external spec ✅ verified
CO-02 Public order-state and escrow events (PR #2323) Show order and escrow state publicly so third parties can arbitrate. PR only ⚠️ unverified
PY-01 Pay an invoice from the app (NWC) and notify the merchant Pay a Lightning invoice in one tap, and let the shop know it arrived. draft ✅ verified
PY-02 Public tips (zaps) Tip a post, profile or listing publicly. draft ✅ verified
PY-03 Automatic revenue splits Split each payment between co-creators, label, or a referrer. draft ✅ verified
PY-04 Ecash tips and payments (nutzaps) Send ecash locked to the recipient, verifiable offline. draft ✅ verified
PY-05 Crowdfunding goals Raise a target amount and show progress. draft ✅ verified
PY-06 Recurring subscriptions and memberships Pay a creator or service every month without re-approving each time. PR only ✅ verified
PY-07 Streaming payments (pay per minute) Pay a few sats per minute while listening or watching. draft ✅ verified
PY-08 Pay per use for an HTTP API (402) An agent pays per request to an API, with no account. PR only ✅ verified
PY-09 Bounties and contract work Post a task with a reward, pay on delivery, with an arbiter. PR only ✅ verified
PY-10 Reusable offers: BOLT12 and BIP-321 Publish one static code that can be paid many times, with better privacy than a Lightning address. PR only ✅ verified
PY-11 Spending caps for agents Let an AI agent buy things, but stop it at a set budget. draft ✅ verified
PY-12 On-chain payments Pay large amounts on-chain and show it publicly if wanted. PR only ✅ verified
PY-13 Ecash payment requests over Nostr Ask for an exact ecash payment and receive it privately. draft ✅ verified
ES-01 Hold-invoice settlement (pay now, release on delivery) Lock the buyer's payment and only take it when the condition is met; otherwise it returns by itself. draft ✅ verified
ES-02 Arbitrated escrow and disputes A neutral arbiter decides who gets the money when a deal goes wrong. PR only ⚠️ unverified
ES-03 Ecash escrow with 2-of-3 multisig and timeout refund Hold payment in ecash that needs two of buyer, seller, arbiter to release, and returns to the buyer after a deadline. draft ✅ verified
DL-01 Encrypted digital file delivery Send the bought file so only the buyer can open it. draft ✅ verified
DL-02 Members-only content behind a relay (exclusive content) Show posts only to paying members, with no app lock-in. PR only ✅ verified
DL-03 Shipping updates for physical goods Tell the buyer it shipped, with tracking. draft + external spec ✅ verified
DL-04 Paid live streams and events Charge for watching a live show. draft ✅ verified
RC-01 Private receipt with proof of payment Give the shop proof you paid, privately. draft + external spec ✅ verified
RC-02 Public payment attestations and timestamps Show publicly that something was paid or existed at a time. unrecommended ✅ verified
RC-03 Merchant books, tax and accounting records Keep records for tax without publishing sales. draft ✅ verified
RV-01 Product and seller reviews Rate what you bought so others can judge. draft + external spec ✅ verified
RV-02 Trust badges and labels for sellers A marketplace or community vouches for a seller in a way anyone can check. draft ✅ verified
RV-03 Reporting scams and illegal goods Flag fraud, malware or illegal listings. draft ✅ verified
DR-01 Refunds Send money back to a buyer. no spec yet ✅ verified
DR-02 Returns and order cancellation Cancel an order or send goods back. draft + external spec ✅ verified
AF-01 Affiliate and referral rewards Pay someone who brought a buyer. no spec yet ✅ verified
AD-01 Clearly labelled sponsored placement Let a seller pay to be shown, with a visible label, without changing ranking. no spec yet ✅ verified
AD-02 Age-restricted and sensitive goods Warn before showing adult or risky items. draft ✅ verified
AU-01 Auctions Sell to the highest bidder before a deadline. unrecommended ✅ verified
P2-01 Peer-to-peer bitcoin–fiat trading Buy or sell bitcoin for local money with no exchange account. draft ✅ verified
MB-01 Paid relay access (admission, subscription, per-kind publication fee) Charge to read or write on a relay. draft ✅ verified
MB-02 Relay membership by invite or claim Join a members-only relay with an invite code (for example after paying). draft ✅ verified
MB-03 Paid private groups Sell access to a private chat group. draft ✅ verified
LC-01 Declare the licence of a work State the terms under which a track, image or text can be used. draft ✅ verified
LC-02 Buy a licence and get a checkable certificate Pay for a sync or commercial licence and prove it later. no spec yet ⚠️ unverified
AG-01 Paid jobs between agents (DVM style) Ask any provider to do a job and pay for the result. unrecommended ✅ verified
AG-02 Commands as small paid services Call a bot or service by a typed command. draft ✅ verified
AG-03 Agents find and contract paid services Agents discover priced services and agree terms. PR only ✅ verified
MP-01 Marketplace run as a relay with flat shelf fees Run a marketplace that charges sellers a flat fee to list, with no cut of sales. draft ✅ verified
MP-02 Relay moderation API for marketplace operators Ban scam listings and manage members remotely. draft ✅ verified
MP-03 Anti-spam for listings (proof of work) Make mass spam listing costly without charging money. draft ✅ verified
CP-01 Erasure and retention (right to be forgotten) Remove personal data and old orders from relays. draft ✅ verified
AN-01 Shop analytics Count views, zaps and interest without tracking buyers. draft ✅ verified
PV-01 Private payments and order metadata Keep who-bought-what hidden from relays and observers. draft ✅ verified

Looking for an event kind? See references/kinds-index.md. Need machine-readable data? See data/scenarios.json and data/results.json.

Status legend

Mark Meaning
✅ verified The harness built the scenario's events, ran them through a local test relay and every tag passed the spec rules.
⚠️ unverified No runnable check, because no spec defines the events yet. Building one would mean inventing a kind.
final / draft Status of the NIPs the scenario uses.
draft + external spec Also relies on a spec outside the NIPs repo (market-spec, NWC extensions, Cashu NUTs, x402).
PR only The format exists only in an open NIP pull request and may change.
unrecommended The NIP is marked unrecommended. Read it for old data, but don't build new things on it.
no spec yet Nothing defines it. The scenario says what to do instead.

A pass means the events and flows match the specs. It does not mean any particular app supports them.

What changed from v2 (22 → 79)

  • Every original scenario was rebuilt from the spec text. All 22 map onto new IDs, and 44 scenarios are new (tickets, rentals, ecash, BOLT12, refunds, returns, paid relays, licensing, agent-to-agent and more).
  • Wrong in v2: #8 escrow, #9 proof of payment, #10 reviews, #22 disputes. Outdated: #2 listings, #15 subscriptions, #20 paid APIs. Replaced: #17 percentage platform fees (now flat fees) and #18 zapvertising (now labelled promotion).
  • Known v2 bugs are fixed in the guidance: /.well-known/ written with a space, zap receipts trusted without checks, preimages published in reviews, paid APIs with no spending cap, and ordinary invoices sold as hold invoices.
  • The v2 TypeScript library is retired. It is still available at tag v2.0.1.

Full table and fixes: MIGRATION.md.

Important notes

  • NIPs are pinned to commit d47a2ec. NWC extensions, Cashu NUTs and market-spec are pinned in each scenario's sources.
  • Payments are mocked in the tests. Invoices have the right shape and real preimage and hash pairs, but no money moves.
  • Kind 31402 is contested. Open NIP PRs #2291 and #780 both propose it for paid-API announcements. Don't use it for anything else.
  • No merged spec yet for coupons, licence certificates, multi-seller carts, or public order and dispute events. The skill says so rather than inventing kinds.

Run the tests

npm install
npm test             # 79 scenarios plus a harness self-test
npm run check:docs   # generated docs match the data
npm run check:links  # every internal link resolves

After changing a scenario in tests/lib/, run npm run refresh to rewrite data/ and the generated docs.

Repository layout

SKILL.md                 entry point for agents (lean; links to references)
references/              one file per category, plus kinds-index.md and framework-patterns.md
data/                    scenarios.json, results.json, stories.json, v1-map.json
tests/                   vitest suites; tests/lib has the harness, test relay, spec rules and scenarios
scripts/                 build-docs.mjs (generates docs from data), check-links.mjs
MIGRATION.md             v2 → v3 map and bug fixes
CHANGELOG.md

Contributing

See CONTRIBUTING.md. In short: cite the spec text for every rule, use throwaway keys, keep example people to Alice, Bob, Carol, Dave, Mallory and Eve, and never invent a kind.

Licence

MIT.

About

Nostr commerce scenarios in TypeScript. Payments, escrow, reviews, subscriptions, carts, and disputes.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages