Skip to main content

Installing a Lite Node

Lite nodes are the same as mining nodes within the AIBlock system, except that they perform no mining activities. They can also be installed in one of two ways:

  1. Docker container
  2. Built from source

..

Docker Container

⚠️ Running docker on your machine will get you up and running quickly but should not be considered production level. This requires a lot more orchestration that is not in scope of this document.

Running a mining node through Docker can be done through two main methods:

Running Docker directly

The Docker image for the user node is available here:

ghcr.io/aiblockofficial/network/node-user:latest

You can run the container from the image directly:

docker run -d -p --name aiblock-user 3000:3000 \
-v ./user:/src \
-v ./node_settings.toml:/etc/node_settings.toml \
-e ADDRESS="127.0.0.1:12340" \
-e WITH_USER_INDEX="127.0.0.1:12350" \
ghcr.io/aiblockofficial/network/node-user:latest user
  • -p 3000:3000 sets ports used for the user's REST API.
  • -v ./user:/src mounts your local filesystem so the user's wallet may be persisted.
  • -e ADDRESS sets the ip:port of the node. If more than one node will be running from the same IP address, the port number has to be different for each node.
  • -e WITH_USER_INDEX also starts a user node with a wallet to hold the tokens.

You might also need to run with --user on some Linux systems for mounting permission purposes.

Using docker-compose

You can clone docker-compose.yml files from the Docker nodes repo at: https://github.com/AIBlockOfficial/DockerNodes.

From the DockerNodes folder you can cd user-node, and then run docker-compose up -d for detached mode and inspect the logs using docker-compose logs --follow. The user node will use the node_settings.toml in the folder for all the settings that would normally be declared manually in a direct run.

..

Build from Source

To build a lite node from source, you can implement the following steps:

Setup

The AIBlock Network runs on Rust, so installing this is the first step before dealing with any code. You can install rustup, Rust's toolchain installer, by running the following:

curl https://sh.rustup.rs -sSf | sh

When asked how to proceed, simply selecting the option 1) Proceed with installation is generally the best. You can then run the following to update the PATH variable and check whether everything installed correctly:

source $HOME/.cargo/env
rustc --version

If the terminal responds with the rustc version you're currently running then everything went well, and you're ready to go.

Linux

Linux (Ubuntu 20.04.01 LTS) may require extra package installations depending on what you've developed before. The following package installs assume a completely new machine instance, and should cover everything you need to get going:

sudo apt install build-essential
sudo apt-get install m4
sudo apt-get install llvm
sudo apt-get install libclang-dev

The above should enable you to install librocksdb-sys successfully, but older versions of this crate had bugs so it would be wise to ensure you've installed rocksdb = "0.21.0" or higher in order to avoid compilation issues.

Lite Node Build

With the prerequisites set up, you can now clone the repo to your local machine:

git clone [email protected]:AIBlockOfficial/Network.git

You can then build everything by running

cargo build --release

This will compile everything into a release state, from which you can then run the following to connect to the Playground testnet to mine:

RUST_LOG=warp target/release/node user --config=src/bin/node_settings_playground.toml --api_use_tls=0`