Composable Finance
Published in

Composable Finance

DotSama x Cosmos: Composable’s perspective

As a team that actively works with both the Polkadot and Cosmos ecosystems, we believe that their reconciliation will create a trustless and cohesive experience for Web3. The culmination of our efforts manifests itself in the cross-chain virtual machine (XCVM), a top-level orchestration layer for deploying and executing cross-chain functions. The XCVM will allow for the deployment of natively cross-chain, trustless applications, powered by our underlying infrastructure along with IBC. Composable Finance looks forward to attending Cosmoverse in Medellin, Colombia between September 26th to 28th where we will be demonstrating the power of the XCVM highlighting some of its novel features.

You can catch our Founder and CEO, 0xBrainjar presenting on September 26 at 18:20 EST as well as our CTO, Karel, speaking on the Bridging CosmWasm panel on September 27 at 16:50 CET. In preparation for our presentations, to benefit members of DotSama and Cosmos, this blog provides an overview of both ecosystems and our unique perspective of why each ecosystem is distinct but must be connected to amplify the benefits that DeFi can provide to the masses.

Our Thesis

At Composable Finance we believe that DeFi users should be provided with non-custodial, trustless solutions to interact across the various ecosystems Web3 has to offer. Our dual parachains — Composable and Picasso are the underlying infrastructures that will support sustainable, cross-chain DeFi applications. DotSama and its unique Substrate framework are well suited for this purpose for multiple reasons such as; the shared security model, pallets for the customization of our runtime environment, and the experimental nature of the Kusama Network. We will delve deeper into all of these throughout this article.

Our goal is to facilitate the infrastructure for seamless cross-chain applications, the need then arises for a method of connecting the fragmented ecosystems that currently exist in DeFi. For this, we have chosen to extend the reach of IBC via Centauri, our trustless cross-chain bridge. IBC, an arbitrary messaging protocol, originally native to Cosmos was designed to operate in a trust-minimized manner from the start. As a messaging protocol, IBC allows for any information e.g fungible and non-fungible token transfer/swaps, governance votes, smart contract calls, etc, to be passed between blockchains housing the necessary light client implementations.

With the infrastructure and trustless bridging in place, developers can easily build and or orchestrate applications capable of autonomous interoperability. Thus, allowing users to access previously fragmented ecosystems in an entirely trustless and non-custodial manner. To allow for the seamless orchestration of cross-chain functions we have built the XCVM from the ground up. When combined with satellite contracts, which we deploy within each ecosystem for the decoding of XCVM logic, this will allow developers to deploy asynchronous applications across multiple ecosystems.

In short, the 3 pillars of our ecosystem are as follows:

  1. Infrastructure — consisting of our dual parachains and the pallets which comprise them
  2. Trustless communication — via our IBC bridge, Centauri
  3. Orchestration — through the XCVM

Together, these pillars enable a seamless user experience that is capable of spanning multiple blockchains. Ultimately, this will allow Composable to become the universal entry point for trustless, chain agnostic execution across Web3. DotSama and Cosmos represent the best avenue for us to realize this ambition, as both ecosystems were designed with interoperability in mind. Their unification through our parachains, along with the XCVM and Centauri, will culminate in a trustless and cohesive experience for Web3.

DotSama defined

The Polkadot ecosystem consists of two layer 0 blockchains (referred to as Relay Chains). The second Relay Chain is Polkadot’s canary network, Kusama. The Relay Chains of DotSama are responsible for providing security, as well as facilitating communication between the L1 blockchains that choose to build on top of them. The result is an ecosystem of interoperable chains, all of which share the same security.

Traditionally Kusama has been referred to as a kind of testnet, but this moniker is a disservice to the network. Kusama itself is a fully functional layer 0 blockchain which currently has a number of L1 blockchains building on top of it. Features are indeed tested on Kusama first before deployment on the Polkadot blockchain. However, Kusama still benefits from the same shared security model as Polkadot. In short, this security model allows all chains connected to either Kusama or Polkadot to benefit from their robust validator set, thus ensuring every chain is provided with the same security guarantees.

Cosmos defined

Often referred to as the internet of blockchains, the Cosmos ecosystem consists of a number of application-specific blockchains which can communicate with each other via IBC. The Cosmos Hub was the first blockchain to launch and can be compared to the Relay Chains of the DotSama ecosystem. The Cosmos Hub facilitates interoperability between L1 blockchains which deploy on the Cosmos Network, similar to the role of Polkadot and Kusama.

Layer 0 consensus mechanisms:

Let us begin by comparing the underlying layer 0 protocols. A layer 0 blockchain provides the foundational infrastructure to support the development of a network of interoperable Layer 1 (L1) blockchains. This foundational infrastructure includes features such as cross-chain messaging formats and shared security mechanisms which we will cover in more detail below.

Polkadot & Kusama (DotSama)

Both Polkadot and Kusama use nominated proof-of-stake (PoS) as their consensus mechanisms which encourage token holders to participate by locking their tokens with a preferred validator in return for staking rewards. Staked tokens are locked for 28 days on Polkadot, and 7 days on Kusama after unbonding. Another potential use case for tokens in the DotSama ecosystem is participation in parachain auctions and crowdloans, which we will discuss in more detail later.

Cosmos Hub

The Cosmos Hub also uses a PoS mechanism powered by Tendermint Core. In order to secure the network and vote on changes, token holders on the Cosmos Hub are incentivized to delegate their tokens to validators for a share of the block rewards. The unbonding process on the Cosmos Hub is 21 days.

In addition to a share of block rewards, the majority of the L1 blockchains hosting on Cosmos Hub distribute airdrops to reward stakers for helping to secure the network. We will be comparing this to DotSama’s crowdloan model shortly.

Infrastructure:

Most blockchains have very opinionated design features that can be difficult or impossible to circumvent. In addition to taking similar “layer 0” approaches to their own blockchains, both Parity (developers of Polkadot and Kusama) and Cosmos teams created extensible infrastructure, which can be used to streamline blockchain development in their respective ecosystems. DotSama adopts Substrate while Cosmos uses Cosmos SDK.

Substrate

Substrate is an open-source modular blockchain development framework. Substrate provides blockchain developers with all of the core functionality they may require when building a blockchain, allowing them to pick and choose which features they would like to implement. This is made possible through Substrate pallets. Pallets are the modular, lego-like building blocks that form the basis of a Substrate chain’s runtime. By leveraging pallet technology, developers can create highly customizable blockchains tailored to a specific use case. All Substrate based chains can then communicate with each other via cross-consensus messaging format (XCM).

Cosmos SDK

The Cosmos SDK provides developers building within Cosmos’ ecosystem with all of the basic functionality required by a blockchain application. Similar to pallets in Substrate, modules allow Cosmos SDK developers to customize their blockchains with application-specific logic. All Cosmos SDK chains can easily implement the IBC module which allows for communication with other IBC-enabled blockchains.

Layer 1:

The power of each layer 0 lies within the layer 1 blockchains it supports. What use is a strong foundation if you don’t build a house on top of it? This is where the layer 1s come in. As mentioned earlier the core purpose of the layer 0 tokens (DOT/KSM/ATOM) is in helping to secure the network. However, there are other purposes for these tokens as well. Both ecosystems have a unique approach to bootstrap the layer 1 blockchains building on top of them.

Parachains

Layer 1 blockchains in the DotSama ecosystem are known as parachains. These are chains which benefit from the shared security of the Relay Chains (Polkadot or Kusama). Additionally, these parachains can communicate amongst themselves via cross-consensus message passing (XCMP). We will discuss this in more depth later in the article however, the primary focus here is on identifying the launch process for a parachain within DotSama.

Parachain auctions are utilized to decide who can connect to the Relay Chains of DotSama. Since there are currently a limited number of parachains that each Relay Chain can support, teams can bid for these parachain slots in parachain slot auctions. Parachain slot auctions are now running continuously on both Polkadot and Kusama. Another confusing aspect can be that these parachain slots do not provide permanent access to the Relay Chain. Rather, teams are given access for the duration of 1 lease period which is roughly 2 years on Polkadot and roughly 1 year on Kusama. At the end of this lease period, teams will be required to bid for a new lease to remain connected to the Relay Chain.

This opens up another avenue of utility for holders of DOT/KSM because teams will often choose to host “crowdloans” rather than trying to self-fund their parachain slot. It is important to note that although crowdloans are often compared to ICOs, they are starkly different. Unlike ICOs where project teams have custody of contributors’ funds, teams that choose to host crowdloans are never in custody of the participant’s tokens. These tokens are secured on the Relay Chain and returned at the end of the parachain team’s lease period. In return for locking their tokens for the duration of the lease period, participants are rewarded with parachain-specific tokens.

Zones

Layer 1 blockchains in the Cosmos ecosystem on the other hand are referred to as zones. Zones share a somewhat similar relationship with the Cosmos Hub that parachains share with the DotSama Relay Chains. Namely, zones are sovereign blockchains that can utilize CosmosSDK modules to create application-specific blockchains. These application-specific chains then leverage the Cosmos Hub to communicate with each other via IBC.

Within the Cosmos ecosystem, teams have largely adopted an airdrop model to distribute value to active participants within the Cosmos community. This serves as an additional incentive for stakers in the Cosmos ecosystem, as oftentimes these airdrops will be distributed amongst stakers on the Cosmos Hub as well as L1s such as Osmosis or Secret Network.

Smart contracts:

In addition to taking different approaches to their infrastructure layer, the 2 ecosystems also differentiate with regard to their smart contract implementations. DotSama adopts the ink! smart contracting framework, while Cosmos is largely dominated by the CosmWasm framework. We hosted a Twitter space with the founder of CosmWasm, Ethan Frey, where we discussed the merits of each framework which we will further explore below.

ink!

ink! is the smart contract framework of the Substrate ecosystem. Similarly to Substrate itself, ink! has adapted a subset of Rust with which developers can write smart contracts. Rust also provides first-class support for WebAssembly. Designed for shipping small binaries across the globe over potentially slow internet connections, WebAssembly is the perfect solution for a smart contract framework.

CosmWasm

CosmWasm is short for Cosmos WebAssembly, similarly to ink! code in CosmWasm is written primarily in Rust. Both ink! and CosmWasm serve a similar purpose within their respective ecosystems, so the benefits listed above apply to CosmWasm as well. CosmWasm has been built as a Cosmos SDK module and can therefore be easily implemented by any team building with the Cosmos SDK. So why did we choose to implement CosmWasm on Picasso rather than ink?

The main limitation we encountered with ink! was that it follows a synchronous execution model, rather than the asynchronous nature of CosmWasm’s actor model. We felt that CosmWasm’s actor model better represented the future we have envisioned for cross-chain communication and communication between smart contracts themselves. For this reason, we chose to implement CosmWasm on our own parachain. However, our decision to adopt CosmWasm on our parachain will not divide the developer base within the Polkadot ecosystem as both ink! and CosmWasm contracts are written in Rust.

Additionally, we believe that CW20 tokens have a legitimate chance of becoming the cross-chain token standard, possibly eliminating the need for wrapped tokens entirely. To paraphrase a statement from our Founder and CEO, 0xBrainjar in a recent Twitter space:

“What we don’t want happening is assets going from one chain to another and you start seeing things like DOTaxlUSDC or something crazy because it’s been wrapped so many different times, right? So I think every chain is going to have to basically reach an agreement with the destination chain to agree on assets getting passed back and forth. And I think there’s a really big chance that CW20 becomes the interchain standard.”

By adopting the CW20 standard now, we will be well positioned to take advantage of this liquidity, as CW20 tokens are a much preferable alternative as we move towards a cross-chain, interoperable future. To quote 0xBrainjar once more.

“It’s important that every ecosystem treats these assets that are getting passed over IBC as canonical assets that they whitelist into their module. So for instance, if you have something like printing axlUSDC onto the Axelar chain and then bridging that to Osmosis. That should stay axlUSDC because you have inherent bridge risk. But if you bridge USDC over IBC from Ethereum to Osmosis directly, I believe that should be called USDC to be honest, because there is no bridge risk.”

The difference between wrapped tokens vs CW20’s approach can be seen below:

This is the first implementation of a CosmWasm compiler on a Substrate based chain, and we are excited to see where this leads us. Particularly upon the launch of our own XCVM with which developers will be able to write CosmWasm contracts with further reach than ever before.

Security:

As can be seen, the DotSama and Cosmos ecosystems have taken a very similar approach to scale blockchain technology through their layer 0 protocols. However, at this point in the article, we will begin to see where the teams differ in terms of implementation. Within DotSama, the main draw is arguably the shared security model as XCMP is still a work in progress. Within Cosmos, the main draw is arguably IBC as Interchain Security is still a work in progress.

Shared security model

At Composable Finance we chose to build our dual parachains in the DotSama ecosystem primarily because of the shared security model. The shared security model essentially allows for parachain teams to benefit from the economic security of the Polkadot or Kusama Relay Chain at no cost. Upon securing a parachain lease the Relay Chain validator set becomes the securer of the parachain’s state transitions. This model is compared to traditional layer 1 security below:

Image courtesy of Parity’s blog post on the basics of Substrate/Polkadot

Interchain Security

For now, the main difference between zones and parachains is the former’s lack of a shared security model akin to that of the DotSama ecosystem. Currently, when launching in the Cosmos ecosystem teams are required to bootstrap their own validator set. While this may initially mean a lower financial stake, connecting to less secure blockchains can present a security risk.

Interchain Security currently in the works will allow the Cosmos Hub to share security with other blockchains i.e.for a provider chain to produce blocks for a consumer chain. For example, the Cosmos Hub could produce blocks for a new chain launching in the ecosystem. This would provide the new chain with the same economic security as the Cosmos Hub itself. A pre-release of Interchain Security was recently announced.

Messaging:

On the other hand in terms of messaging protocols, the Cosmos ecosystem currently benefits from a more robust interoperability protocol with IBC.

XCM

XCM is DotSama’s cross-consensus message format. XCM is not the protocol for sending messages between chains, rather it is a format for how message transfers should be performed. There are currently 3 messaging protocols within the DotSama ecosystem:

VMP

Vertical message passing (VMP) refers to the messaging protocol between a relay chain such as Polkadot or Kusama, and a parachain such as Picasso. Vertical messages can consist of either upward message passing (UMP) wherein a parachain sends a message to the relay chain, or downward message passing (DMP) wherein the relay chain sends a message to one of their parachains.

XCMP

Cross-chain message passing (XCMP) then refers to the ability to pass messages to other parachains connected to the same relay chain without the need to interact with the relay chain itself. This is currently a work in progress and as such HRMP has been introduced as a stop gap solution.

HRMP

Horizontal relay-routed message passing (HRMP) are messages that are passed between 2 parachains by utilizing their shared relay chain. This is more demanding on the relay chain as it is required to use its own storage for such messages. HRMP will be phased out in favor of XCMP after its implementation.

Ultimately, we feel that while XCM and XCMP may be favorable for use within the DotSama ecosystem, there is an underlying need to communicate trustlessly with sovereign blockchains outside of this ecosystem as well. This is why the Composable team has been working to bring IBC not only to DotSama itself but also to other protocols such as NEAR, Polygon, Aptos and more.

IBC

The Inter-Blockchain Communication protocol allows for heterogeneous blockchains to interact in a trust-minimized manner. IBC makes no assumptions about network topology. This means any blockchain capable of housing a light client is capable of communicating via IBC. In addition, proof of work blockchains can also communicate using IBC through the use of threshold finality gadgets.

A high-level depiction of IBC’s implementation can be seen below.

Image courtesy of Interchain Foundation’s blog post on IBC

By working closely with entities like the Interchain Foundation we are helping Cosmos realize its vision of becoming the internet of blockchains as we work towards extending the reach of IBC to blockchains such as NEAR protocol and DotSama itself via Centauri.

Wallets:

Now you are probably wondering how you can get involved with each ecosystem. Below we will briefly introduce the popular wallet extensions within each ecosystem.

Polkadot

  • The Polkadot{.js} extension is the traditional wallet of the DotSama ecosystem
  • Talisman and Nova provide a more familiar, user-friendly interface for interacting with DotSama.

Cosmos

  • Keplr Wallet is the go-to wallet within the Cosmos ecosystem.

Wrapping up

Hopefully, this article has served as a suitable introduction to both the Polkadot and Cosmos ecosystems. While the two protocols started at opposite ends of the spectrum, it is clear that both aim to solve the same fundamental problem. At Composable Finance we believe that there are merits to building within both ecosystems which is why we have chosen to build the first IBC-enabled parachain, thereby uniting Substrate with Cosmos for the first time. We will continue to consolidate our efforts around both ecosystems focussed on interoperability for the betterment of the industry as a whole.

For more information about Composable and how it is architecting the unified DeFi landscape of the future and composing DeFi for mass adoption, check out our socials:

Twitter | Telegram | Discord | Website | GitHub | LinkedIn | Youtube

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store