How do atomic swaps work?

in #blockchain5 years ago

ezgif-2-b489a6fc0b3f.gif

Atomic swaps are a big deal in the crypto world, with different projects looking to add them but few offering a pure implementation. A true atomic swap enables users to exchange coins across blockchains, totally trustlessly.

We know that centralised exchanges suck. They steal your coins, they let hackers in, they fake trading volumes, they run pump-and-dump schemes. In Bitfinex’s case, they actually control the money supply that they use as a currency for trading, which is about as shady as you can get without actually being a shadow.

Decentralised exchanges help, but they’re kind of limited. They usually only let you trade tokens for one platform (like ERC20), and odds on that’s not enough for you. So if you want to sell BTC for ETH, you pretty much have to use a centralised exchange, at which point you’re going to get charged anything from 0.025% fees to the 100% ‘charge’ that exchanges like QuadrigaCX levy.

Atomic swaps are a rare – possibly mythical – animal designed to allow users to exchange coins across blockchains, without needing to trust a centralised intermediary. Nice. Here’s how they work.

  1. You want to exchange 10 BTC for 300 ETH with some random anonymous dude on the internet. You don’t trust him, because he’s a random anonymous dude on the internet (RADotI).
  2. You generate a big-ass random number. Like, so big that even if RADotI has some seriously badass hardware and a thousand years, he’ll never brute force it.
  3. Hash your big-ass number.
  4. Make a transaction on the BTC blockchain. You’ll need some scripting. It goes like this: ‘Transfer 10 BTC to RADotI’s address when I reveal the big-ass number for this hash.’
  5. RADotI makes a similar tx on Ethereum. ‘Transfer 300 ETH to that guy’s address when I reveal the big-ass number for that hash.’
  6. Once RADotI has set up his transaction, you reveal the big-ass number and execute his transaction of 300 ETH to you.
  7. Because this operation reveals the big-ass number publicly, RADotI can also transfer your 10 BTC to him.
  8. You get your 300 ETH. RADotI gets your 10 BTC. Neither of you need to use a shady centralised exchange.
  9. You both rock. But especially you.

They’re called ‘atomic’ swaps, by the way, because the swap happens atomically – either completely, or not at all.

Beam says they’re implementing atomic swaps in their next wallet update. We’re kind of interested to see what that looks like in practice. You can check out which platforms have the features to be ready for atomic swaps at https://swapready.net.

Желтая полоска.jpg

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

Join us on
Telegram: https://t.me/crypto_inferno
Twitter: https://twitter.com/CryptoInferno_
Facebook: https://www.facebook.com/CryptoInferno/
Steemit: https://steemit.com/@crypto.inferno

Sort:  

Thanks for explaining this. This will evolve for sure

Coin Marketplace

STEEM 0.30
TRX 0.11
JST 0.033
BTC 64223.84
ETH 3158.34
USDT 1.00
SBD 4.29