RESEARCH: WASM in the Cosmos SDK

#1

I can think of a number of use cases(Staking derivatives, asset issuance, cross chain collateralization etc) where it on chain code would be a helpful.

WASM seems like a great target for some SDK applications for on chain code.

One option is Perlin’s Life golang Wasm engine:

Concerns are mostly that it doesn’t seem to have good support for Host functions to inject into the runtime environment. This pretty crucial if you want your wasm code to actually interact with the rest of the Cosmos SDK.

Wasmer has a C api that looks like it would wrappable in go and could be a nicer path to golang integration.

6 Likes

#2

One downside of Wasmer is that host functions are either going to trampolines in C or rust to golang.

0 Likes

#3

I would like to echo support for this being a focus. Lack of on-chain WASM support is a major downside of the current SDK, and is something thats crucially needed. Its rather trivial to integrate SNARK verifier’s (and the examples you provided). This is also something being explicitly built out for Polkadot, Eth, DFinity, so perhaps there is some potential for standardization that could happen on how WASM code interacts with the blockchain for state. (Or is there a clear way to do this in WASM, I haven’t looked too much into it?)

1 Like

#4

The typical way to interface on chain code with state is via host functions. For instance, a Host function that provides the ability to query data from the multistore. Serialization and deserialization of data from inside the WASM engine is an interesting challenge.

1 Like