Demystifying Cosmos: Atomic Swaps, Ethereum, Polkadot and the Path to Blockchain Interoperability

A large part of my continual fascination with Ethereum comes from the composability between its state transition functions —or its ability to “make programs talk to each other”.

The fact that someone can leverage smart contracts from different projects built by different teams, and build something without having to start from square one means the opportunity set for possible applications can grow exponentially over time.

However, Ethereum’s current composability happens between smart contracts that reside on the chain. If you want to build a dapp that sends assets across multiple blockchains, you will need interchain interoperability — the ability to make blockchains “talk to” each other.

To expect a multi-chain future in crypto is to expect interoperability. Currently, a few projects are working to tackle this, with the two highest-profiles ones being Cosmos and Polkadot.

Cosmos’ hub and spoke model — from Cosmos website

To many, the projects can seem more similar than not: both propose a connective blockchain that relays messages between other chains (Cosmos’ Hub and Polkadot’s Relay Chain), both have a toolkit for developers to build blockchains that can plug directly into the respective ecosystems (Cosmos SDK and Substrate), and both have a bridge mechanism to connect legacy blockchains (Cosmos’ peg zones and Polkadot’s bridge chains).

But from the design philosophy, technical architecture and token use case perspectives, the projects have material differences that builders and investors alike may overlook.

To address some of these nuances, below is an adapted transcript from my recent conversation with Sunny Aggarwal, researcher and core developer at Tendermint, the team behind Cosmos. We discussed:

  • What is the rationale for interchain interoperabilty?
  • How is sending cryptoassets across blockchains different from atomic swaps?
  • What is Cosmos and how does it work?
  • How does Cosmos’ approach compare to that of Polkadot?
  • What is Cosmos’ token use case?
  • Where does Cosmos fit in with Ethereum 2.0 / Serenity?

You can also listen to the full conversation on the Blockcrunch Podcast, available on:

Subscribe to receive notifications for a follow up interview with Polkadot.


What is Cosmos and why is it important?

Sunny: To explain what Cosmos is, it needs a little bit of a narrative to explain the issues we saw in the blockchain space.

I like to put this into terms of a historical narrative where early in human civilization we had kingdoms and small villages where they were separate political entities that never really scaled. This is how the early blockchain ecosystem looked like. To build your own blockchain, you had to fork the Bitcoin code base.

But then because the Bitcoin codebase wasn’t a very generalized system (it was specifically designed for its use case, which is money), all the early blockchain applications were pretty similar to Bitcoin — like Litecoin, Dogecoin etc. Then the few that tried to do something different — like Namecoin for example, they were just very poorly engineered because they were trying to use the Bitcoin codebase to do something it wasn’t designed to do.

So along comes Ethereum, and it does two major things: 1) it makes it easier for people to build applications. Solidity is not the best, but it’s already way better than trying to deal with that C++ Spaghetti Code that is the Bitcoin code base. Ethereum made it much easier to make complex applications than simply forking Bitcoin.

The other thing that Ethereum did was it allowed these applications to interoperate with each other. So I can take my Dai to get leverage on Dharma and then use the 0x dex to buy a CryptoKitty.

You have this interoperability between all of these different applications that are sitting together on the Ethereum blockchain. And so back to the historical analogy: for thousands of years, in order to get large economic integration, we started creating empires as we realized that mass political integration produced mass economic integration.

And so this is what Ethereum did. They put everything on a singular blockchain under a singular set of rules and basically allowed this mass interoperability. But just like empires, it comes with a host of problems as well. One of the things is scalability is harder, and that means technical scalability and social scalability.

The Roman Empire fell apart because it just had too many competing cultures and interests within its borders and it was just impossible for it to maintain. Ethereum has a lot of competing interests. Let’s just look at the EIP Github repo. There are hundreds of EIPs on there, some of which are even contradictory (e.g. some people want state rent, some people don’t). It’s just like trying to come up with a governance mechanism that takes into account all the stakeholders in an empire. It’s not easy and it’s just not stable.

What humans figured out in the last hundred years, our greatest innovation - is that we realized that we could do economic integration without political integration. We did this through a couple of technologies.

One was the free trade zone. So now we have things like the EU, NAFTA, the WTO — these systems basically made free trade the norm rather than the exception.

The second was institutions. We have things like the UN where it’s not a government; it’s just a common forum where sovereign countries can come together and discuss and negotiate without always having to resort global conflict to resolve disagreements.

The third innovation we did was containerization. We standardized shipping containers and we made it so that any port in the world can accept the same shipping container. Now, from a random port in Argentina, I can ship to literally any port in the world. The containerization one is the one that Cosmos is really trying to touch on.

The fourth one was the internet, where I can do business with anyone on the other side of the globe. That clearly helped with economic integration too.

To bring it back to Cosmos, what we realized is in order to solve the governance problems of Ethereum’s empire, we need to create a system where we can have many blockchains, most of which are application specific blockchains. So each application or community should have its own blockchain that they have governance over. But as long as these systems have the ability to interoperate and send assets between them, we fulfill the Cosmos vision.

Can you describe the architecture of Cosmos and IBC (Inter-blockchain Communication)? What do you mean when you say that chains could connect to each other?

Sunny: We first looked at the side chains proposal that Blockstream had many years ago and we adopted off of there.

So our goal here is we want to create a common standard, which we’re calling IBC (inter-blockchain communication), which allows two chains to have light clients of the other chain.

For simplicity, let’s say we have two smart contracting chains: Ethereum and Tezos. Ethereum will have a smart contract on both of these chains. On Ethereum, we’ll have a smart contract where people can submit headers from the Tezos blockchain, and on Ethereum we’ll process them to make sure they’re valid.

And for Tezos, we’ll be doing the same thing on the other side. It will be accepting headers from Ethereum. And the goal here is just to make a standard way for blockchains to prove something about its state to another blockchain.

What that “something about the state” is — it’s left to higher level protocols that people can build. The one we’re starting with right now is token transfers or asset transfers, because that seems to probably capture 80% of the use cases that most people will need. That’s probably one of the simplest things we can do.

How does this asset transfer work, and how does one prove that an asset did indeed move between two chains?

Sunny: Basically what we’ll do is — say you want to do an asset transfer between Ethereum and Tezos. You will take a token on the Ethereum chain, lock it up in a smart contract, and then you will prove it by saying, “look, here is proof that this token of mine is locked on the Ethereum side”.

And so what Tezos will do is - it will print you a new token on the Tezos chain that says “this token is a claim to the underlying asset on Ethereum.”

Assuming that the token on Tezos is 1:1 redeemable for the underlying token on Ethereum, it should have the same value. It’s basically just a claim on the underlying asset. You can then take this asset and use it in Tezos smart contracts, or you could use it on the dex on Tezos. And then once you’re done, you can burn the token on Tezos, submit a proof to Ethereum on that burn, which basically says, “Look, here’s proof that I actually burned the token on Tezos!”.

2 stacks of chain-A native coins locked on chain A, but represented on chain B; from Cosmos website

And once you do that, then the Ethereum smart contract will unfreeze the token that you froze earlier. So that’s how you have that one-to-one interoperability, and how the two assets can remain at par.

So how is Cosmo’s way of doing token swaps different from the existing implementations of cross chain atomic swaps?

Sunny: So atomic swaps are something different than this Cosmos IBC idea. Atomic swaps allows two people to swap the assets that they’re holding.

Say I hodl $5 worth of BTC. You have $5 worth of ETH. Atomic swap just means I’ll transfer you $5 worth of bitcoin on the Bitcoin blockchain and you transferred me your $5 worth of ETH on the Ethereum blockchain. And so all that really changed here is ownership of assets on both chains changed at once (or not at all, hence “atomic”).

But as you’ll notice, BTC is still sitting on the Bitcoin blockchain and ETH is still sitting on the Ethereum blockchain. No value actually moved across the chains. Cosmos is proposing instead something completely different. What we’re saying here is I have my BTC and I want my BTC on Ethereum.

Let’s take Maker for an example. Currently, all of Maker’s Dai is collateralized by ETH. But maybe you want to collateralize Dai with BTC instead, but you need a way to have that BTC on the Ethereum blockchain. And atomic swaps doesn’t help you solve that problem. It doesn’t let the BTC leave the Bitcoin blockchain at all.

Under this Cosmos model, we allow assets themselves to move across blockchains.

But what about something like wrapped BTC (WBTC), where people wrap BTC under the Ethereum token standard (ERC 20 standard) and use bitcoin freely on the Ethereum blockchain?

Sunny: So what WBTC is doing is letting a permissioned set of signers who are basically a trusted set of scientists to take control of your BTC and issuing you Ethereum based tokens based on that. There’s currently one company — I forgot who it was specifically (Jason: it’s BitGo) that’s holding custody of the BTC that’s collateralizing the WBTC.

What Cosmos is proposing is: instead of having a permissioned validator, let’s have the assets be secured by a proof of stake based validator set. We want the people who are holding the underlying asset, who are enabling this transfer, to have something at stake such that if they do something malicious we can slash them.

This way, we provide some sort of security because right now in WBTC, if the signers of the federation decided to just run away with all the BTC, there’s really nothing the WBTC holders can too. They have nothing at stake there.

Looking at other ways that assets are traded decentrally or non-custodially, platforms like Kyber or dex’s built on 0x rely on price oracles. I’m assuming for Cosmos, there’s no need for a price oracle, correct?

Sunny: Exactly right. There’s no need for a price. Cosmos itself is not a dex. You could build a dex as a chain on Cosmos.

You could have a chain that’s specifically designed as a dex and people can move the BTC from the Bitcoin blockchain and ETH from the Ethereum blockchain onto this dex chain, and then they could trade there. But that’s independent of Cosmos. People could build whatever chains they want!

Cosmos itself doesn’t care about prices or swaps or anything.

Are there specific types of chains that are easier to connect, or those that are harder to connect, via Cosmos?

Sunny: Yeah, totally. So one of the main issues is IBC for now is really being designed with BFT chains in mind. And by the way, back in 2014 when we started this, there were no BFT chains!

Tendermint was the first company to do this. Jae Kwon wrote the paper where he looked at all of these consensus protocols back in the 90s and realized that you can use proof of stake to make these BFT consensus protocols actually usable in a public blockchain setting.

And so, that’s where he started Tendermint. Then following that, a lot of other projects started adopting BFT. So Ethereum’s Casper, Dfinity — all of these chain are basically BFT based systems now.

IBC is sort of like the containerization of the world, where we’re saying, “okay, let’s push for these common standards so that all chains in the world can kind of interact”.

Going back to the analogy about all ports in the world that can accept the same containers. What do you do about that one port that’s really stubborn and doesn’t want to accept the norm? This is essentially where Bitcoin is. Bitcoin is never going to change to adapt to the IBC format! We still want you to have BTC be part of this Cosmos idea, but then we can’t get them to use IBC.

So that’s why we have this other concept, called peg zones, which is a way of hacking IBC into a chain.

Peg zone illustration, from Cosmos website

Okay, so blockchains that don’t use the Tendermint consensus model can’t use the IBC function, which is what allows blockchains to speak to each other via Cosmos. Since Bitcoin is so important but unlikely to change its consensus for Tendermint, you need to build a special mechanism, called a peg zone, to let Bitcoin interact with the rest of the Cosmos chains. How does it work?

Sunny: You have to create a translator-type chain for that.

We will put a Tendermint chain in front of the Bitcoin blockchain, and this Tendermint chain acts as a mirror of what’s happening on the Bitcoin blockchain. It puts a finality gadget on top of the Bitcoin blockchain.

So we’ll say that once Bitcoin is 12 blocks deep, Bitcoin will mirror on the Tendermint BFT chain, and we’ll use the Tendermint BFT chain to talk to Cosmos. It’s like a mirror of Bitcoin that has IBC enabled.

The validators of that Tendermint peg zone will basically own a multisig on the Bitcoin blockchain, where they’ll do that translation task. If they misbehave, they’ll be slashed double because they’ll have stake on the Tendermint and Bitcoin chains!

So Polkadot has something similar called bridges as well. But let’s zoom out for a second. What’s your take on Cosmos vs. Polkadot? How are your approaches to interoperability different?

Sunny: I think the Polkadot approach has become more similar to Cosmos over time. Polkadot assumes that there is this one Relay Chain at the center of the universe and that all the parachains are connected to the one Polkadot Relay Chain. Everyone who doesn’t want to be part of this, they write them off as peg zones.

For Cosmos — instead we start from the approach where we design a system where things are by default sovereign. Every chain has its own validator set and it has a high amount of sovereignty. We designed it such that it works without any chain at the center.

The Cosmos Hub (the “flagship” blockchain connecting all chains) does not have to be at the center of this system. And what we instead promote is we want the idea of there being many hubs. So right now today we already have two hub blockchains. One is the Cosmos Hub, which is what we launched last week. And there’s another one called Iris Hub. They’re focused more on enterprise customers and especially focused in China. And this is really cool because then you could have like different ecosystems that are talking to different hubs.

And in my opinion, Polkadot can just be a hub in this larger interchain idea of Cosmos.

So, in what areas does Cosmos compete with Polkadot? Can you talk about the value differences between the two — particularly with chain sovereignty (Cosmos) vs. pooled security (Polkadot)?

Sunny: My favorite hobby is over-fitting metaphors that have to do with history to blockchain. The problem with small sovereign nation states is they often don’t have the ability to fend for themselves compared to empires.

What we did was we can create alliances and systems where larger countries can lease their security to weaker countries. NATO is an example of this. We’re a bunch of countries coming together and of pooling our security together, and whenever you do that you inevitably give up on some amount of sovereignty. I don’t think anyone would say that being in the EU or being in NATO is the same as like being in an empire - you still have a high amount of sovereignty, but you do give up on some amount.

So for example, like Switzerland and Belgium - both very similar demographically but with different preferences. Switzerland highly values its sovereignty over anything else. And so they refuse to join these larger international organizations. Well, a country like Belgium, for historical reasons, they’d rather be part of these larger organizations. Maybe give up a little bit of their sovereignty but get that higher security. We also see Brexit — an example of a country that’s choosing to go for more sovereignty. So with Cosmos, the idea here is let blockchains choose whichever model they want.

If they want to be completely sovereign, they could do that. But then the Cosmos Hub acts as a type of NATO-like system — this hyper secure blockchain layer. Chains have the choice to request that the Hub validate their blocks, and the Hub will do this for a fee. The Hub will still let chains have full control over their governance. For Polkadot, its goal is to offer this shared security mechanism (where chains give up their consensus sovereignty in exchange for shared security).

Since Polkadot by default pools the security of parachains built on top of it, whereas Cosmos chains have to take care of their own security, do developers have more incentive to build on Polkadot early on when they don’t have the resources to secure their own chains?

Sunny: There’s a difference between Cosmos Network and Cosmos Hub. The Cosmos Hub blockchain will essentially provide the same service (as the Polkadot Relay Chain) to a chain in the Cosmos ecosystem where they will provide pooled security to chains that want it. So the Cosmos Hub is very similar to the Polkadot Relay Chain in that way.

So the difference for Polkadot is if you’re a parachain, then you have to participate in pooled security. Whereas for Cosmos, you have to choice of whether to participate or not?

Sunny: Right, exactly. And so, for example, Binance is building their dex using Cosmos’ framework (with the Cosmos SDK). I imagine that they’re probably going to keep a sovereign chain. This is just speculation here, but I think they’re probably going to try to use their BNB token as a staking token as it has enough value to actually provide its own legitimate security.

But let’s say another dapp developer comes along tomorrow and say, “I created this cool dapp, but I don’t know where I’m going to get the community to actually bootstrap our stake behind this chain”.

That developer can basically submit a request to the Cosmos Hub to do validation work for it.

I know for Polkadot, there’s a limited number of slots for a parachain. There’s a whole governance process who decides who gets to be a parachain. Is that the same for Cosmos? What’s the governance process there?

Sunny: No. So this is going into the primary difference between the shared security philosophy of the Cosmos Hub vs. Polkadot.

For Polkadot, there will be thousands of validators and Polkadot basically assigns validators to specific chains. So out of say 1,000, 50 are assigned to a parachain, 50 to another, and so on.

With the Cosmos Hub, we’re going to take a different approach to this. A chain can show up at any time and say to the Cosmos Hub that it wants to be validated, and present the rewards associated with this validation work, as well as the inflation schedule of its token, how much transaction fees are anticipated, etc.

And then, each individual validator on the Cosmos Hub can individually say, “I want to validate that chain.” The validators will then stake their Atoms on the Hub and perform validation. If they failed on that chain, their Atom stake will be slashed on the Hub of course. This is great because of a few reasons. I personally run a small validating company, and we don’t have that much capacity. I run it part time since my main focus is on Cosmos core development. As such, I can only validate two or three chains.

But some validators are companies — for instance, my co-host on Epicenter (Podcast), Brian, works full time on a validating company called Chorus One. Maybe Chorus One is ready to validate hundreds of chains! They have their company, they have a lot of servers. And so, with the staking mechanism(the more Atoms you stake, the more validation work you can do), capital and resource allocation is efficient.

How does that affect end users?

Sunny: Currently, what happens in Polkadot and Ethereum is that all chains have to pay for equivalent security. So that means on Ethereum, someone who’s using CryptoKitties has to pay the same transaction fees as someone who is like using Dai to transfer millions of dollars.

That’s not right because that means that the people who were playing with CryptoKitties are overpaying for security. And that’s what makes it so expensive to use.

In the Cosmos Hub, where we have a shared security model, the chains that are less economically important/significant will have less rewards, less transaction fees and hence they’ll have fewer validators validating them.

Chains that are very high value applications will need to have high transaction fees in order to pay the high number of validators that they’re going to have. This is how allocative efficiency impacts end users.

Are there use cases that are better suited for Cosmos than for Polkadot? Polkadot seems to be more focused on arbitrary function calls between chains, whereas Cosmos seems to be more focused on swapping assets between chains.

Sunny: Sure. You can think of IBC as TCP IP. It’s just the internet protocol. But on top of TCP IP, you need these higher level protocols. You need HTTP for the web, you need FTP for file transfers and you need SMTP for email.

Same thing with IBC. It’s just this bare bones basic protocol. And then on top of that we’ll build other protocols but we’re just starting with token transfers.

Sunny: As far as I’m aware, Polkadot hasn’t actually built any of these higher level protocols yet (Jason: more details on this in my Polkadot interview). They don’t even know what kind of VMs are going to exist on different chains. And so, from that aspect, Cosmos and Polkadot have the same capabilities there.

The Cosmos Tendermint development team follows this philosophy of iterative design. We don’t want to oversell what we’re trying to build here because then people get overexcited and then disappointed when it turns out we’re pitching things that are 5, 10 years away.

Complex cross chain contract calls is completely feasible. And we’re helping people who can make that a reality, like Agoric.

But let’s just like set some expectations and focus on token transfers first. That’s our priority.

Polkadot chains have to give up their consensus if they want to pool security with the rest of the chains, by joining to the Relay Chain. What do developers give up when building on Cosmos? What are the trade offs here?

Sunny: The main thing is that they have to make sure they implement that IBC standard. There’ll be some pegs zones that we’ll make make “hacky” exceptions for — like Bitcoin and whatnot — things that are high value enough to deserve exceptions. But otherwise, if you’re not one of those few chains, you have to make sure you build IBC into your core protocol.

That’s a development trade off in that it’s an extra thing that you have to do in order to be part of the system. Now, assuming that you have the IBC, then what else do you have to give up? Not really much.

Now keep in mind that for some dapps — like finance dapps for example — they’re not using the Cosmos Hub for security. In fact, if you don’t even want to use the Cosmos Hub at all, you don’t even have to connect to the Cosmos Hub. You could connect to a different hub, for example, the Iris Hub, or you could just connect directly to the chains that you need to communicate with. But if every chain tried to connect to each other via IBC connections with every other chain, you’d have n squared connections! And that’s just not very efficient in my opinion.

But I’m happy to be proven wrong. Maybe that is the emergent behavior that comes up. It just that I think in most networks we see in the real world, you often end up falling back towards a hub and spoke architecture, or a multi hub and spoke architecture.

Look at flights, right? In theory, any plane can fly from any airport or any other airport in the world. But you still end up seeing a number of major airports in the world. I just see similar properties in Cosmos where you’re going to have these major Hub chains like the Cosmos Hub, the Iris Hub, and maybe a Polkadot Hub that will help make it easier for these chains to connect.

Based on that, it sounds like the Cosmos Hub doesn’t really need to exist for Cosmos to work. So by extension, do you need the Atom token to exist for the Cosmos vision to manifest fully?

Sunny: No you do not.

You don’t have to use the Cosmos Hub. So the Atom token does not need to exist for the Cosmos network to exist, but Atom tokens need to exist for the Cosmos Hub to exist. The idea is just to create a high value, high security chain because the Atom tokens are valuable.

And keep in mind the Atoms are not meant to be money. We’re not making a money token here. We’re not making our currency — in fact Atoms are hyperinflationary just to purposefully try to prevent them from being money.

We’re really trying to create a staking token. If you want, you can think of them as a taxi medallion where it’s this token that you need in order to be a staker and participate in proof of stake of the Cosmos Hub. And you know, you could just sit on your taxi medallion and and hope for it to appreciate, but the best value you can get off of it is to go drive a taxi or go participate in proof of stake and help secure and validate.

Shifting gears a bit. How does Cosmos compete with Ethereum?

Sunny: When people say Cosmos was trying to steal the Ethereum community, it’s not true. There are a few ways to think about it.

On the developer community front, we’re just trying to build a free and open-source tool. All of our tools — Tendermint, Cosmos Core, SDK - all of these are just open-source tools.

We’re just building tools in order to help make it easier to achieve this multi-chain reality and we think our tools are better than the EVM. And so we hope that dapp developers who really want to push forward for that vision choose the best tools for that job. And if that involves creating sovereign Cosmos chains, so be it. If that involves making chains that do shared security with the Cosmos Hub, so be it. I think we’re just adding more tools to the arsenal of dapp developers. I’m not even saying the Cosmos SDK is the optimal architecture. Substrate might be a better architecture than the Cosmos SDK!

We benefit from collaboration — I’ve learned a lot about consensus from the Casper people and I’m sure the Casper people have learned a lot of consensus stuff from the Tendermint people. Are we competing in some aspects? Yes, a little bit. But I hope we’re doing it with the intention of creating the best tools possible.

Now besides the developer community, there’s also what I call the “Faith” community. It’s really just the people who believe that ETH is money, or people who are trying to turn it into a meme coin. I think up until now bitcoin and litecoin are probably the two cryptocurrencies that have done the best job at meme-ing their way into currencies. I’m actually personally very interested in Grin too — which I think has the right narrative and a better monetary policy than bitcoin.

But when it comes to like the ETH community, I guess Cosmos itself doesn’t have a stake in this game. We’re not creating a cryptocurrency. We’re not competing to be money, but we were thinking about it for a while. We had this proposal called photons where we were trying to create a cryptocurrency. But the main goal there was to experiment with a constant issuance money supply — money that’s not as hyper deflationary as BTC or ETH.

But then Grin came along and did that. So now, I’m of the opinion that we don’t need to do photons anymore. The main experiment that we wanted to try has been done by the Grin community instead. And they’ve meme’d their way much better than I ever could have.

So we’re not really competing with the Ethereum community (on the monetary status) and I wish them the best of luck in making ETH be the best cryptocurrency.

Let’s project out 5 years. What does the interoperability field look like? Where are Cosmos, Polkadot and Ethereum?

I think Tendermint BFT helps a lot with scalability and that will help with the creation of a lot of dapps that maybe just weren’t possible under the current systems.

I hope to see a change in how people think about assets. I think we’re going to see a lot more staked tokens and I think there’s going to be this movement away from these tokens have value just because of their underlying functionality.

In a world with Cosmos, I can now go take the Z Cash state machine, and put it as a Cosmos chain. I can move my BTC onto there or I can move my Dai there. And I can use the zero knowledge properties of that zone with any asset. And so in that world, what exactly is the value of the Z Cash cryptocurrency? I’m not too sure!

I mentioned ETH is trying to move away from the gas token narrative to the money narrative, because they realized that to make money you have got to meme it. You can’t just depend on the underlying functionality because in a world of Cosmos, we will separate assets from its underlying logic, and any asset can use any logical system.

We’re going to see a lot of rethinking of the token models that are being used in the current blockchain space.


Disclaimer: Spartan Group, Spartan Capital nor any of its personnel have an open position on Atoms at the time of this writing.