Skip to content

0xsaeed/ritual-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ritual Node

image

DISCLAIMER

The code provided in this repository is for informational purposes only and is provided "as is" without any warranty or guarantee. The author(s) and maintainer(s) of this repository shall not be liable for any loss of data, financial losses, or other damages resulting from the use of this code. By using this code, you agree to use it at your own risk and indemnify and hold harmless the author(s) and maintainer(s) from any claims or liabilities arising from your use of the code. using this code, you agree to indemnify and hold harmless the author(s) and maintainer(s) of this repository from any and all claims, damages, or other liabilities that may arise from your use of the code.

Please use this code responsibly and at your own risk.

This document is written for v1.0.0 of Ritualnet container

Official Links

Recommended System Requirements

Ram cpu disk
16GB 4 modern vCPU cores 500GB IOPS-optimized SSD

It's the recommended specification you can try with lower configuration.

You also need a wallet with a little amount of ETH on Basechain(<10$)

As you going to use the private key of the wallet PLEASE DONT USE YOUR MAIN WALLET

1 - Register Your Node

Go to the follwing link. In Contract section connect your web3 wallet. In the buttom of the contracts click on registerNode insert your wallet address and then write.

https://basescan.org/address/0x8d871ef2826ac9001fb2e33fdd6379b6aabf449c#writeContract image

Congratulations. You got hacked and all of your money is gone. Joking:). It's safe

Now you have to wait about 1 hour. After 1 hour come back to above mentioned contract link and the click on activateNode and write.

If you dont's see any errors it means everything is ok and you can continiue. If see errors you have to wait and try again.

Metamask can not estimate the gas it's recommended to use other wallets like Rabby.

Lets run a Ritual node

2 - Install Dependecies

Update Packages

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl git jq lz4 build-essential cmake perl automake autoconf libtool wget libssl-dev screen git apt-transport-https ca-certificates software-properties-common gnupg lsb-release

Now check docker is installed or not by following command

docker -v

If you get version of docker it means it's alreary installed. So you can skip next part and jump to Install Ritual

3 - Install Docker

Uninstall old packages

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

Install

# Add Docker's official GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg 
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources: 
echo  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 
sudo apt update
# Install composer packages
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin 

Check installation

sudo docker run hello-world

image

4 - Install Ritual

Create a screen session

cd $HOME
screen -S ritual

In new screen clone the repo

git clone https://github.com/ritual-net/infernet-container-starter
cd infernet-container-starter
project=hello-world make deploy-container

Ctrl+c

export REGISTER_NODE="0x3B1554f346DFe5c482Bb4BA31b880c1C18412170"
export BASE_RPC_URL="https://base-rpc.publicnode.com"

Enter private key of your wallet

read -p "Enter your Private key: " NEW_PRIVATE_KEY

Change private key, register node and rpc url in config files:

# Replace rpc_url
sed -i "s|\"rpc_url\": \".*\"|\"rpc_url\": \"$BASE_RPC_URL\"|" ~/infernet-container-starter/deploy/config.json
sed -i "s|RPC_URL := .*|RPC_URL := ${BASE_RPC_URL}|" ~/infernet-container-starter/projects/hello-world/contracts/Makefile

# Replace registry_address
sed -i "s/\"registry_address\": \".*\"/\"registry_address\": \"$REGISTER_NODE\"/" ~/infernet-container-starter/deploy/config.json
sed -i "s|address registry = .*;|address registry = ${REGISTER_NODE};|" ~/infernet-container-starter/projects/hello-world/contracts/script/Deploy.s.sol
sed -i "s|\"registry_address\": \".*\"|\"registry_address\": \"${REGISTER_NODE}\"|" ~/infernet-container-starter/projects/hello-world/container/config.json

# Replace private_key
sed -i "s/\"private_key\": \".*\"/\"private_key\": \"$NEW_PRIVATE_KEY\"/" ~/infernet-container-starter/deploy/config.json
sed -i "s|sender := .*|sender := ${NEW_PRIVATE_KEY}|" ~/infernet-container-starter/projects/hello-world/contracts/Makefile
sed -i "s|\"private_key\": \".*\"|\"private_key\": \"${NEW_PRIVATE_KEY}\"|" ~/infernet-container-starter/projects/hello-world/container/config.json
cd deploy
docker compose down
docker compose up -d
docker restart infernet-node  &&\
docker restart hello-world &&\
docker restart deploy-redis-1 &&\
docker restart infernet-anvil &&\
docker restart deploy-fluentbit-1

Install Foundry

cd $HOME
mkdir foundry
cd foundry
curl -L https://foundry.paradigm.xyz | bash
source ~/.bashrc
foundryup
cd $HOME/infernet-container-starter/projects/hello-world/contracts/lib/
rm -r forge-std
rm -r infernet-sdk
forge install --no-commit foundry-rs/forge-std
forge install --no-commit ritual-net/infernet-sdk

Pay attention to log of following command and look for Deployed SaysHello. Copy it's address, you need it for next step.

cd $HOME/infernet-container-starter/
project=hello-world make deploy-contracts
read -p "Enter your Deployed SaysHello address: " SAY_GM
sed -i 's/SaysGM([^)]*)/SaysGM('"$SAY_GM"')/g' ~/infernet-container-starter/projects/hello-world/contracts/script/CallContract.s.sol
cd $HOME/infernet-container-starter/
make call-contract project=hello-world

5 - Done

You can check status of your node on https://basescan.org/ by entering you wallet address.

List all containers

docker ps -a

Get logs of these containers

docker logs infernet-node
docker logs infernet-anvil 

About

Lets run a Ritual node!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published