Atomic Swaps, Cross-Chain And A Tale Of Blockchain Interoperability
Atomic swaps and cross-chain protocols are bringing us closer to achieve blockchain interoperability. But what are these, and why should you care?
What was the real game changing thing about the internet? Think about it. What was it that made it become this immaterial realm with a life of its own which forever changed our lives on this planet?
It was not Skype, Netflix, Facebook, Google or pictures of cats playing instruments. These were mostly just apps built on top of the whole thing (and in the case of cat pics, plain human silliness).
Nor was the ability of computers to communicate and exchange packets of information. Hell, computers have been talking to each other since the 1970s, and still it took two more decades for the internet as we know it to take the world by storm.
So what was it, then? What changed? Well, it all boils down to one boring-sounding word: protocol.
Of course we’re grossly oversimplifying the process and there was a lot more to it, but the adoption of a common protocol was pivotal to kickstart the whole thing.
What is a protocol?
Broadly speaking, a protocol is a set of agreed-upon norms for interactions between individuals on a network. In computer-speech, a protocol dictates the rules by which all nodes in a network must abide to be able to participate.
In the case of the internet, the first widely-adopted protocol (and still its most basic layer) was TCP/IP, which established the rules for how computers should send and receive information across a network.
But dominance doesn’t happen without competition. During the experimentation stage, competing protocols are proposed, tested and pushed. With each new layer that extended the power of networks, the same competition took place. The open HTTP protocol created by Tim Berners-Lee took some time to become the norm. But once it did, innovation went exponential.
The pattern here should be obvious. When it comes to collaboration (be it between humans or computers), having a common protocol (like speaking a common language) can immensely benefit everyone.
And now, onto blockchains.
The internet of value
As it happens, bitcoin is a protocol, as are most other cryptocurrencies like Ethereum, Ripple, EOS, etc. The very existence of coins (which are not actual coins, but entries on a ledger) is part of the protocol, just like the conditions for transfers, mining rules, and all else.
In that sense, the bitcoin network is like an internet of value, where wallets are apps or websites, and bitcoin (the coin) is the message they exchange. Each blockchain out there is like a mini-internet, allowing tokens to flow freely within their own boundaries, but utterly confined to them.
Right now, a myriad networks are out there, testing the waters and finding their feet. They’ve yet to find a common language. And just like innovation skyrocketed as many smaller networks became a global, interoperable web, just imagine the tsunami of progress that might come when blockchains start talking to each other.
As it happens, they may be only just starting to.
What are Atomic Swaps?
Much like the first use of blockchain was to exchange value in the form of tokens, it makes sense that the very first words across blockchains be just that - tokens.
“Atomic swaps” is a cool futuristic-sounding term for a trustless system that allows two parties to exchange tokens from different networks without having to trust a third party like an exchange (even a decentralised exchange). They are called “atomic” because of their binary nature: either a swap fully happens, or doesn’t happen at all.
This removes the cost of mediation from transactions, and also single points of failure, as each party keeps custody and is in control of their private keys.
This type of exchange is based on Hash Time Locked Contracts (HTLCs), which are basically time-bound escrow smart contracts, and are only triggered if both users acknowledge receipt of funds before the set deadline. A pair of HTLCs communicate between each other and once parties acknowledge that funds were received, the contracts broadcast the transactions in both networks. If either party fails to acknowledge receipt before the set time, then the whole thing is cancelled and funds are released back to each owner.
In the early days, atomic swaps would only work between networks that shared the same hash algorithm, but that’s already changing. Liquality, for example, is one of the projects that have successfully tested atomic swaps across bitcoin and Ethereum, each based on its own hashing algorithm.
- Atomic swaps have already been proven to actually work;
- No counterparty risk: of course, this depends on the actual implementation, but in principle there’s no risk of one of the parties defaulting;
- Slow: counterparties can take long to sign, delaying transactions and keeping funds locked;
- Complex: it’s definitely not user friendly yet;
- Hard to scale: as each network pair requires their own custom implementation (at least for now)
Crossing the chain
As exciting and groundbreaking as they are, atomic swaps do not actually exchange data, at least not directly. In terms of communication across networks, it’s still quite limited both in scope and speed.
Let’s use a prison cell analogy to make things more fun. Imagine a cell block with four consecutive soundproof cells. Alice wants to speak with Bob, but they are on opposite sides of the line of cells, with two cells between them. Inmates can only communicate via knocking on adjacent walls. Fortunately, each of the two intermediary cells is occupied by a very honest robot who will obey received instructions to the letter.
To bring this painfully idiotic allegory to an end, as far as blockchain interoperability goes, atomic swaps are just as efficient as having Alice and Bob morse-code with the aid of two robot inmates who morse-code each other and finally relay the messages. They never actually talk to each other, and can only communicate simple messages.
It’s a step forward in terms of network interoperability, but it’s not exactly the most efficient way. Functionality is also limited (as of today, at least) to exchanging tokens. More complex uses like cross-chain dApps still remain outside the scope of atomic swaps.
To achieve the holy grail of blockchain interoperability and perhaps spur another exponential boom in innovation, we need more than prison cell morse code. That’s where cross-chain protocols come in.
What are cross-chain protocols?
Some projects aim higher. Despite their global nature, each blockchain still lives within its own silo in terms of direct interoperability. Even if atomic swaps facilitate some rudimentary coordination between chains, it’s hard to see them scaling up to higher-level functionality.
Just like the internet evolved in protocol layers, with each adding more functionalities and enabling deeper, more complex communications, so may blockchain reach interoperability via a protocol layer. Or more than one, for all we know. That’s the core idea behind cross-chain protocols.
It’s hard to keep track of all the projects that are trying to build such systems. A year ago, at least 11 companies were publicly going at it, with a few of them having either launched or on the verge of launching their networks.
The principle behind most cross-chain projects is roughly the same. One or more overarching chain(s) act as the ultimate connector, connecting para-chains and allowing information to flow across the ecosystem. Needless to say, each architecture takes a different approach, with different features that ultimately reflect each proponent’s goals and vision.
Some projects, like Cosmos, focus simply on asset transfers across different networks. Polkadot, on the other hand, targets arbitrary message between chains, which would enable smart contracts to operate across networks. Yet others, such as Wanchain, are going for the full monty, trying to embrace messages, tokens, and Monero-inspired privacy all at once.
These are just some examples of prominent projects and a few differences in approach, and they’re only just beginning.
The internet of blockchains
Which brings us to the final question: why are we doing all this? Why does it even matter?
Deep down, we all really want to make the world a better place to live (although “better” varies from person to person). Technology just gives us more options, but as we evolve into a global society, we need to find ways to collaborate at an increasingly larger scale.
Blockchain (as an umbrella for the myriad peer-to-peer network technologies) gave the world a new way of organising trust and transacting value globally without a central authority. Why does it matter? Well, why did the internet matter? Exactly.
From where we stand today, it’s pretty much impossible to tell which of these cross-chain projects will be successful, if any. Perhaps there’ll be more than one, coexisting and connected via yet another layer. Or maybe something we can’t even think of will engulf the whole thing. Or maybe Skynet will finally take over.
That’s the crazy thing about imagining the future when you’re living right in the middle of a major breakthrough. Perhaps these ideas will all seem as silly as a Jetson’s episode in a couple of decades.
We could keep going, but instead, we’ll just leave the door open and throw the question back to you. What do you think will happen once we get an internet of blockchains?