April 9, 2022

Installing a STARKNET node

Hello, here we will talk about installing the STARKNET node,

This guide was created based on the team's guide ПОТОК (https://teletype.in/@potokcrypto/starknet_node) and instructions from GitHub

This guide will only provide technical information on installing and checking the node, information about the STARKNET project can be found in the team guide ПОТОК

First of all, we need a server with Ubuntu 20.04 OS, as they assure the node is very undemanding and the minimum server configuration is enough 2 processor cores, 2 gigabytes of RAM, it is recommended to take 100 gigabytes of disk space just in case.

So we have a server, we connect to it through the terminal (you can use whichever is convenient for you).

Update server

sudo apt update && sudo apt upgrade -y

Upon completion of the process, install the necessary packages:

sudo apt install curl git python3-pip build-essential libssl-dev libffi-dev python3-dev libgmp-dev pkg-config -y

pip3 install fastecdsa

After install packages, we install Rust:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

When script will request choice we choose (default)

Next we update Rust:

sudo apt install cargo -y

source $HOME/.cargo/env

rustup update stable

After execution last line will be look like this:

stable-x86_64-unknown-linux-gnu unchanged — rustc 1.59.0 (9d1b2106e 23.02.2022)

version 1.59.0 actual at the time of writing, for the node need not less 1.58.0

For the next step we clone repository from the github:

git clone --branch v0.1.11-alpha https://github.com/eqlabs/pathfinder.git

After we create a virtual environment:

sudo apt install python3.8-venv

cd pathfinder/py
python3 -m venv .venv
source .venv/bin/activate

PIP_REQUIRE_VIRTUALENV=true pip install --upgrade pip

PIP_REQUIRE_VIRTUALENV=true pip install -r requirements-dev.txt

Once everything is installed, you need to check that everything is fine, for this we enter the command:

pytest

After the test is complited you should see this:

If all seems good, we building the node

cargo build --release --bin pathfinder

Building takes about 10 minutes, after the end we need to create an account on Alchemy.com

To do this, click on the link in the upper right corner "Login"

After that, in the window that opens, click "Singup", log in with a Google account, or enter data and register

After that, a confirmation email will be sent to the specified email

We check the mail, in the letter we press the confirmation button, follow the link, and in the window that opens, press the "Get Started" button

Next, fill in the data and click "Create App" in the "Team Name" field, write your name or team name, in the "App Name" field, write what your node will be called (only for your convenience).

Then select a tariff plan (default is FREE), and click "Continue"

It will ask you to enter payment data, we refuse this by clicking "Skip for now"

Next, he will offer to tweet for a reward, at your discretion, we click "Skip for now"

And now we are almost at the goal in the new window, click "Continue"

But it wasn’t there, we are asked to indicate how you can contact in messengers and so on, if you wish, you can enter, or you can click "Let`s Go" and we are at the goal.

In the window that opens, we are interested in the field "Api Key"

We copy the data from this field, they will be needed to launch the node

We make a service file and launch the node (frase API_KEY - replace with your generated key , upd most importantly, do not remove the closing quote)

sudo tee /etc/systemd/system/starknetd.service > /dev/null <<EOF
[Unit]
Description=StarkNet
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root/pathfinder/py
ExecStart=/bin/bash -c 'source /root/pathfinder/py/.venv/bin/activate && /root/.cargo/bin/cargo run --release --bin pathfinder -- --ethereum.url https://eth-mainnet.alchemyapi.io/v2/API_KEY'
Restart=always
RestartSec=10
Environment=RUST_BACKTRACE=1
[Install]
WantedBy=multi-user.target
EOF

Next, launch service:

sudo systemctl daemon-reload
sudo systemctl enable starknetd
sudo systemctl start starknetd
journalctl -u starknetd -f -o cat

After that, we admire the ongoing synchronization, at the time of writing there were 1500 blocks. Then we return to the site and click on our APP

In the window that opens, we look, if numbers have gone then everything is fine and your node is exchanging data.

Further in the official Discord in the #🛰-pathfinder-full-node thread, we brag that we launched the node and it works.

After that, it remains only to monitor the performance of the node, the news and wait.

Addendum related to some questions: when you are connected to the server again, after closing the terminal, to see the synchronization status, enter the command

journalctl -u starknetd -f -o cat

Pathfinder has been updated to v0.1.11-alpha, everything has been fixed in the guide for a new installation, to update, do the following

sudo systemctl stop starknetd

cd pathfinder git fetch git checkout v0.1.11-alpha cargo build --release --bin pathfinder cd py source .venv/bin/activate PIP_REQUIRE_VIRTUALENV=true pip install --upgrade pip PIP_REQUIRE_VIRTUALENV=true pip install -r requirements-dev.txt

And restart the service

sudo systemctl start starknetd

To see the synchronization status, enter the command

journalctl -u starknetd -f -o cat

Thank you for your time.

MMS_Team