Why should we be getting excited about multiple chain smart contracts?
Smart Contracts enable some logic to be built into an agreement on chain as opposed to a simple payment transaction. The ICO frenzy of 2017 was made possible by the use of Smart Contracts, and since then there have been many created as people experimented with their use.
There have been many Smart Contracts launched on Ethereum, and it is straining the infrastructure. The current strains are not quiet like the advent of Cryptokitties that infamously caused the whole network to slow down and caused a spike in gas prices.
There are alternatives emerging such as Ethermint on Cosmos that lets you run a Smart Contract on an EVM with the advantages of running it on a faster Proof of Stake network.
A 10,000 foot view of CosmWasm
Before going down a rabbit hole of technical wizardry what is CosmWasm and what on earth is a Wasm, let’s look at what CosmWasm does!
CosmWasm was was originally prototyped by Team Gaians at the Berlin Hackatom 2019. In particular, Aaron Craelius came up with the architecture, especially avoiding reentrancy, Jehan Tremback led the rust coding, and Ethan Frey led the go side of the implementation. It was then developed into a full blown project.
The idea behind it is that it can be built into any chain that has been built using Cosmos SDK (and there are lots of them) and without having to change any existing logic. It then means that once installed then the fun can begin and the Smart Contracts can be written and run on the chain as a simple dApp or it can be be written as a multiple chain contract.
CosmWasm is still in its infancy but there is an ambitious road-map behind it, there are some handy features in the pipeline and it is aiming to get adoption through the development community as a go to multiple chain Smart Contract tool-set.
What is the significance of a multiple chain Smart Contract?
One of the issues with Smart Contracts is the need to go “outside” the chain for data or events and this is done using Oracles. The challenge with Oracles are two-fold, firstly the “man-in-the-middle” attack where the data return purports to be from the trusted source but is in fact fake, and secondly there is always the danger of centralisation where there are many Oracles that need data from centralised sources.
The beauty of multiple chain smart contracts is that by bridging to other chains the activity stays on chain and thus addresses the centralisation issue and eliminates the “man-in-the-middle” attack.
Let’s consider the scenario where you port your Smart Contract to Ethermint or CosmosWasm, and interact with data from other blockchains in the Cosmos network, you have in one shot a faster, and more decentralised proposition than before.
This is just the beginning, if you consider how the internet evolved, it relied on interoperability and the underlying protocols that connected things together, then for blockchain which until now has been a collection of silos is now opened up so that the chains can connect to each other and now with the advent of multiple chain Smart Contracts real value can be built connecting all these.
Imagine the scenario where one chain specialised in identity management, another in distributed data stores, another tracking CO2 offsets and a Decentralised Exchange then you have the ingredients to make a nice application for Carbon trading using multiple chain contracts.
The opening up of the chains, through connectivity, and Smart Contracts will bring about new businesses that will create dApps around the many chains that run in the Cosmos ecoystem. These businesses will provide more value through sharing and building value, and the underlying chains who’s data and services will benefit from more traffic to their chains.
What CosmWasm Smart Contracts let you do.
There are a host of things that a CosmWasm contract lets you do, there is an example in the repository of an basic escrow with a timeout and partial release and this is based on the template provided. There are also ERC20, ENS-like name service, and more are being built
The interesting thing with CosmWasm is that is a minimal, opinionated implementation of the bindings between the SDK and the smart contract Virtual Machine. The implementation details are all taken care of, but the power of CosmWasm is that you can make a copy of the basic module and add whatever business logic you want around it.
The CosmWasm Blog explores the options of adding permissions or fees to a contract, limiting storage and some interesting cases of passing messages around and how they might be used.
There are a bunch of features planned to build on the work to date over the next few months. If you are curious about the technical details on how it works there are some nice pointers in the documentation and a technical overview in the blog. If you are interested in getting involved or know tech people who might want to contribute then please spread the word. If you want to experiment with porting your dApp from Ethereum and experimenting with multiple chains then get in touch!
If you are not a techie but have some ideas around building value by connecting the chains through Smart Contracts then start sketching your ideas on a whiteboard and find some go or rust developers.