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.
- 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).
- 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.
- Hash your big-ass number.
- 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.’
- 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.’
- Once RADotI has set up his transaction, you reveal the big-ass number and execute his transaction of 300 ETH to you.
- Because this operation reveals the big-ass number publicly, RADotI can also transfer your 10 BTC to him.
- You get your 300 ETH. RADotI gets your 10 BTC. Neither of you need to use a shady centralised exchange.
- 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.
Red hot news, scorching wit and searing opinion pieces from Crypto Inferno.