diff --git a/100.md b/100.md new file mode 100644 index 0000000..9fdb106 --- /dev/null +++ b/100.md @@ -0,0 +1,194 @@ +# NIP-100 + +## Implementation of Bitcoin Token Interoperability Across Various DEXs + +`draft` `optional` + +The NIP defines the interoperability of Bitcoin Tokens, such as BRC20 tokens, among different DEXs (Decentralized Exchanges). DEXs utilizing this protocol enable the circulation of user order data among other DEXs using the same protocol, allowing for public display and cross-platform transactions. This enhances trading efficiency by increasing the exposure of user orders. The protocol was authored by the Orders.Exchange team. + +## Info + +A Seller or Buyer can publish these events: + +| Kind | | Description | +| ----- | ------------ | -------------------------------------- | +| 60018 | set_order | Create or update an order for product. | +| 60019 | take_order | Take a product and delete the order. | +| 5 | delete_order | Delete an order. | + +**Event `60018`[:](https://github.com/nostr-protocol/nips/blob/master/15.md#event-30017-create-or-update-a-stall) Create or update an order for product.** + +**Event Content**: + +```json +{ + "platform": , + "orderId": , + "sellerAddress": , + "productType": , + "orderType": + "publicKey": + "sign": + "data": { + "inscriptionId": , + "coinAmount": , + "amount": , + "psbtRawCreate": + } +} +``` + +Fields that are not self-explanatory: + +- `platform`: + - The name of the platform that relay the order + - eg: `"OrdersExchange"` +- `orderId`: + - The ID of order, `SHA256(__)` +- `data`: + - if `productType` is `ordinal` + `data` Include fields:`inscriptionId/amount/psbtRawCreate` + - if `productType` is `brc20` + `data` Include fields:`inscriptionId/coinAmount/amount/psbtRawCreate` + +**Event Tags**: + +```json + "tags": [ + ["d", , + "orderId": , + "buyerAddress": , + "productType": , + "orderType": + "data": { + "inscriptionId": , + "psbtRawCreate": , + "psbtRawFinal": , + "txId": + } +} +``` + +Fields that are not self-explanatory: + +- `platform`: + - The name of the platform that relay the order + - eg: `"OrdersExchange"` +- `orderId`: + - The ID of order, from **Event `60018`** +- `data`: + - if `productType` is `ordinal` + `data` Include fields:`inscriptionId/amount/psbtRawCreate/psbtRawFinal/txId` + - if `productType` is `brc20` + `data` Include fields:`inscriptionId/coinAmount/amount/psbtRawCreate/psbtRawFinal/txId` + +**Event Tags**: + +```json + "tags": [ + ["d", , + "orderId": , + "sellerAddress": , + "productType": , + "orderType": + "publicKey": + "sign": + "data": { + "inscriptionId": , + "coinAmount": , + "amount": , + "psbtRawCreate": + } +} +``` + +### Step 2: `buyer` pay for order (event) + +When buyer see orders and select one, then take it and make final psbt. Broadcast psbt tx at last. + +`data` include: + +- `inscriptionId` id of inscription +- `psbtRawCreate` psbt raw from seller who created it +- `psbtRawFinal` final psbt raw from buyer +- `txId` bitcoin txId + +```json +{ + "platform": , + "orderId": , + "buyerAddress": , + "productType": , + "orderType": + "data": { + "inscriptionId": , + "psbtRawCreate": , + "psbtRawFinal": , + "txId": + } +} +``` + +### Step other: `seller` Update Order or Delete Order (event) + +Delete order by seller + +```json +{ + "platform": , + "orderId": , + "sellerAddress": , + "publicKey": , + "sign": , + "data": { + "inscriptionId": + } +} +```