Skip to content

Offchain Dex-friendly tx type #34

@akumaigorodski

Description

@akumaigorodski

This sidechain seems like a natural place to get a DEX up with an offchain order book and onchain swap, but it needs a special tx type to prevent an free option issue.

How it can work now and why it is problematic

  1. traders constantly add/edit/delete trade offers for a pair off-chain and thus form an order book, this part does not concern bitAssets at all.
  2. Once trade is made, a usual transaction is formed with one UTXO going to, say, ECX/USDT seller and another to a buyer, they both form this tx, exchange signatures off-band and broadcast a final tx.
  3. Problem: a "cheating" side may receive the other side signature and stall a trade until counterparty UTXO becomes spent in a different way, until that moment a "cheating" side may wait for a more favorable market conditions than those agreed upon (free american option problem).

Why it can not be cleanly addressed by existing tx types

the closest one is DutchAuctionCreate / DutchAuctionBid / DutchAuctionCollect sequence which cumbersome and requires a trader to essentially pay a fee to create a limit order, which is a lot to ask compared to competitive trading venues.

How it can be addressed

by adding a new TransactionData type equivalent to an ordinary tx, but with an absolute expiry height. After that sidechain block height, the tx is invalid for mempool acceptance and block inclusion. This way a free option issue can exist for a few minutes max which is generally acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions