Oasis Office Hours

Get a recap of our latest office hours on Blockchain WASI, and our new Rust development SDK.

The Oasis Team
Jun 25 · 4 min read

Sign up for our newsletter for future updates

Last week we had our third Oasis Office Hours. Oasis engineers Nick Hynes and Will Scott discussed why we’re using WebAssembly at Oasis, and our new Rust development SDK.

Don’t worry if you missed it! We’ve published full-length recording here, and provided highlights below.

Want to dive deeper? Here are some useful resources:

WebAssembly and WASI for blockchain

Q. What is WebAssembly?

Wasm or WebAssembly is a portable, intermediate representation design for the web. What’s neat, is that it really can run anywhere — and safely! In a blockchain context, the closest thing you can compare it to is EVM bytecode.

Q. How does Wasm compare to EVM?

In Wasm, the bytecode is even lower level than EVM. If you consider RISC vs CISC — WASM is much more like RISC. There isn’t a “do the thing” opcode that implements large swaths of your program — instead you specify everything using primitive operations. The benefit of this is that you get a lot of flexibility; an optimizing compiler can always group the commonly co-occurring ops anyway.

WASM is broader then just web. We’ve seen it on the cloud side for serverless, and we’re seeing an uptick in blockchain as well — which we hope will provide additional tooling and a wider range of language support.

Q. What languages work with Wasm?
Any LLVM language (C, Scala, Rust, Haskell, Fortran, etc.) can target WebAssembly. For blockchain, this means folks don’t have to use Solidity, and, instead, can develop in a language with which they’re more familiar.

Q. What is WASI?
WASM by itself only allows you to do pure computation. Imagine if you had to write a JS program with no access to the DOM (or a Node program without the file system). WASI provides a standard to make system calls and interacts with the outside world. In other words, WASI the minimal set of things you need to have an operating system in WASM.

Q. How would WASI look in a blockchain context. We’ve got WASI as the emerging standard. How would we interpret blockchain semantics in this same API.
Ideally the blockchain would be totally hidden from the developer. A program would just look like normal code and run on a replicated, privacy-preserving platform. That’s exactly what we’re trying to accomplish. Our WASI runtime will translate your normal code into something that fits with the blockchain infrastructure — no additional work needed.

Curious to learn more about Blockchain-WASI? Check out Nick’s full blog post here.

The Rust Development SDK

Q. What is this new Rust development SDK?

Our new SDK is a domain specific language (DSL), but it’s really an un-DSL, because it takes the specificity out of what you’re currently using to write Smart Contracts.

If you take Rust for example, you write a Rust struct, then you’d write an implementation for your struct. Then it retrieves your state automatically from storage when you run your contract, and then once it’s complete it saves them back to storage. Similar to Active Record, but in Rust.

It’s designed to let you use all of your standard Rust tooling like cargo, and makes development look and feel like a traditional development environment.

Most of the time when you’re targeting constrained environments — either an embedded system or blockchain — you don’t have access to the standard library. That’s one of the ways you would restrict the ability to pull in some arbitrary module. You need to make sure you’re living in this world without standards. With our development SDK you can avoid this, which gives you access to things like vex, synchronization primitives, and some nicer APIs that give you much more usability.

The core of why this works is because there’s a WASI standard targeting Rust. By using WASI as a base, it makes a lot of the Rust development just work.

Q. How do you do the blockchain specific things like check balances or make cross contract calls?

Balances you just read from a file. It’s really that simple. If you want to check your own balance, there’s an environment variable you can check.

Cross contracts calls are straight forward too. You just open a socket and then start talking over it. The one limitation is that you can’t have a bi-directional conversation. Instead it’s one-off, where you write to the socket and read what’s returned.

Q. How do you test?

The SDK is very un-opinionated about the tools you use. It’s a little opinionated about the syntax, but what you get for that is all the normal Wasm and Rust tooling that you’re used to.

Q. Can we see a sample of the code?

Check out our demo here:

For questions about Oasis Labs email us at info@oasislabs.com and we’ll get back to you ASAP.

Oasis Labs

Oasis Labs is building a privacy-first cloud computing platform on blockchain. We're hiring! Apply at https://www.oasislabs.com/jobs

The Oasis Team

Written by

Oasis Labs

Oasis Labs is building a privacy-first cloud computing platform on blockchain. We're hiring! Apply at https://www.oasislabs.com/jobs

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade