NewIntroducing Cartesi’s Technical Evolution Plan. Click to explore.
Grokking the Cartesi Virtual Machine

Grokking the Cartesi Virtual Machine

Tech/Nov 7, 2023/EDUARDO TIÓ
Share:

Grokking the Cartesi Virtual Machine

So, what do we do with all the computational scalability that app-specific rollups afford us? As we explained in Part 2 of Grokking Cartesi Rollups, this enables us to work on design flexibility and scale abstractions. By this, we mean that Cartesi lets developers use familiar tools and repurpose all the existing knowledge and work that exists in open-source code to build better dApps.

The benefits of this are showcased in another key component of Cartesi technology: the Cartesi Virtual Machine, or CVM.

What is a virtual machine?

Let’s start with what a virtual machine is. A virtual machine is simply a program that is able to emulate all the work that is done on an actual computer. We can think of it as a digital version of a computer that includes all the components of a physical computer (CPU, memory…), but it exists entirely in a virtual world.

Virtual machines are incredibly useful, and there are many types of virtual machines that are used for a variety of purposes. They can be an essential part of popular programming languages like Java. They can also allow developers to run applications in the cloud, create isolated environments like Parallels for running Windows applications on Mac, or facilitate testing for new software products — all depending on the type of virtual machine needed.

Virtual machines in web3

In the context of web3 and dApps, virtual machines currently play a role in the deployment and execution of smart contracts. The Ethereum Virtual Machine (EVM) pioneered the concept of running one on top of a blockchain network so developers could program and design transactions.

The problem is that this kind of virtual machine is limited to the time and space constraints of that network. Moreover, it is designed specifically for running these smart contracts. Even when we find ways to use traditional programming languages in blockchain virtual machines, they’re still limited by this paradigm.

Although technically still a virtual machine, current blockchain-based virtual machines don’t behave like a normal physical computer can. They are also unable to run the kind of software that users are used to.

As we saw when looking at games or DeFi dApps, the “CPU” for a virtual machine like the EVM runs 10 million instructions every 12 seconds or so. However, we’ve also seen how app-centric rollups like Cartesi Rollups transcend this limitation — they let us take this to over 3.6 billion instructions. Let’s go back to the question of what we can do with this.

A new virtual machine for web3

All these gains in computational power let us build a better kind of virtual machine to work with app-specific rollups. This could bring developers out of the limited world of the Ethereum Virtual Machine and back into the boundless world of traditional development environments like Linux.

This is precisely what the Cartesi Virtual Machine does. The CVM is designed to work with RISC-V, an open standard for an abstract model of a computer that is supported by large corporations like NVIDIA, Intel, Google, QUALCOMM, and Tencent.

RISC-V is powerful enough to run an operating system like Linux as well as the software that it supports. Linux, specifically, can now be a blockchain operating system where web3 developers build dApps that transcend the limitations of the EVM.

Verifiability

The best part is that everything that happens in the CVM is reported back to the blockchain via Cartesi Rollups. As a result, the CVM can provide verifiable computation that enjoys all the benefits of security, transparency, and immutability that are offered by blockchain networks.

This makes the CVM unique in its properties and allows it to have an effective dispute mechanism. If someone were running a dApp on the CVM, none of the parties involved would need to trust each other because the CVM is:

  • Self-contained: It runs in isolation from any external influence.
  • Reproducible: Others can obtain the exact same results returned by it.
  • Transparent: Everything it does can be inspected by anyone.

Taken altogether, this means that honest people running a program inside the Cartesi Machine always obtain exactly the same result. Conversely, dishonest claims over these results can be disputed on the blockchain in a way that the honest result will prevail. That is true even though the Cartesi Machine is many orders of magnitude faster than the blockchain.

Abstraction scalability

But perhaps the most important advantage of working with the CVM is the introduction of abstraction scalability to web3. This is an overlooked aspect of blockchain scalability that is fundamental to building better dApps.

We’ve defined abstraction scalability as follows: “Abstraction scalability is the expansion in the overall ability of a system that allows programming components to be used as building blocks in a new development environment. Abstraction scalability increases the number of important operations a developer can perform without having to rebuild them.”

This means that the CVM gives web3 developers the ability to build better dApps by referencing the work of other developers that are not necessarily in web3 and reusing it as building blocks for their own creations. Abstraction scalability saves them from having to “reinvent the wheel” in order to adjust to the limitations of other blockchain virtual machines.

(Dive deeper into this concept in this post, where it is referred to as “content scalability.”)

The range of abstractions that web3 developers can now use includes anything from Python libraries like numpy to the kind of tools needed to build classic games like SimCity. We’re talking about programming languages, compilers, linkers, profilers, debuggers, and everything you would expect to have in a normal operating system. All of this can run verifiably on-chain thanks to Cartesi and the CVM.

Do you think you grokked the Cartesi Virtual Machine? Test your knowledge by taking the Grokking Cartesi Virtual Machine quiz on the Cartesi questboard.

Learn more about the CVM in the docs. You can also stay in the loop with everything happening in the Cartesi ecosystem by joining the community.

Subscribe to The Cartesi Newsletter

Join our newsletter to stay up to date on features and releases

More from Tech

Tech/Jan 25, 2024

Grokking Cartesi Public Goods: Dave

A look into a public good developed by Cartesi that solves common issues in fraud-proof protocols that validate L2 claims on a main L1 chain.

Written By EDUARDO TIÓ

Tech/Jan 11, 2024

Grokking the Cartesi Explorer

An overview of Cartesi’s block explorers, CartesiScan and Cartesi Explorer, including their features and their specific roles in the wider ecosystem.

Written By EDUARDO TIÓ

Tech/Dec 1, 2023

Grokking Cartesi Nodes

Diving into Cartesi Nodes as a fundamental part of the Cartesi ecosystem, looking into why and how they support Cartesi Rollups and the CVM.

Written By EDUARDO TIÓ

© 2024 The Cartesi Foundation. All rights reserved.