OmniLayer / spec

Omni Protocol Specification (formerly Mastercoin)
The Unlicense
341 stars 116 forks source link

A semi-automatic hybrid mechanism to enable a two-sided order book involving bitcoins on one side #269

Open marv-engine opened 10 years ago

marv-engine commented 10 years ago

As we all know, the Master Protocol cannot enforce the transfer of bitcoins between addresses. So there's no way the protocol can implement a two-sided order book with bitcoins such that bitcoins are transferred as a result of MP-based automatic order matching.

So, we automate as much as we can and involve the user to complete the process.

When User S (seller) creates a wallet in Mastercore or Omniwallet, he provides contact information, e.g. an email address and/or an SMS text number. This will be used by a notification service that runs as part of the wallet.

At a high level, the steps are:

  1. User S posts an offer to sell BTC for MSC. This is like a classified ad. There's no enforcement to complete the sale.
  2. This offer is listed in the order book in the Mastercore wallet or Omniwallet, with a flag highlighting that it's a BTC for MSC offer and requires special handling.
  3. User B (buyer) looks at the order book and chooses to accept that specific offer. This creates a complementary tx20 sell offer by User B at the terms set by User S.
  4. The wallet asks the notification service to alert User S that User B wants to trade his MSC for User S's BTC, per the newly created tx20.
  5. User S gets the notification, signs in to the wallet which provides a quick/easy way for User S to send a tx22 Accept followed by a bitcoin send for the corresponding number of BTC.

Instead of creating the tx20, is it possible for User B's wallet to use P2SH to create a transaction that's signed by User B that has to be countersigned by User S to exchange the BTC for MSC?

dexX7 commented 10 years ago

Ah, this is more clear. Thanks.

So the user could post his buy intend and once a seller is willing to sell, the buyer is notified. If the potential buyer responds, the seller could then create a proper sell offer and the potential buyer sends an accept offer/payment transaction?

Instead of creating the tx20, is it possible for User B's wallet to use P2SH to create a transaction that's signed by User B that has to be countersigned by User S to exchange the BTC for MSC?

What would the exact mechanism be in this case?

Instead of going the tx 20 -> tx 22 -> payment route, maybe a modified version of tx 20 could be created which reserves the tokens for sale, but in particular for the potential buyer?

  1. Buyer posts buy intend (off-chain)
  2. A potential seller appears
  3. Seller and buyer ping each other to ensure both are present (off-chain)
  4. Seller publishes a targeted tx 20 which reserves the tokens for the buyer (on-chain)
  5. Buyer sends the BTC payment (on-chain)