What follows is a summary of the architecture and the components that are involved in running a Cartesi Compute Application, meaning some DApp that makes use of our SDK. It is convenient to start with the description of the typical ingredients involved in a decentralized application. Namely, the blockchain node and the client software.
- create and initialize project for the Calculator Cartesi Compute DApp
Cartesi Compute SDK Environment
- describe easy-to-use environment available for developing Cartesi Compute DApps
Choose your Onboarding Path
Our onboarding paths answer the following questions:
As explained in the previous section, the Cartesi Rollups framework achieves scalability by moving the bulk of the computation outside the blockchain, using the ledger as a data source but not as an execution environment. As such, the solution contains both on-chain (layer-1) and off-chain (layer-2) components.
Creating basic DApp
- create and initialize a basic project for a Cartesi Compute DApp
Borrowing from familiar mainstream terminology, from a developer’s point of view a Cartesi DApp is developed by implementing two main components: a front-end and a back-end.
DApp life cycle
Now that we have described the architecture of a Cartesi DApp and how the front-end and back-end communicate with the Cartesi Rollups framework, let’s step back a bit to discuss how a DApp can be implemented in practice.
Dogecoin Hash project
- create and initialize project for the Dogecoin Hash Cartesi Compute DApp
This section describes in detail the Drive _inputDrives parameter of the instantiate call.
At this point, an overview has been given of what constitutes a Cartesi computation, who are the parties involved, and what the software components of Cartesi Compute are. It is important to understand better what events happen during the execution of a Cartesi Machine.
- ensure all dependencies necessary for running the tutorials are installed
Generic Script project
- create and initialize project for the Generic Script Cartesi Compute DApp
GPG Verify project
- understand use case of using GPG for document signature verification
Hash view of state
One of the key goals of moving computations off-chain is to allow them to manipulate vast amounts of data: so much data that it becomes economically prohibitive to explicitly store them in the blockchain.
How it works
Cartesi Compute SDK allows Cartesi DApps to specify and request verifiable computations to Cartesi Machines. Additionally, the SDK provides tools to facilitate and reduce the cost of inputting data into Cartesi Machines.
This section describes the main ingredient of the on-chain Cartesi Compute infrastructure.
This section describes Cartesi Machines from the perspective of the blockchain.
The Cartesi Machine is Cartesi's solution for verifiable computation.
- give step by step instructions about how to build a DApp using the Cartesi Compute SDK
A relevant limitation of the Cartesi Machines as they have been described until now is the size of their input drives.
This entire chapter is for advanced users only, since typical users of the Cartesi platform will likely never need to programmatically control a Cartesi Machine.
Although an extensive documentation of Cartesi Machines can be found here, one may choose to skip this reading and jump right away to their usage inside the blockchain through Cartesi Compute. For that, it is enough to regard a Cartesi Machine as a black box that executes computations.
Having discussed the concept of Cartesi Machines off-chain, capable of booting a Linux operating system and loading heavy-weight libraries, one naturally wonders how this will ever be stored or executed on the limited environment of a blockchain. The simple answer is that it won’t be.
Having informally discussed how Cartesi Compute represents Cartesi Machines on-chain, one can now describe in more details the API for requesting and retrieving computations in Cartesi Compute.
The combination of an Optimistic Rollups framework and the Cartesi Machine Emulator enables the development of smart contracts and DApps using any package or library that is available for Linux. This allows developers to break free from the scalability limitations of the Ethereum Virtual Machine (EVM), and brings the rise of a new blockchain era to handle real-life and complex use-cases.
The Cartesi Compute documentation is a work in progress so please navigate to Quick Start for building DApps
Cartesi's reference off-chain implementation of Cartesi Machines is based on software emulation.
Platform Services is a new product developed and maintained by the Cartesi team that hosts Cartesi Node infrastructure for DApps. The service is elastic, making resources available to DApps upon demand. Developers deploy their Cartesi DApps on Platform Services and it automatically allocates resources according to user activity.
After going through the last section, the reader is already able to specify drives if the data was available to the caller at the time of instantiation.
Putting Things Together
To better understand how Cartesi Compute can be used, imagine the following simple Cartesi DApp with one claimer and one challenger. The DApp can be a skill-based game where players place their bets and challenge each other for the highest score over the blockchain. The winner takes the pot.
Rollups HTTP APIs
In a Cartesi DApp, the front-end and back-end parts of the application communicate with each other through the Rollups framework via a set of HTTP APIs.
The scalability issue is one of the three parts of the Blockchain Trilemma, along with security and decentralization. Solving the scalability issue refers to any type of improvement within a blockchain system in terms of computational power, throughput, latency, bootstrap time, or cost per transaction. For example, high gas fees make it expensive for users to pay for their transactions within the Ethereum blockchain.
Broadly speaking, the Cartesi layer-2 platform architecture should be perceived as blockchain-agnostic, given that in principle any network could use Cartesi Machines to move complex computations off-chain without compromising on decentralization.
The Blockchain OS
Cartesi, The Blockchain OS, is a layer-2 platform for the development and deployment of scalable decentralized applications. The Blockchain OS offers a Linux operating system coupled with a blockchain infrastructure, which allows DApps to be developed in familiar programming languages like Python without the need to write Solidity code.
The off-chain API
After the call for instantiate, the blockchain may already have all information that is necessary to execute the machine. But in many cases it also needs to get input from other users. In a game for example, the user may need to insert their decisions on input drives for later processing.
When users interact with their blockchain DApps, they are free to manage and run their own blockchain nodes if so they wish. In a common scenario of the usage of the Ethereum network, DApps are accessed via browser and blockchain transaction requests are carried out by Metamask. The user signs the transaction which is typically sent to a remotely hosted node, such as Infura.
This section is still under construction.
Cartesi is a second layer solution.