Atomic Swap: the Basics

in #smartcontracts6 years ago

Although smart contracts have been around for quite a while, their concept still remains somewhat of a mindbender for the average user. This series of articles aims to shed some light on the purpose and working principles of the selected smart contracts supported by Smartz platform thus providing you with a simple explanation in relation to each of them. Today’s article is dedicated to the Atomic Swap, a smart contract that allows to directly exchange one type of cryptoassets with another without assistance of a mutually trusted intermediary party.

Imagine a simple situation: Lucie wishes to exchange her BTC for ETH; conversely, Jamie wants to exchange some of his ETH for BTC. But there is a problem: since Ether and Bitcoin blockchains are unrelated to each other and it’s impossible to reverse a transaction, either party can cheat — as soon as Jamie receives BTC from Lucy he might just disappear without transferring his ETH in return. Hence, before the introduction of Atomic Swap in mid 2017 such exchange could be successfully executed either if Jamie and Lucie a) completely trust each other or b) ask a third party for an escrow. The issue of trust would arise in both mentioned scenarios since the third party could also be corrupted; moreover, the exchange could not be conducted anonymously — the involved parties had to reveal their identities one way or another. There is also a third option — an exchange platform, but it also has its flaws, most notably high fees and vulnerability to hacking attacks.

Enter Atomic Swap, the solution based on the smart-contract technology that resolved the problems of mutual trust and anonymity, making life easier for all them Lucies and Jamies. The working principle is simple: there is a time-locked smart contract that allows each party to refund their tokens by rolling back the transaction in case of misconduct of the opposite party; each party must deliver its end of a bargain within a specified period, or else the transaction will be cancelled automatically. This is what «atomic» stands for — there is a time limit, an expiration point after which the tokens are retraced back to the owner.

Atomic Swap is acknowledged as a groundbreaking technology, and there are reasons to believe that such point of view is not too far-fetched, especially taking into consideration that this solution has laid the groundwork for a whole new segment of the market — decentralized exchanges or DEXs which are perceived as an alternative for the traditional centralized cryptocurrency exchanges (we all know that decentralization is everything). The advantages of Atomic Swap over turning to intermediaries (be it private individuals or large centralized exchanges) are obvious: by interacting directly with each other, participants increase transaction speed, save time and provide a higher level of security. All in all, Atomic Swap is simply a better option.

The deployment of an Atomic Swap on the Smartz platform is actually not that big of a deal even for a non-tech savvy person: if it is the first smart-contract you’re working with, you can use a simple step-by-step guide on how to deploy relatively similar smart contracts. You can also visit this page to learn more about the functions for the Atomic Swap and the details of its deployment in general. The whole process can be best described as intuitive, since both mentioned guides are self-explanatory.

Also we prepared a simple video about deploying Atomic Swap contract on Smartz platform. More info on the supported smart contracts will follow.

Subscribe to our blog @smartz to keep abreast of news about smart contracts and our platform.

Sort:  

To listen to the audio version of this article click on the play image.

Brought to you by @tts. If you find it useful please consider upvoting this reply.

@smartz, I'm interested in the same topic as you, let's spin it together. I signed on to you, I hope you'll sign up for me. Always glad to meet new people!