Tutorial: Performant and Secure Applications on the Internet Computer

2022, March 1 @ ASPLOS, Lausanne, Switzerland

In May 2021 the Internet Computer, a web-speed smart contract and app platform, went live. After less than 6 months, the internet computer hosts more than 12'000 smart contract apps and serves more than 100’000 users, providing a plethora of services, ranging from social media and chat applications to DeFi and NFTs. Thanks to its architecture and support for new service and business models, the internet computer has the potential to change how we develop, host and use apps.

In this tutorial we host sessions on developing apps that offer enhanced security on this decentralized platform, how such smart contracts are executed securely in a sandboxed environmentand how trust can be increased further with reproducible builds.

Trustless Web Applications on the Internet Computer (14:00 - 15:00 GMT+1)

Speaker: Kyle Peacock

Summary: This tutorial will show how the DFINITY Foundation’s research can be practically applied to power a fully decentralized application development stack, colloquially known as Web 3.0. Come learn how you can write an app thats offers enhanced security on a decentralized and trustless network, while maintaining performant reads and writes for users

This demonstration will cover:

Bio: Kyle has taken on the role of team lead for the SDK team, within a year of joining DFINITY as a frontend engineer. Kyle takes pride in his ability to break down complex topics and to explain them in an intuitive and conversational manner. His passion is for user-centered application design, particularly when it comes to accessibility.

Smart contract sandboxing (15:00 - 17:00 GMT+1, with a coffee break at 16:00-16:30)

Speaker: Helge Bahmann

Summary: Smart contract code execution is confined by the WebAssembly runtime. The constraints of the runtime are enforced by a) limiting access through the system API and b) correctness of the JIT-compiled native code derived from the WebAssembly code. The full implementation correctness cannot necessarily be fully assumed due to the complexity of the components. Additionally, even with a perfectly correctly operating JIT compiler, the generated native code executes in the context of its host process. This makes it indistinguishable from all other code executing in the same process to the CPU. As a consequence, the CPU fundamentally cannot be stopped from performing speculative access to any memory reachable to the host process. This can be abused by completely legitimate WebAssembly code to trigger such speculative access. Timing measurements against code execution paths may then reveal secrets.

The tutorial will cover the following topics:

Bio: Helge is a researcher at DFINITY foundation and focuses on operating systems and system security measures. Other interests include compilers, functional intermediate representations, CPU architectures and formal methods in software construction. He holds a PhD in computer science and has previously worked at Secunet and Google. In the past 20 years he has been working on and off on various parts of the Linux OS environment.

Reproducible Builds or “What Code is this Smart Contract Running?” (17:00 - 18:00 GMT+1)

Speaker: Ognjen Maric

Summary: Computer programs are usually written in a high-level language, but then compiled to a lower-level language in order to be executed. Software auditors generally look at the high-level source code. This leaves a gap: there is generally no guarantee that the deployed (compiled) artifact is really the result of compiling the audited source code, and thus no guarantee that the audit results apply to the deployed artifact. Reproducible builds fill this gap: they allow any third party with access to the source code to verify that a provided artifact really results from compiling the source. Reproducible builds are especially important in the context of decentralized finance, where users transfer the control of their digital assets to a smart contract, and have to trust that the smart contract will operate according to the claims made by its authors and auditors.

In this tutorial, we will examine the landscape of reproducible build tools for the official supported languages on the Internet Computer: Motoko, Rust, and Javascript. We will also cover other, more general tools useful for reproducible builds, such as Docker and Nix.

This tutorial will also have a hands-on part: we will see how to use these tools in practice to write a canister that can be built reproducibly. To follow along, you will need a Linux or Mac machine, as the Canister SDK is currently only supported on these platforms. Furthermore, we will make extensive use of the following tools:

If you want to follow along, the following two Docker container definitions will come in handy:

Bio: Ognjen is a researcher at DFINITY foundation, focusing on formal methods and security. His other areas of interest include distributed systems and programming languages. He holds a PhD in formal methods from ETH Zurich, and has previously worked at Digital Asset, designing, verifying and implementing security protocols.