What is an Atomic Swap?

in #bitcoin6 years ago

ezgif.com-resize.gif

Atomic swaps are a means of exchanging coins across blockchains, without a centralised party like an exchange or escrow. The development of atomic swaps is critical in continuing to develop a secure crypto ecosystem with trustless, decentralised trading.

When you trade crypto on a regular exchange, you send your coins to a company, who (hopefully, but by no means always) store them safely for you. Your balance is credited in their database, a record is created with the funds you deposit, and their order-matching engine pairs your buys and sells with those of other users.

It all works pretty well, most of the time. When it doesn’t, though, it can be catastrophic. Traders and investors have lost billions of dollars in crypto when exchanges have been hacked, or gone offline at a critical time for one reason or another.

]This is where atomic swaps come in. They allow traders to exchange coins on different blockchains, peer-to-peer. No hacks, no downtime, no trust required. Let’s say Alice and Bob want to exchange BTC and LTC:

  1. Alice creates a secret phrase and hashes it (a hash is a one-way mathematical function – you can easily create the hash from the secret phrase, but not the phrase from the hash)

  2. Alice creates a transaction to Bob on the Bitcoin network that includes the hash she created. It has the condition that the transaction will only be executed when the secret to the hash is revealed.

  3. Bob creates the corresponding transfer to Alice on the Litecoin network, with the same hash as part of the condition. Bob does not know the secret, but knows that Alice’s transaction will only complete when she reveals it.

  4. Alice publishes the secret to the hash, executing Bob’s transaction to her on the Litecoin network.

  5. The secret is now public, so Bob can execute Alice’s transaction to him on the Bitcoin network.

  6. Alice and Bob can both put other conditions in their transactions, such as cancelling them if the secret isn’t revealed within a certain amount of time.

The new generation of decentralised exchanges will feature atomic swaps, all within a handy user interface that manages the secret creation for you.

Red hot news, scorching wit and searing opinion pieces from Crypto Inferno.

Join us on
Telegram: https://t.me/crypto_inferno
Reddit: https://www.reddit.com/r/CryptoInferno/
Twitter: https://twitter.com/CryptoInferno_
Facebook: https://www.facebook.com/CryptoInfern!

Sort:  

And how does one articulate these conditions with "simple" coins like Bitcoin and Litecoin? Isn't that exclusive to smart contracts?

Or did you mean that the both Alice and Bob send their coins to a secret wallet?

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.040
BTC 70733.96
ETH 3563.16
USDT 1.00
SBD 4.76