Skip to content

marketplace.v1 profile — P2P exchange inspired by Mostro #6

Open

Description

@melvincarvalho

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.v1 profile or embedding ratings in state.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions