This site requires Javascript to be enabled.

What are multi-chain contracts?

CosmWasm is designed and built from the ground up to be a multi-chain solution for smart contracts. As it comes from the Cosmos ecosystem, it was designed for networks of blockchains, rather than siloed chains. But what exactly is meant by multi-chain?

Different chain, same contract

All code is designed to be agnostic to the details of the underlying chain, so by writing a CosmWasm contract, you will be able to run it on different chains within the Cosmos ecosystem.

Inter blockchain contracts

CosmWasm contracts leverage the Inter-Blockchain Communication protocol (IBC), making it possible to handle authentication and data transport between blockchains. Because IBC provides a permissionless way for relaying data packets between blockchains, CosmWasm allows you to write code on one chain that can execute a transaction on another chain.

In order to achieve this, CosmWasm fully adopts the actor model, ensuring that the code is designed with IBC usage in mind. As a result, in CosmWasm, messages follow a "fire-and-forget" approach, eliminating the need to await promises and reducing concerns about race conditions and reentrancy attacks. By incorporating IBC primitives into CosmWasm's libraries, you can unlock the full potential of inter-chain messaging and execution.

Easy to integrate

CosmWasm has been designed more as a library than a framework, minimizing required APIs. This allows you to take advantage of CosmWasm without being heavily dependent on it.

This offers two significant advantages:

  • It simplifies the process of adding support for multiple languages to write smart contracts.
  • As it places limited demands on the host system, it can be integrated into other frameworks besides just the Cosmos SDK. The core runtime logic cosmwasm-vm is written in Rust, while wasmvm offers a generic Go binding to it.

CosmWasm is designed to be adaptable to different blockchains and coding languages. This makes it a solid foundation to build upon, as all your smart contracts and dapps can be migrated to another chain.