Ravencoin icon indicating copy to clipboard operation
Ravencoin copied to clipboard

[Feature] Atomic Swap Creation - Discussion

Open ben-abraham opened this issue 4 years ago • 1 comments

Now that atomic swap execution is in core, I want to look at getting creation implemented as well. That being said, creation has much more complexity to it, so I wanted to open a discussion surrounding creation to make sure everything is sounds good to all involved. There are a lot of considerations that need to be dealt with that I came across while building raven-trader-pro, that may or may not apply to core wallet.

The top-most things in my mind are

  1. What should the UX be like with regards to locked UTXO's, and other such edge-cases?
  2. How should the trades be stored locally? Simple JSON vs. more detailed format?
  3. External integrations (ie: raventrader.net), good in theory, but ultimately not good for centralization. Maybe standardize like IPFS and allow selection in UI?
  4. RPC Integrations. Maybe this is an after-launch addition, but an easy way to generate trades over RPC would be extremely helpful for developers looking to make integrations.
  5. UTXO Setup. UTXO's must be "prepared" (ie: self-transfer of the exact amount for the trade) if you don't have an exactly matching UTXO already, which for RVN is practically never.
  6. Bulk trade setup. Same as 5, but preparing many UTXO's in a single self-transfer, to cut down on transaction fee overhead
  7. How should trades be shown in the UI?

My answers for raven-trader-pro were as follows, but these solutions might not all apply to core.

  1. UTXO's are individually recorded as locked (and locked in wallet unless disabled), so the wallet tracks a "spendable" and "complete" UTXO set. UI elements will show partial balances to represent spendable vs. complete.
  2. JSON file storing trades, locks, and history.
  3. N/A, dedicate app for website
  4. Would love to have these <3
  5. A Trade is created first which outlines the give/take. From that any number of orders are created, which are tied to specific UTXO's. When adding orders to a trade UTXO's are searched or created if needed.
  6. Trades can have multiple orders under them, and when many are added at once, the self-transfer properly does them in a single transfer, optimizing things.
  7. Fairly basic, 3 tables. 1 for active Trades. 1 for completed orders. 1 for executed orders.

Let me know your thoughts!

ben-abraham avatar Jun 28 '21 20:06 ben-abraham

  1. Maybe a fourth column for current balances - maybe with RVN balance at the top and Asset balances listed below. I know these are listed elsewhere in the core wallet but it would be nice to have them located in the same place as trades/orders as well just from a UX perspective.

m4r1m0 avatar Jul 28 '21 16:07 m4r1m0