At Dfinity, we’re building the Internet Computer, a decentralized cloud computing platform that we conceive as a seamless software universe in which developers can deploy applications and services directly on the Internet. To realize this vision, we decided on WebAssembly as the lingua franca of the platform’s execution environment, so that developers can program it in any language that compiles to WebAssembly.
To offer a seamless developer experience, we also felt it was important to create a specialized programming language, called Motoko, that is designed to directly support the programming model of the Internet Computer, making it easier to efficiently build applications and take advantage of some of the more unusual features of this platform.
We’re excited to share with you a little about what makes this project so special.
First, we have to talk briefly about WebAssembly—a.k.a. Wasm (yes, correctly spelled without all caps). As you may be aware, Wasm is a newish low-level code format that aims to be portable, safe, and efficient. Its initial use case has been the web, but the name actually is a misnomer: when we designed Wasm in the W3C Working Group, we carefully did it as an open standard and a universal platform. That is, it is not aimed at any specific programming language, paradigm, computing environment, or platform, and we made sure that it is not at all tied to the web. So it is absolutely no accident that Wasm is seeing adoption in many other environments, such as cloud computing, edge computing, mobile, embedded systems, IoT, and blockchains.
There were many, many design considerations that went into Wasm, some obvious and some rather subtle. Too many to go into here. A fairly comprehensive discussion of Wasm’s technical goals, design choices, formal semantics, and implementation techniques can be found in a scientific article that we published in Communications of the ACM (an older and more technical version of this article is freely accessible here).
Wasm’s main difference compared to other virtual machines is that it is not optimized for any specific programming language but merely abstracts the underlying hardware, with a byte code directly corresponding to the instructions and memory model of modern CPUs. On top of that, Wasm supports sandboxing through strong modularity and a rigid mathematical specification that ensures that execution is safe, free of undefined behaviour, and (almost) entirely deterministic. Moreover, these properties actually have a machine-verified mathematical proof!
Altogether, these properties were intended to make Wasm an attractive choice for a wide range of environments and use cases that have high expectations for portability, safety, generality, and performance—such as Dfinity’s Internet Computer.
The Internet Computer is a decentralized cloud computing platform that will host secure software and a new breed of open internet services. It uses a strong cryptographic consensus protocol to safely replicate computations over a peer-to-peer network of (potentially untrusted) compute nodes, possibly overlayed with many virtual subnetworks (sometimes called shards). Wasm’s advantageous properties made it an obvious choice for representing programs running on this platform. We also liked the idea of not limiting developers to just one dedicated platform language, but making it potentially open to “all of ’em.”
That’s the theory, anyway. In practice, porting an existing programming language to Wasm is not entirely trivial. Obviously, it requires implementing a new compiler backend. That’s fun, but the effort doesn’t end there: it also requires porting the language’s runtime system and library primitive