Repository navigation
Open
Description
Summary
Define a marketplace.v1 web contract profile for peer-to-peer Bitcoin↔fiat (or token↔token) exchange, inspired by Mostro.
Motivation
Mostro proves that Nostr-native P2P exchange works. Their state machine is straightforward — 6 transitions, hold-invoice escrow, dispute resolution. This maps cleanly to a web contract profile.
The difference: Mostro is a fixed protocol for one use case. A web contract version is programmable, composable, and runs on any executor (pod, server, local).
Mostro Architecture (for reference)
| Component | Mostro | Web Contract equivalent |
|---|---|---|
| Executor | Mostrod daemon | Contract executor on JSS/pod |
| State publication | Nostr kind 38383 | state.json (HTTP) or addressable event (Nostr) |
| Commands | NIP-59 encrypted messages | NIP-98 HTTP POST or NIP-59 |
| Escrow | Lightning hold invoices | Webledger debit (lock funds) |
| Dispute | Admin/solver with tokens | Arbiter role with DID identity |
| Reputation | 5-star progressive rating | Could extend or compose with a reputation.v1 profile |
Proposed Transitions
| Transition | Actor | Description |
|---|---|---|
create-order |
seller | Post sell order, funds debited to escrow |
take-order |
buyer | Accept order, status → active |
fiat-sent |
buyer | Declare fiat payment sent |
release |
seller | Confirm fiat received, credit buyer |
cancel |
either | Cooperative cancel (before fiat-sent) |
dispute |
either | Open dispute, arbiter notified |
resolve |
arbiter | Settle dispute, credit winner |
State Shape (sketch)
{
"contract": "marketplace-xyz",
"seq": 12,
"prev": "...",
"orders": [
{
"id": "order-1",
"seller": "did:nostr:abc...",
"buyer": "did:nostr:def...",
"amount": 50000,
"currency": "tbtc4",
"fiat": { "amount": 25, "currency": "USD" },
"status": "active",
"arbiter": "did:nostr:ghi..."
}
]
}What Mostro does differently
- Lightning hold invoices — real BTC escrow with automatic timeout. We'd use webledger locks instead.
- NIP-44 peer chat — Mostro enables encrypted chat between buyer/seller once a trade is active. We could reference this but it's out of scope for the contract itself.
- Reputation — Mostro has a progressive 5-star system. Consider composing with a separate
reputation.v1profile or embedding ratings in state.
References
- Mostro docs
- Mostro GitHub
- trustline.v1 profile — Ryan Fugger's original Ripple as a web contract #4 (trustline.v1 — related multi-party profile)
- Nostr transport — discover and interact with contracts via relays #2 (Nostr transport — Mostro uses kind 38383 + NIP-59)
Metadata
Metadata
Assignees
Labels
No labels
Activity