Beginner’s guide to Cortex Node

Oscar W
Cortex Labs
Published in
5 min readAug 13, 2021

Running a Cortex full node might seem like a daunting task, however, it turns out to be quite easy.

The free open-source GitHub repository from CortexLabs contains everything you need to set up a computer or virtual machine as a dedicated server to run a Cortex full node in less than 15 minutes.

What is Cortex?

Cortex is the first public blockchain capable of executing AI algorithms and AI DApps on the blockchain. Cortex provides an AI platform for developers to upload their models on the blockchain and be incorporated into smart contracts. Instead of a black box, we can run AI models on the blockchain in a decentralized, immutable, and transparent manner − network consensus verifies every step of the AI inference.

Executing AI models on the blockchain is a difficult engineering problem that was unsolved before the Cortex team developed their own.

The specific solutions involve building a blockchain whose virtual machine utilizes the GPU and applying a quantization scheme to ensure that the execution of deep learning models is deterministic.

What is Cortex Node?

As mentioned above, Cortex has added AI functions to the blockchain which requires its own virtual machines and nodes to support for AI inference and AI contracts. The Cortex Virtual Machine (CVM) is ported from the Ethereum Virtual Machine (EVM) with two additional layers: infer instructions and deterministic inference engine.

A Step-by-Step Guide to Running a Cortex Node

Requirements

According to the official recommendation, the requirements are:

  • System: Linux Ubuntu 16.04+
  • CPU: Xeon processor 16 Cores
  • GPU: Nvidia GPU 1060
  • RAM: 32GB
  • Space: 2TB (the size of the blockchain increases over time)
  • CUDA version: 9.2+
  • CUDA driver: 396+
  • Compiler: Go 1.10+, GCC 5.4+

However, even though Cortex utilizes GPU to run the CVM, one can also run a node without a GPU. The hard drive is the bigger consideration. At least 2TB is recommended to be future-proof. The reason being that AI models and results could take up quite a big chunk of the space as the blockchain becomes more mature.

Installation

In this tutorial, I am running Ubuntu 18.04.4 using VMware Workstation 15 Player on a Windows 10 PC. You can download VMware here and Ubuntu image here.

Here is my PC specification:

Booting up your virtual machine (skip if you already have Ubuntu set up)

Please note that you can also run a Cortex node on AWS, Google Cloud, or any cloud server that supports Ubuntu 16.04 or above.

After installing VMware Workstation 15 Player, start the software and click “Create a New Virtual Machine.” Select “Installer disc image file (iso):” and click Browse to locate the Ubuntu image you just downloaded.

Fill in Full name, user name, password, and confirm (to confirm your password). The user name and password will serve as your login info.

Name the virtual machine and select a location. Make sure the drive has enough storage. It is recommended to have 2TB, but in this tutorial, I have set it as 50GB.

Click on Customize Hardware, change Memory to the recommended 32GB or max RAM on your PC. Set Processor to 8 or 16. When you are done, click Finish.

The installation process should begin automatically, wait until it is finished. After the installation is completed, log in to your virtual machine with your user name and password you set earlier and you should see this screen.

You are now ready to set up a Cortex node!

Install necessary software requirements

Before we begin installing Cortex, we need to get some dependencies for your system. Cortex node relies on several tools and software to run smoothly. We will install these packages in order: cmake, go, gcc, g++, git, make. Note that the software versions used in this tutorial are recommended as of July 2nd. For most up-to-date versions, please refer to https://github.com/CortexFoundation/CortexTheseus.

First, click on the menu button at the lower-left corner, locate and open “Terminal”. Copy and paste the below script to Terminal and press enter to execute. If you are a beginner to Terminal, it is suggested to copy one line at a time.

You may be asked to enter a password at some point, please use your login password. Also, always press Y then enter, if the system asks you “Do you want to continue?

  • cmake 3.11.0+
wget https://cmake.org/files/v3.11/cmake-3.11.0-rc4-Linux-x86_64.tar.gztar zxvf cmake-3.11.0-rc4-Linux-x86_64.tar.gzsudo mv cmake-3.11.0-rc4-Linux-x86_64 /opt/cmake-3.11sudo ln -sf /opt/cmake-3.11/bin/* /usr/bin/
  • go 1.14.x
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gzsudo tar -C /usr/local -xzf go1.14.2.linux-amd64.tar.gzecho ‘export PATH=”$PATH:/usr/local/go/bin”’ >> ~/.bashrcsource ~/.bashrc
  • gcc
sudo apt install gccSudo apt install g++
  • git
sudo apt install git
  • make
sudo apt install make

If that all went well, we should be ready to go to the final steps to start the node.

Getting Cortex node up and running

By now, we have all the dependencies and packages installed. The only thing missing is the Cortex node source code.

git clone https://github.com/CortexFoundation/CortexTheseus.git

Once the dependencies are downloaded, it is time to install/compile the source code.

cd CortexTheseusmake clean && make -j$(nproc)

The last step will start the node and sync the data on the Cortex blockchain

./build/bin/cortex

That is it! Congratulations — you are now contributing to the next generation of decentralized AI ecosystem!

--

--