Skip to main content

General requirements

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.

Section Goal
  • ensure you have all the necessary dependencies for building Cartesi DApps

Basic tools

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 update
sudo 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

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.

To install Docker, you can follow the official Docker Engine installation instructions from the Docker website. For Ubuntu, you can refer directly to the Docker Engine installation instructions for Ubuntu. Below, we reproduce the Docker 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 update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

And then install Docker itself:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

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 $USER
newgrp docker

After that, you can check if Docker is property installed by running:

docker --version

Docker Compose

Docker Compose is a tool that allows us to start multiple Docker containers simultaneously and set up 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.

Follow the official instructions for installing Compose from the Docker website. To make the official site display the instructions for installing on Ubuntu, click on the Linux tab under the Install Compose section. A subsection named Install Compose on Linux systems should appear, and you can follow those. The Docker Compose Linux installation instructions boil down to running the following commands.

First, download the Docker Compose binary (version 1.26.0 was the latest at the time of this writing):

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Then, make the binary executable:

sudo chmod +x /usr/local/bin/docker-compose

And finally, test it:

docker-compose --version

Node.js and NPM

Node.js is a very popular asynchronous event-driven JavaScript runtime, and is often distributed along with the NPM package manager. These are required for running Yarn.

To install Node.js, follow the official instructions. Specifically for Ubuntu, you can perform the steps below:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

And then test them:

node –-version
npm –-version

Yarn

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

Then, run:

sudo apt-get update && sudo apt-get install yarn

And finally, test that Yarn is installed and working property:

yarn --version