A succinct walkthrough of a cross-chain atomic swap.steemCreated with Sketch.

in #crypto7 years ago (edited)

Imagine that Alice and Bob meet in a crypto trading chat room and agree to a trade: Alice will give Bob 1 BTC in exchange for 100 DCR. Typically they would then seek out a trusted member of the chat room to escrow the transaction - that user may or may not charge a fee for the service, and the trade's success is entirely dependent on the third party. Far from ideal.

Enter the Cross-chain Atomic Swap. This fancy new technology allows Alice and Bob to make trades directly with no counterparty risk. It goes like this:

  • Alice gives Bob her BTC wallet address, and Bob gives Alice his DCR wallet address.
  • Alice generates a secret, K, and a cryptographic hash of the secret, K*.
  • Using the cryptographic hash K*, Alice pays into a BTC contract transaction that Bob can redeem within 48 hours if he knows K. Otherwise, it is refunded to Alice's wallet address.
  • Alice shares the contract with Bob (off-chain). Bob audits the contract and extracts K*.
  • Using the cryptographic hash K*, Bob pays into a DCR contract transaction that can be redeemed with the secret, K, within 24 hours.
  • Bob shares the contract with Alice (off-chain). Alice audits the contract.
  • Alice uses the secret, K, to redeem the DCR contract transaction.
  • Bob extracts K from the previous transaction where Alice redeemed the DCR sent to her by Bob.
  • Bob now has at least 24 hours to redeem the BTC contract transaction using K.

Two takeaways:

  1. A cross-chain atomic swap does not take place entirely on-chain - a communication channel is necessary to share wallet addresses and contracts. This channel can take the form of an email or a secure messaging client (Lightning Network will make this easier.)
  2. The advent of cross-chain atomic swaps does not mean exchanges are going out of business; there is still a need for infrastructure to maintain an orderbook, match counterparties, etc.
Sort:  

Congratulations @ldcicconi! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

New japanese speaking community Steem Meetup badge
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.15
TRX 0.23
JST 0.032
BTC 91248.01
ETH 2481.77
USDT 1.00
SBD 0.68