Skip to main content

Installation

This section provides detailed instructions on how to install the Invariant protocol on Alephium, including prerequisites and steps for setting up the development environment.

Prerequisites

Install Node.js

# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# download and install Node.js (you may need to restart the terminal)
nvm install 20

# verifies the right Node.js version is in the environment
node -v # should print `v20.15.1`

# verifies the right NPM version is in the environment
npm -v # should print `10.7.0`

Install Docker Engine

Uninstall all conflicting packages
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
Add Docker to your apt repository'
# adds Docker's official GPG key
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# adds the repository to Apt sources
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install Docker Engine
# installs the latest version
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

#verify if Docker Engine runs correctly
sudo docker run hello-world

Install Docker Compose

Installation of Docker Engine is required before installing Docker Compose.

sudo apt-get update
sudo apt-get install docker-compose-plugin

Protocol

Build

Clone repository

git clone git@github.com:invariant-labs/protocol-alephium.git

Install packages

npm install

Start a local devnet for testing and development

cd alephium-stack && make start-devnet

Compile contracts

npm run compile

Test

All
npm run test
Contracts
npm run test:contract
SDK
npm run test:sdk