Atomic cross-chain trading – Bitcoin Wiki

The problem of atomic cross-chain trading is one where (at least) two parties, Alice and Bob, own coins te separate cryptocurrencies, and want to exchange them without having to trust a third party (centralized exchange).

A non-atomic trivial solution would have Alice send hier Bitcoins to Bob, and then have Bob send another cryptocurrency to Alice – but Bob has the option of going back on his end of the bargain and simply not following through with the protocol, ending up with both Bitcoins and the altcoin.

Contents

Solution using exposing secrets of contract

Algorithm

Here is one description of an algorithm that solves this problem, credit goes to TierNolan for this specific description (the algorithm wasgoed described ter other terms by other people including Mike Hearn above).

Solution using specialized altchain

The previously mentioned treatment can be used directly to trade inbetween bitcoin-derived chains without special support on the side of protocol. The demonstrable disadvantage is nLockTime – if counterparty does not go through the trade, our funds are locked and cannot used te another trade for the duration of timeout. Additionally, it depends on transaction replacement which may, or may not be considered standard under current bitcoin protocol rules.

Another proposal of cross-chain p2ptrade is to use specialized altchain with properties for efficient operation of p2ptrade from bitcoin chain. Additionally, wij use only single standard bitcoin transaction which looks exactly the same spil normal payment (no nlocktime, no multisig, no special script).

Assuming the altchain has actual economic value to support it, it can even serve spil proxy for (relatively) efficient zero-trust p2p market inbetween fe. BTC and LTC thanks to arbitraging market makers.

Algorithm

  • Bob create and sign the transaction spil usual and compute its txid. He sends txid and the transaction bod with input scripts/signature blanked to Alice.
  • Alice computes hash of the blanked assets, call it blankhash, and constructs transaction with special bitcointxid(blankhash,txid) opcode. Broadcasts the transaction to altchain.
  • Bob waits for altchain tx to confirm and verify its outputs are spil previously agreed – at that point he sends the “uncensored” Bitcoin tx to Alice who’ll broadcast it. Alice is therefore credited the bitcoin funds, which te turn validate altchain transaction at the same time (this is the atomic point).
  • Note that bob releases his tx only if he is adequately certain the altchain will not reorg its transactions, thus possibly dual spend. This might imply that *many* confirmations ter altchain should come very first, however during that time each of them might determine to cancel the trade with no further consequences.

Related movie: Rendimento com a Genesis-mining


Leave a Reply