Skip to content

How to run your own node

sixTheDave edited this page May 30, 2023 · 41 revisions

Running your QDAO node (beta release)

Minimum system requirements for dev release

CPU: 64-bit, 2+ cores (eg. from AMD Ryzen 3 and Intel i3)
RAM: 16GB RAM, DDR3-1333
Storage: 64GB+ 
GPU: Not needed.
Environment: Non-root user.

Option 1: Running node using docker (limited performance)

You only need docker and npm/yarn to be installed. Everything else will be running inside the container. If you want to expose ports, you need the --expose option, eg. --expose=9944 at the docker run command.

# Building the docker image (Main branch)
git clone https://github.com/Qrucial/QRUCIAL-DAO
cd QRUCIAL-DAO/docker/files
git checkout milestone2
docker build . -t "qdao:V0.3"
docker images

# Running the docker image
docker run -it --name=qdao_testing <image_name>

# Running the docker image with publishing WSS port. Only run this or the previous command based on your network needs.
docker run -it --publish target=9944,published=127.0.0.1:9944,protocol=tcp --name=qdao_testing <image name>

# Access the shell of the running node
docker exec -it qdao_testing bash

# Run the frontend
cd ../../frontend/substrate-front-end-template
yarn install
yarn start

Option 2: Run a full node

Prepare the system

On Debian based systems, eg. Ubuntu, you need to have the following installed:

# Debian packages
sudo apt update
sudo apt-get install tmux git curl python3 python3-pip protobuf-compiler gcc clang libssl-dev llvm libudev-dev make build-essential ca-certificates gnupg -y
pip3 install Flask substrate-interface
# Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install keccak256-cli
rustup install nightly
rustup default stable
rustup update
rustup target add wasm32-unknown-unknown --toolchain nightly
# Docker for exosys / https://docs.docker.com/engine/install/debian/
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# If not qdao user already, add it to docker group
# sudo groupadd docker
# sudo usermod -aG docker qdao
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Frontend
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install node
npm install --global yarn

We recommend to create a qdao user in your Linux system and run the services with that user. We are using $HOME as a base directory for the system. That also means /home/qdao needs to have execution privileges for binaries.

Compile and run the full node system

We have prepared "node-setup.sh" to automate building a full QDAO node. Right now, this script will deploy a local dev node on the machine you are running it on. Execute the following command to start:

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/Qrucial/QRUCIAL-DAO/milestone2/node-setup.sh | bash

Check if the node is running

Check automatically

python3 node-health-check.py

Check manually

tmux ls && echo "" && ps a|egrep "qdao|lar.py"

You should see a similar output:

qdao-api: 1 windows (created Wed Aug 31 23:24:47 2022)
qdao-exosysd: 1 windows (created Wed Aug 31 23:24:47 2022)
qdao-node: 1 windows (created Wed Aug 31 23:24:42 2022)

  63874 pts/3    Ssl+   0:52 ./qdao-node/target/debug/qdao-node --dev
  63966 pts/4    Ssl+   0:30 ./exosysd/target/debug/qdao-exosysd
  63969 pts/5    Ss+    0:00 python3 exotools/lar.py

You can attach to the tmux session using the following commands:

tmux a -t qdao-node
tmux a -t qdao-exosysd
tmux a -t qdao-api

How to stop the node

# Stop services individually
killall qdao-node
killall qdao-exosysd
killall lar.py

# Stop docker container
docker ps
docker stop <container id>

Using the nodes, testing and development

You can move on by following the Development and testing guide