To start developing applications using Cartesi Rollups, first make sure that the packages listed in this section are all installed and working in your system. The instructions listed below should be enough to turn a fresh copy of the latest Ubuntu LTS distribution into a fully fledged Cartesi development environment.
Before installing any package specifically needed for Cartesi Rollups development, we must first make sure that some basic tools are available.
First of all, let's install the
curl tool for transferring data using a number of supported protocols:
sudo apt-get updatesudo apt-get install curl
Now, let's also install the
wget tool for non-interactive download of files from the Web:
sudo apt-get install wget
Docker is a widely used platform for users to build, run, and share applications with containers, and is a great way of distributing the Cartesi Rollups framework and all of its dependencies. Docker Compose is an additional tool that allows us to start multiple Docker containers simultaneously and set up the communication between them. With Compose, we can locally instantiate a full Cartesi Rollups environment (i.e., all off-chain and on-chain components, including the local "testnet" blockchain itself), and thus test our Cartesi DApps using only your physical development machine.
To install Docker and Docker Compose, you can follow the official installation instructions from the Docker website. For Ubuntu, you may also refer to installation instructions that are specific for the platform. Below, we reproduce the installation steps that we have verified as working for a fresh Ubuntu installation:
First, we need to set up Docker's repository:
sudo apt-get updatesudo apt-get install ca-certificates curl gnupg lsb-releasesudo mkdir -p /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgecho \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
And then install Docker itself:
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Finally, it is a good idea to allow non-root users to manage Docker, so as to avoid having to type
sudo for every Docker command:
sudo usermod -aG docker $USERnewgrp docker
After that, you can check if Docker is property installed by running:
It is recommended that the installed Docker version be at least
20.10.14 in order to adequately build a development environment and execute example DApps made available by Cartesi.
To install Node.js, follow the official instructions. Specifically for Ubuntu, you can perform the steps below:
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -sudo apt-get install -y nodejs
And then test them:
node –-versionnpm –-version
Yarn is a great dependency management tool, and will be used for adding dependencies to your Cartesi DApps. You can install it by accessing the official installation site. The official instructions for installing on Ubuntu are as follows.
First, configure the repository:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
And finally, test that Yarn is installed and working property: