Ritual Knowledge Hub

Infernet Node Setup

Learn to Set up a Ritual Node

Node Operator Knowledge Hub

Setting Up an Infernet Node

Step-By-Step Guide for Setting up Your Node

What is Infernet?

Infernet is a lightweight library for bridging off-chain compute on-chain. With the help of Infernet, smart contract developers can request computation to be executed off-chain by Infernet Nodes and delivered to their on-chain smart contracts via the Infernet SDK.

Infernet

Infernet is the first production implementation of the Ritual protocol. Smart contracts can request Infernet to compute an output with on-chain proof.

In this tutorial, we are going to set up and test Ritual’s Web3 workflow. This includes:

  • Deploying node with Infernet SDK contracts
  • Deploying consumer contract for Web3 demo
  • Create subscription request via consumer contract to create on-chain subscription

Video Tutorial

This tutorial is also available as a step-by-step video guide.

#1 Preparations & Prerequisites

Step-By-Step Guide for Setting up Your Node

Requirements

For successfully setting up and running Ritual’s Infernet Node, the following is required:

  • Git, Docker, and Docker Compose (code management & deployment)
  • EVM Wallet with ETH tokens on Base mainnet (ensure a minimum of $15-25 is in your wallet)

#2 Infernet Node Specs

Hardware Requirements

The requirements of an Infernet Node depend to a great degree on the type of compute workflows it is running. Ritual states in their docs that memory-enhanced machines are preferred.

Minimum Recommended GPU-heavy workloads
CPU Single-core vCPU 4 modern vCPU cores 4 modern vCPU cores
RAM 128MB 16GB 64GB
DISK 512MB HDD 500GB IOPS-optimized SSD 500GB NVME
GPU CUDA-enabled GPU

#3 VPS

Getting a VPS and Configuring it

To install and run your Infernet node at an optimal level, you need a VPS (Virtual Private Server). For the sake of simplicity, we’re going to use Contabo but feel free to use the VPS provider of your choice.

VPS Plan

Ritual recommends getting a VPS with 4 vCPUs, 16GB RAM and 500GB SSD, which is covered by Contabo’s CLOUD VPS 2 plan. If you are planning to run GPU-heavy workloads, you’ll have to purchase a more powerful machine.

Please select the following configurations.

  • Term length: Select anything from 1 month to 12 months (recommendation is 1 month).

  • Region: Select EU or anywhere in Asia.
  • Storage Type: 400 GB SSD
  • Image: Docker (in section “Apps & Panels“) with Ubuntu 22.04.

  • Additional Setup: Don’t change settings in “Object Storage”, “Networking”, and “Add-Ons”
Connect To VPS via SSH Tunnel

Once you’ve purchased a VPS package, you can use SSH to connect to it. Feel free to select the SSH client of your choice:

Enter the IP address & port of your VPS in the section Host Name (or IP Address) and click on Open.

Specify your user name as root and enter your password to log into your server.

#4 Installations

Installing Build Tools and Other Relevant Software on Your VPS

Once you’re logged into your VPS, we can install all the required tools for running a Ritual node.

Update Packages

The packages on your server may not be up-to-date so let’s update these first via:

Copy to Clipboard
Install Build Tools

Next, we are going to install the build tools needed to run a node (curl, git, jq, lz4, and build-essential):

Copy to Clipboard
Install Docker

We can now install Docker via the following command:

Copy to Clipboard
Troubleshooting

If installing Docker results in this error:

Copy to Clipboard

Please uninstall old Docker versions, update apt package index, install packages, add Docker’s official GPG key, set up stable repo, and install Docker engine:

Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Install Docker Compose

Once Docker is installed, we can install Docker Compose next. Please visit github.com/docker/compose/releases for the latest version. At the time of writing this, the latest version is v2.29.2. You may have to replace the version number in the command below once a newer version is live.

Copy to Clipboard

We also need to assign the Docker Compose directory higher permissions.

Copy to Clipboard
Install Docker Compose CLI Plugin
Copy to Clipboard

Make plugin executable

Copy to Clipboard

Verify installation

Copy to Clipboard
Add User to the Docker Group (Recommended)

If you are not working from root, please add your user to the Docker group:

Copy to Clipboard

Reboot system to apply changes:

Copy to Clipboard

Log back in and verify everything works fine:

Copy to Clipboard

#5 Starter Repository

Cloning The Starter Repository

We’ve now successfully installed all the tools we need. In the next step, you’ll clone the starter repository to your local machine. Clone locally:

Copy to Clipboard

After cloning it, please navigate to the repository via:

Copy to Clipboard

#6 Running hello-world

Getting Started

In this step, we are going to run the hello-world container.

We are starting a new screen session with the name “ritual” so that the Docker container continues running even if we lose connection with the VPS. 

Copy to Clipboard

We are going to deploy the hello-world container inside this session:

Copy to Clipboard
Screen Commands

You can find important screen commands in the following:

  • Detach from session without disturbing it: CTRL + A + D

  • Terminate/stop screen: Ctrl + D
  • List sessions: screen -ls
  • Connect to screen: screen -x [ID] (replace ID with screen id)

Detach from your session with:

Copy to Clipboard

We can now check if everything is working correctly. To do so, open a new terminal window where we can see a list of all active Docker containers. Establish a new SSH connection to your VPS (open new PuTTY instance, enter IP of your VPS, click on Open and enter your password. Then enter this command:

Copy to Clipboard

Everything is going great if the output looks like this:

#7 Node Configuration

Updating the config.json File

Edit config.json

Open the config.json file in the second terminal window that you have just opened:

Copy to Clipboard
Copy to Clipboard

Update the config file as follows (either by using arrow down and right/left to get to where you want to make a change or via CTRL+_ and specifying the line number). You can then delete the existing content and insert the new variables via CTRL+SHIFT+V:

  • Coordinator Address: 0x8D871Ef2826ac9001fB2e33fDD6379b6aaBF449c (for Base)
  • RPC URL: https://mainnet.base.org/
  • Private Key: Enter your private key (throwaway wallet). Add “0x” to your key if it does not start with 0x.

  • Registry: Check via Deployed Contracts, at the moment it is this address 0x3B1554f346DFe5c482Bb4BA31b880c1C18412170
  • Version number: Change to "image": "ritualnetwork/hello-world-infernet:1.0.0",
Important

Please keep 15$ to 25$ ETH in your wallet.

Please also edit the snapshot sync settings in both config files (/hello-world/container/config.json and /deploy/config.json) to increase sleep (makes node less aggressive) and to avoid RPC rate limits (decrease batch size for public RPCs to 50):

Copy to Clipboard

Save and close the file by pressing CTRL + X. Confirm changes with Y and hit ENTER to exit.

Now change RPC URL, registry, and private key in this file as well:

Copy to Clipboard

Then change registry address in this file as well:

Copy to Clipboard
Edit Makefile

Open the Makefile:

Copy to Clipboard
  • Update sender’s address with your private key
  • Change RPC_URL to https://mainnet.base.org/

Update Deployment Script

Go to deployment script:

Copy to Clipboard

Change coordinator address to 0x8D871Ef2826ac9001fB2e33fDD6379b6aaBF449c

Change registry address to 0x3B1554f346DFe5c482Bb4BA31b880c1C18412170

Save and close via CTRL + X.

Change the node’s image to the latest version (today, this is 1.2.0 but be sure to check for the latest version).

Copy to Clipboard
Version
Optimization Trick

Feel free to add a auto restart functionality to your Infernet node via:
restart: on-failure in
~/infernet-container-starter/deploy/docker-compose.yaml

#8 Initialize Configuration

Applying the New Configuration

Restart Docker containers one by one (in second terminal session):

Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard

Verify the restart was successful listing all running containers:

Copy to Clipboard

You can now check if changes are active via (replace <Container ID> with ID of deploy-node-1 container. You can get the ID via docker ps.

Copy to Clipboard
Copy to Clipboard

#9 Install Foundry

Installing Foundry And Dependencies

We can now install Foundry in the second terminal window. (Foundry is a modular toolkit for Ethereum application development). Change to home directory:

Copy to Clipboard

Create a new folder:

Copy to Clipboard

Navigate into it:

Copy to Clipboard

Execute the script from Foundry’s official source

Copy to Clipboard

Update your shell configuration by sourcing the .bashrc file

Copy to Clipboard

Run foundryup to ensure Foundry is fully installed:

Copy to Clipboard

We then install the necessary dependencies by navigating into the directory of the contract and installing required libraries and SDKs. Navigate to the contracts directory:

Copy to Clipboard

Install the forge-std library:

Copy to Clipboard

Install the infernet-sdk:

Copy to Clipboard

Go to the directory three levels up

Copy to Clipboard
Troubleshooting

If installing the required libraries and SDK results in this error:

Copy to Clipboard

Please remove existing directory, re-run installation command, and verify successful installation:

Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Troubleshooting (“SDK already exists”)

If installing the SDK results in this error:

Copy to Clipboard

Please remove existing directory, re-run installation command, and verify successful installation:

Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard

#10 Deploy Consumer Contract

Deployment Process for a Consumer Contract

Open a third terminal window for monitoring the logs. (Open new PuTTY instance, enter IP of your VPS, click on Open and enter your password). Then print the logs via:

Copy to Clipboard

Next, we can deploy a consumer contract that will interact with the Infernet SDK. To do this, we are using the SaysGM example by Ritual. It is designed to request a compute output from your node and prints the compute result. To deploy SaysGM, enter your second terminal session and enter this command. Navigate to the repository:

Copy to Clipboard

Deploy the SaysGM contract:

Copy to Clipboard

You can check the result in your third terminal window. If everything was successful, you will see a new transaction. If so: Congratulations! Your deployment was successful and has interacted with the blockchain. 

You can also check via Basescan.

#11 Call Contract

Initiating a Request to Infernet Node

Look at the logs and check to which address your SaysGM contract was deployed to.

Edit your CallContract.s.sol file by inserting the new contract address. The preconfigured address is SaysGM saysGm = SaysGM(0x13D69Cf7d6CE4218F646B759Dcf334D82c023d8e), change it to the address that was generated when calling SaysGM:

Copy to Clipboard

Switch back to your second terminal session and initiate a new request for the Infernet Node:

Copy to Clipboard

This will trigger the SaysGm contract (via an initiation transaction). You can monitor this process in your third terminal window. A new message will confirm the transaction, confirming that the contract interaction was successful.

Please wait for a few moments. You will then see a new contact from the Infernet Node.

Troubleshooting (“Error: Could not instantiate forked environment)

If installing the SDK results in this error:

Copy to Clipboard

Please switch to a more powerful RPC as the free RPC on base.org may not be able to handle the load.

#12 Register On-Chain

Registration and Activation of Node

Please Note

A manual on-chain activation and registration is no longer required in version 1.0.0 and above. If you are setting up the node just now, feel free to skip step #12.

Can now register and activate your node.

  • Log into your MetaMask wallet.
  • Register node by entering your wallet address in section 8. Register Node and clicking on Write and confirming the transaction.
  • Wait for 1 hour
  • Activate node by entering your wallet address in 1. Activate Node, click on Write and confirm the transaction.

#13 Verify Node Setup

Checking if Everything is Working Correctly

Check Basescan

You should now see two transactions in your wallet on Basescan. The first one is for registering your node and the second one is for activating it.

Check Node Logs

Please check your Docker looks to ensure everything is running smoothly.

Copy to Clipboard
Copy to Clipboard
Congrats!

You have successfully set up a Ritual Infernet Node and created an on-chain subscription request.

Go Back

Ritual Academy

Up Next