Quickstart
Welcome to Quickstart. The goal of this guide is to build a decentralized application quickly with the Cartesi CLI.
This guide uses Cartesi Rollups 2.0, which is an alpha pre-release and not yet ready for production use. For the current stable release, see the Cartesi Rollups 1.5 documentation.
Set up your environment
The primary requirements for building on Cartesi are Docker Desktop and the Cartesi CLI.
If you use Windows, you must have WSL2 installed and configured for building. In Docker Desktop settings, confirm that the WSL2-based engine configurations are enabled.
Install Docker Desktop and Cartesi CLI
-
Install Docker Desktop for your operating system.
To install Docker RISC-V support without using Docker Desktop, run the following command:
docker run --privileged --rm tonistiigi/binfmt --install all -
Download and install Node.js 24 or later, the version the Cartesi CLI requires.
-
Cartesi CLI is an easy-to-use tool to build and deploy your dApps. To install the 2.0 pre-release, run:
npm i -g @cartesi/cli@2.0.0-alpha.42Install this exact version:
npm i -g @cartesi/cliwithout a version installs the 1.5 CLI.
Create an application
To create the backend application from scratch, run:
cartesi create <dapp-name> --template <language>
This creates a new directory with template code in the language you specify.
$ cartesi create js-dapp --template javascript
✔ Application created at /js-dapp
Your application entry point will be the src/index.js file.
Build the application
To build your application, ensure you have Docker Desktop running.
After that, you can run the command provided below:
cartesi build
The cartesi build command builds a Cartesi machine and compiles your application so that it is ready to receive requests and inputs.
Run the environment
To run the environment, you can use the following command:
cartesi run
This will run your backend with the docker containers for the Cartesi Rollups environment including Rollups validator node and the Anvil devnet.
Send inputs to the application
You have some options for sending input to your application. One option is the cartesi send command.
Another option is Cast, a command-line tool for making Ethereum RPC calls.
Additionally, you can build a custom web interface to input data into your application.
Using Cartesi CLI
With the environment running, send a string input to your application from another terminal in the application directory:
cartesi send "hello"
cartesi send uses devnet account 8 as the sender. Run cartesi send without an input to choose the encoding and type the input interactively, and use cartesi deposit to send Ether or test tokens. See Send inputs and assets for all the options.
Using Cast
Here is how you can send input to your dApp with Cast:
cast send 0xEbE9f4Dfc04ae10bBeE663859c3dc5A23f94eA3C "addInput(address,bytes)" <application address> <encoded payload> \
--rpc-url http://127.0.0.1:6751/anvil \
--private-key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
0xEbE9f4Dfc04ae10bBeE663859c3dc5A23f94eA3C is the InputBox contract, and the private key is the one of devnet account 8. Replace <application address> with the address that cartesi run prints, and <encoded payload> with your input as a 0x-prefixed hex string. You can list the contract addresses of the devnet with cartesi address-book.
Do not send transactions from devnet account 0 (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266): the local node signs its claims with it.
Using a custom web interface
You can create a custom frontend that interacts with your application.
Follow the React.js tutorial to build a frontend for your application.
Deploy the application
To deploy your application, run your own Cartesi Rollups Node: follow the self-hosted deployment guide.