Decred Cross-chain Atomic Swaps: Eliminating Trust from Trades
So, you know that Decred aims to take decentralization to a whole new level, right? We’re talking a decentralized cryptocurrency with decentralized decision-making, decentralized funding, and decentralized development.
The Decred Digest - Sep 27, 2017
So, you know that Decred aims to take decentralization to a whole new level, right? We’re talking a decentralized cryptocurrency with decentralized decision-making, decentralized funding, and decentralized development. Just when you thought the future of Decred couldn’t get any more decentralized, the release of a new tool has taken the concept one step further!
I believe the overriding goal of Decred is to create a truly decentralized infrastructure that’s ruled by its stakeholders. Decentralized decision-making via stakeholder voting is just one part of this infrastructure. Step-by-step Decred is eradicating all requirements to trust a third party intermediary or centralized entity — it’s slowly rooting out all single points of failure.
In recent years, exchanges have emerged as one of the biggest risks to the cryptocurrency ecosystem. Whilst they don’t represent a direct point of failure for any given cryptocurrency, our reliance on exchanges has perhaps made them one of the biggest. No one needs to store their funds on an exchange, but many people do so out of necessity. For most people this is the only practical option available to conduct a trade.
Here lies the issue: while cryptocurrency is decentralized, exchanges are not. Exchanges simply act as a centralized escrow between two parties. When you send your funds to an exchange wallet you are trusting a third party custodian to keep them safe. These exchanges are responsible for the funds and private keys of anything up to millions of users — compare this to you looking after your own funds.
Despite the efforts of the majority of reputable exchanges that go to great lengths to try and keep customer funds safe, the fact is they represent a centralized and widely known target of wealth. Why would a thief target one person when they can potentially target millions? As such, there have been numerous cases where exchanges have been hacked and customer funds have disappeared. The most notorious being the Mt. Gox hack, where approximately 630,000 bitcoins were stolen, and the more recent Bitfinex hack, where around 120,000 bitcoins were stolen.
Furthermore, because exchanges are normally centralized in a single country, they are often highly regulated. Therefore they are subject to the strict rulings and decisions of the nation where they are based. This creates a further vulnerability if a government decides to clampdown on the cryptocurrency ecosystem. A prime example of this is the news that yet again, the People’s Bank of China is enforcing the closure of all Chinese digital currency exchanges. As usual, this has sent the markets plummeting.
Whilst it is impossible for a country to ban a cryptocurrency, they can restrict people accessing the ecosystem through exchanges. For many Chinese people this now means the only option available is to make over-the-counter (OTC) trades. However, the problem with arranging an OTC trade online is that both parties need to trust each other to hold up the other side of the deal. In other words, if Jack agrees to swap 1 BTC for 100 DCR with Jill, and sends her the bitcoin, there is nothing to enforce Jill to send him the decred in return — he just has to trust her. For obvious reasons, this has the potential to end in tears!
For the foreseeable future there will still be a need for fiat to digital currency exchanges, unless you enter the ecosystem via mining, or by receiving a free airdrop. However, last week Decred developers announced a much needed solution for digital-to-digital OTC trades such as this. Decred developer, Josh Rickmar (@joshrickmar), has created a new tool that enables trustless OTC exchanges between Decred, Litecoin and Bitcoin, via a cross-chain atomic swap. Bitcoin Magazine reported that the new tool “delivers on the market desire for improved interoperability between currencies and the demand for new efficiencies that drive investor value”.
Cross-chain atomic swaps use ingenious protocols that allow the secure transfer of funds across two different blockchains, and remove any need to trust a third party when trading between different cryptocurrencies. Therefore, cross-chain atomic swaps disintermediate the requirement to use a centralized exchange as an escrow. Instead they provide people with a decentralized and trustless option to conduct OTC trades between supported cryptocurrencies — free from the type censorship recently seen in China.
As explained by Jake on episode 12 of Decred Assembly, there are two types of cross-chain atomic swaps: on-chain and off-chain. On-chain atomic swaps will be discussed throughout this article. Off-chain atomic swaps will be made possible once the Lightning Network is integrated (coming soon!).
Last week the first Decred on-chain atomic swap was completed when 1.337 LTC was exchanged for 2.4066 DCR between creator of Litecoin, Charlie Lee (@SatoshiLite), and Decred developer Alex Yocom-Piatt (@_alyp_). Charlie has been a long time supporter and holder of decred (or should I say, staker).
But what exactly is a cross-chain atomic swap? For a detailed, elegant and easy to understand explanation I will refer you to Jimmy Song’s latest article. Or if you’d prefer to see a video explanation, check out what Charlie Lee had to say on episode 13 of Decred Assembly. However, in short, an on-chain atomic swap involves two parties conducting a trustless exchange across two different blockchains. Since Decred and Litecoin are both supported by the new atomic swap tool, it is now possible to conduct swaps between their blockchains. So, for example, if Jack and Jill want to swap 1 LTC for 1.5 DCR, both parties would need to agree on a deal. Following this, the DCR would be locked to the Decred blockchain, the LTC would be locked to the Litecoin blockchain, and then the two sets of coins would be swapped without any counterparty risk.
To show how this works Charlie Lee also gave a live demonstration on Jimmy Song’s Off-chain YouTube show. However, whilst it was great to see Charlie give the live demo, the thing that really hit home with me was when I saw the first real OTC swap take place live on Twitter.
On 22nd September 2017 Narcélio Filho (@narcelio) tweeted “I want to buy 10 DCR paying 0.1 BTC. Anyone interested?” In response Gogocoins (@gogocoins) tweeted “Hey Narcélio! I would love to buy some BTC. This is my BTC contract address: 1MhbxWTbyThNmVpRTnisrxPWeMs1e8bQcs”.
For me, it was at this moment that both the concept and potential of cross-chain atomic swaps was put into perspective. I believe the future of digital-to-digital OTC exchanges will be conducted in this way. A process that decentralizes our ecosystem even further by eliminating our need to rely upon a centralized third party exchange to trade between two blockchains.
Whilst the only option available to conduct these swaps at present is via a command line interface (CLI), the good news is that Decred is integrating the atomic swaps tool into the Decrediton wallet. Which means that cross-chain atomic swaps will soon be available and accessible to everyone, regardless of their technical ability!
Once the Lightning Network is activated on Decred off-chain atomic swaps will also be possible. This will bring improved efficiency and an even greater range of use cases. With on-chain atomic swaps you still need to wait for both chains to mine a new block to confirm the transaction. Whereas off-chain atomic swaps will utilize the Lightning Network to carry out exchanges, confirming them instantaneously.
Going forward, I believe that Decred will continue to break new ground, with developments such as the atomic swap tool, leading the way with innovations in the blockchain space. Moreover, since Decred is committed to open source development, these innovations will be shared for the wider benefit and greater good of the cryptocurrency ecosystem. Decred welcomes any other projects to use our on-chain atomic swap tool, as we believe that broadening the range of supported coins will ultimately benefit us all. I am pleased to see that Vertcoin has already joined the party! Last week they also carried out their first on-chain atomic swap when Charlie Lee exchanged 1 LTC for 55 VTC with their lead developer.
The development of the Decred atomic swap tool, along with its integration into Decredition, is a prime example of how Decred’s decentralized funding mechanism enables us to quickly develop and add new features. Perhaps the greatest use case of them all is emerging from our decentralized governance system, something that I believe will eventually become the ‘holy grail’ for cryptocurrencies — the ability to evolve rapidly. Decred is a robust, adaptable and highly progressive cryptocurrency that is evolving — fast. Its funding mechanism ensures there are plenty of funds available for development, whilst on-chain consensus voting and the soon to be released proposal system, enables stakeholders to quickly agree on how those funds are spent. I believe this is the only way a cryptocurrency can make decisions in a timely manner, without sacrificing true decentralization by handing over decision-making power to a centralized decision maker.
But, as usual, the story doesn’t stop here! Very soon Decred stakeholders will begin voting to activate the Lightning Network. All development work is now complete, and all that remains is for stakeholders to decide if they want to activate it. Since the Lightning Network was built using btcsuite, which was also created by the Decred development team, I am excited to hear what new innovations our team can bring with the Lightning Network! Off-chain atomic swaps will surely be one of these. But, for now, and as always, the destiny of Decred is in the hands of its holders. Get ready to vote for Lightning!
K. M.
Reminder: to make sure you’re ready to vote please upgrade to Thunderstruck (release v1.1.0).
Comments ()