How does the XCVM abstract the cross-chain developer experience?

Composable Foundation
Composable Finance
Published in
6 min readAug 25, 2022

--

As ecosystems contend with each other in a zero-sum competition, DeFi’s liquidity is fragmented among them, hampering its overall growth which negatively impacts users and developers alike. The functionalities of applications and protocols must be able to transcend ecosystems if DeFi is to be widely adopted. At Composable, we have identified that CosmWasm, a robust cross-chain smart contracting framework, helps address several problems by allowing developers to write code in a single language for deployment across multiple chains. Thus, a key benefit of Composable’s XCVM is that it abstracts execution environments by leveraging CosmWasm. This frees developers from worrying about where to deploy their applications rather than what solutions to build instead. Thus, CosmWasm and the XCVM enable developers to build and deploy future-proof applications, using a single programming language, that can function cross-ecosystem.

Roadblocks for DeFi developers

We believe that DeFi, across its many chains and layers, presents a highly attractive, yet untapped, opportunity for both retail and institutional investors. The challenge in bringing these users into DeFi lies in the inability for developers to build applications that effectively leverage and abstract DeFi’s various ecosystems.

Liquidity moves throughout DeFi in an arguably cannibalistic manner; newer blockchains, rollups and applications take liquidity from older ones, in a self-fulfilling cycle. As a result, not only is this challenging for protocol solvency, but also for end users, who are required to navigate their assets through these various ecosystems.

While end-users are able to move their assets reactively, to the most promising ecosystem that provides them with the most benefits, developers have to decide on their ecosystem preemptively and are often at the mercy of the success of that ecosystem. Additionally, developers have to deal with several complex issues if there is ever a need for redeployment onto a new chain or ecosystem. Developers, unlike end-users, are not afforded the benefit of hindsight; the choice of where to deploy their application is tedious and becomes an arduous endeavor when the need to migrate between chains arises. These problems lead developers to unnecessarily stress over the question of where to build before they can even begin working on their solution.

To further the difficulty for developers, building the best solution in this siloed environment does not necessarily lead to user adoption. As pointed out above, DeFi users tend to choose ecosystems and will migrate toward new ecosystems as opportunities arise. Ultimately, building in an ecosystem that is losing attention or liquidity can be fatal to a project’s success.

Enter the XCVM

These issues can be removed from developers’ minds with the introduction of the XCVM. DeFi at large is enhanced by the ability to deploy natively cross-chain dApps via XCVM and it represents Composable’s bet on a cross-chain enabled DeFi future. With the XCVM, developers aren’t limited to a single blockchain or even a single ecosystem, which can greatly reduce their long-term risks. Thus, developers building on the XCVM benefit from:

Exceptional flexibility

Contracts written in CosmWasm are modular and highly portable, and can therefore be deployed on any chain connected to the XCVM. This is made possible through the XCVM’s satellite contracts. Satellite contracts take different forms as outlined in the XCVM specification. For example, the Substrate rendition has been implemented as a pallet, while on Cosmos it can take the form of a CosmosSDK module, or as multiple smart contracts which interact with one another on an EVM chain.

Regardless of the chain or implementation, these contracts will always consist of the same fundamental building blocks. The end result for developers is that regardless of which chain they wish to deploy to, they will be able to follow the same process. With the XCVM writing, cross-chain applications are as easy as:

  1. Writing a contract in CosmWasm and tapping into the XCVM SDK to leverage cross-chain functionalities such as asset transfer or calling contracts on another chain.
  2. Submitting the XCVM contract via the interpreter instance on your chain of choice
  3. Letting the XCVM infrastructure take care of the rest

XCVM SDK

Developers seeking to deploy applications via XCVM will be able to benefit from the XCVM SDK. Currently, we have a working Rust SDK, which allows developers to build XCVM programs on our parachains. Additional SDKs will be developed, for example, to allow XCVM programs to be deployed from Solidity-based chains. Furthermore, developers building frontend apps might also wish to build with the XCVM, in which case we are also planning to provide a Javascript SDK.

One contract, multiple chains.

With the XCVM you only need to write one contract to deploy a cross-chain application. If you ever need to add support for a new ecosystem, it is as easy as spawning a new interpreter instance. An example of this can be found in the XCVM specification where a developer transfers funds to a new chain, takes out a loan, and transfers the funds back to the original chain. Review the specification for a more detailed overview, but this example is captured below:

Spawn XYZ BridgeSecurity::Deterministic 0 [
Call 0x1337, //chain-specific encoding to make a smart contract call.
Transfer Relayer USDC Unit 50, // 50 bucks for the fee. The relayer earns this if the inner spawn is dispatched.
Spawn HOME BridgeSecurity::Deterministic 0 [
Transfer Relayer USDC Unit 50 // Another 50 bucks fee for the operation, but now reverse direction.
Transfer USER { USDC: Ratio::ALL } // On ABC, we transfer all USDC to the user.
] { USDC: ALL }, // We send over all our USDC back to ABC.
] { DOT: UNIT 100 }, // We send over 100 DOT from ABC to XYZ.

Example of an XCVM program

Unified liquidity and userbases

XCVM developers are able to make their products accessible across all major ecosystems through cross-chain, unified state transition functions via satellite smart contracts. This unification of Cosmos, DotSama and EVM-based chains will allow XCVM developers to interact with the native assets of these typically siloed ecosystems.

With the XCVM, developers will be able to seamlessly transfer assets between these ecosystems and build applications capable of reaching all DeFi users. The possibilities are endless, but some potential use cases are outlined here. Not only will this improve the developer experience for cross-chain applications but also impact end users who will be able to initiate cross-chain asset transfers from source to destination chain with a single action i.e calling the XCVM-enabled contract.

Call into existing applications

Minimizing the need for ecosystem-specific decision-making is one of the primary goals of the XCVM. However, the satellite contracts mentioned above do allow developers to call into existing applications on any chain. Satellite contracts act as a sort of translator that applies chain-specific encoding to XCVM instructions. This enables developers to leverage existing applications across all of DeFi.

Improved UX

While technically impressive, the XCVM’s true power lies within its user-centric design. We believe that ease of use is a necessity to achieve mass adoption. XCVM developers will benefit from this enhanced user experience by leveraging open-source tools, pre-built UI widgets such as Composable’s stepper and cross-chain block explorer within their own applications.

As seen below, the stepper provides users with a visual aid to track the status of their cross-chain transactions. Developers will be able to implement this feature in their own front-ends to help users better understand the applications they are dealing with.

Composable’s stepper

In addition to the stepper, developers will be able to utilize Composable’s cross-chain block explorer as well. The block explorer will provide a similar user experience to traditional explorers, but will also allow users to view the transactions taking place across each applicable chain:

Composable’s cross-chain block explorer

Conclusion

Composable Finance is addressing the fundamental challenges facing blockchain developers today with the introduction of the XCVM. The XCVM was unveiled at our Unchained Conference, where the Composable team presented a deep dive into the philosophy and technology behind the XCVM. We also continued the CosmWasm conversation with the Father of CosmWasm himself, Ethan Frey, in a recent Sofa Series. If you are interested in building on the XCVM check out our grants program here, and be sure to reach out on Discord if you have any questions.

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

--

--

Composable Foundation
Composable Finance

Powering the future of chain-agnostic intention execution.