Posted 5 months ago | by Catoshi Nakamoto

5 steps to develop applications on the blockchain OS

0*nZev0hH8sFh4uw4Y Cartesi DApps are here


Let’s just face it: blockchain development is still hard and limited at its current stage. And while it is true that the blockchain community has committed enormous amounts of energy and effort to tackle some of these issues, a number of them have remained pretty much unaddressed so far.

Technological background

As originally described in Erick de Moura’s article “Cartesi Rollups — Scalable smart contracts built with mainstream software stacks”, Cartesi Rollups is a Layer-2 framework in which application logic can be developed on top of an actual operating system such as Linux, but still integrated with an underlying Layer-1 blockchain and secured by it.

Architecture of a Cartesi DApp

Broadly speaking, from a developer’s point of view, a Cartesi DApp is composed of two main parts: a front-end and a back-end.

0*lIIfPYJD7Ys h0Pm Cartesi DApps are here

0*PgOrgWICw8Pk7QUz Cartesi DApps are here


As illustrated by the architecture figure above, in a Cartesi DApp the front-end and back-end parts of the application communicate with each other through the Cartesi Rollups framework.

Back-end API

From the back-end component’s point of view, the API can be split into two parts, as illustrated by the figure below.

Cartesi DApps are here

  • InspectState — Submits a query about the current application state, to be answered synchronously.
  • AddNotice — Informs about a new relevant state of the application (e.g., updated player rankings).
  • AddReport — Provides diagnostics or logs associated with a received input.
  • Finish — Communicates that the asynchronous processing of an AdvanceState request has been completed.

Front-end API

The front-end part of the DApp needs to access the Cartesi Rollups framework to submit user inputs and retrieve the corresponding vouchers and notices produced by the back-end. The following figure and table detail how this communication is done:

0*KX2VJXcA0JmVI FM Cartesi DApps are here

  • QueryOutputs — Submits a query to a layer-2 node to retrieve vouchers, notices and reports, as specified by the Cartesi Rollups GraphQL schema.
  • InspectState — Submits a query to a layer-2 node to retrieve arbitrary DApp-specific application state. Note that this endpoint is not yet available at the time of writing.
  • ExecuteVoucher — Submits a JSON-RPC blockchain transaction to request a given voucher to be executed by the Rollups smart contracts on layer-1. This is how a DApp’s results, such as a transfer of assets, can take effect on the underlying blockchain. It should be noted that the contracts will only actually execute the voucher if it has been finalized, meaning that its contents can no longer be disputed. Finalized vouchers are explained in more detail in the Rollups On-Chain article.

Development in practice: the DApp Life Cycle

Now that we have seen 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.

0*vrdkMLuVeM8aPCX3 Cartesi DApps are here

Stage 1: Design

This would involve the overall conceptual design of the application, specifying the main scope of the front-end and back-end logic, as well as general technology requirements (e.g., whether it will use an SQL database, execute a trained AI model, etc.)

Stage 2: Proof of Concept

Checkpoint stage to implement a proof of concept ensuring the feasibility of executing the intended back-end logic and tech stacks inside a Cartesi Machine. This stage might involve cross-compiling a library to Cartesi’s RISC-V Linux OS and verifying that the performance of running the intended software in the Cartesi Machine is satisfactory.

Stage 3: Implementation

This is the stage where the front-end and back-end logic are actually implemented, representing the bulk of the work in the DApp’s development life cycle.

Stage 4: Packaging

In this stage, the back-end part is packaged to run inside a Cartesi Machine, to be executed by a real Layer-2 node (i.e., not a development version in which the back-end runs directly on the host). The feasibility of running it inside a Cartesi Machine should have already been accessed during Stage 2, and now we will just see if the full DApp implementation runs satisfactorily as well.

Stage 5: Deployment

With the full application working fine inside a Cartesi Machine, the final step is to deploy it. This can be tested on a local environment in which a Hardhat instance acts as a local blockchain, but the ultimate goal is of course to deploy it to a remote blockchain network.

What now?

We are very excited to be making this solution available to everyone. For the first time, developers can use their favorite mainstream tools to create decentralized applications using virtually any software components, while leveraging a real-world operating system and still keeping the security guarantees of a Layer-1 blockchain like Ethereum.

About Cartesi: Home to what’s next

Cartesi is the first OS on the blockchain, and their Layer-2 solution integrates Linux and standard programming environments to blockchain. This allows developers to code scalable smart contracts with rich software tools, libraries, and services they are used to.

Follow Cartesi across official channels:

Telegram Announcements | Telegram | Discord (Development Community)| Reddit | Twitter | Facebook| Instagram | Youtube | Github | Website

Original article published on Cartesi’s Medium.

(Bitboy Crypto is Invested In Cartesi and we have our own node.)

About Catoshi Nakamoto

c6ea0c3794492f30883e516d39b2597a?s=90&d=blank&r=g Cartesi DApps are hereActivist/Journalist, former writer - We Are Change, The Mind Unleashed, Coinivore, others. Currently writing for - Activist Post and Bitboy Crypto. Not Right or Left Apolitical. I Care About Truths (CATS.) Cryptocurrency enthusiast, I mined and lost 100+ BTC in 2010-2011. I work with - Bitboy, SoMee, CEEK, Presearch, and W3BT aka FMW Media Group. Friend of mostly everyone who isn't a dick. Just A Cool Cat.