Thanks to the great work of Equilibrium and Starkware teams we are now able to run our own nodes on StarkNet, helping to keep the network secure and the data accurate.
This tutorial will guide you through the process of setting up your first StarkNet node.
You can skip this part if you have a Linux distribution already running.
In this tutorial we will use Ubuntu 20.04 LTS or 18.04 LTS as Linux distributions. Feel free to use any other distro if you find it more preferable.
At the command prompt type:
And wait for the process to complete.
For WSL to be properly activated, you will now need to restart your computer.
Open Microsoft store app and search for Ubuntu. There will be three options available. You can choose any of them. Once installed, you can either launch the application directly from the store or search for Ubuntu in your Windows search bar.
Congratulations, you now have an Ubuntu terminal running on your Windows machine. Once it has finished its initial setup, you will need to create a username and password (this does not need to match your Windows user credentials).
Finally, it’s always good practice to install the latest updates with the following commands, entering your password when prompted.
sudo apt update
sudo apt full-upgrade
Press Y when prompted.
For any troubleshooting or more in-depth instructions on how to get Ubuntu running on your system please visit Ubuntu official tutorials - links provided in Resources part at the end of tutorial.
First check the version of Python 3 that is installed in the system by typing:
You’ll receive output in the terminal window that will let you know the version number. While this number may vary, the output will be similar to this:
To manage software packages for Python, let’s install pip, a tool that will install and manage programming packages we may want to use later.
sudo apt install -y python3-pip
There are a few more packages and development tools to install to ensure that we have a robust setup for our programming environment:
sudo apt install -y build-essential libssl-dev libffi-dev python3-dev
sudo apt-get install libgmp-dev
pip3 install fastecdsa
Now you have fastecdsa (a python tool for doing fast elliptic curve cryptography, specifically digital signatures) installed. To really not miss something later also run
sudo apt-get install -y pkg-config
We also need to install Rust programming language and its tools since Equilibrium node is built in Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Just in case if there was something left uninstalled in previous step then run
sudo apt install cargo
Update your Rust to the latest version
rustup update stable
Congratulations, you now made it to the part where we will actually start preparing environment for our node.
Create a local copy of pathfinder’s github repository by typing:
git clone --branch v0.1.2-alpha https://github.com/eqlabs/pathfinder.git
v0.1.3-alpha with newer version if that exists. You check that by visiting pathfinder’s repo.
Output will look something like below. Don’t worry about
detached HEAD state. This simply means you cannot impact active development of the pathfinder code.
Install a tool that will enable us to create virtual environment in which our node will run:
sudo apt install python3.8-venv
Move to py folder by typing
You should now see something like this:
Create the virtual environment called venv
python3 -m venv .venv
and activate it
You will know that you are in your virtual environment when you will see (.venv) on the left side of you command line:
Install some more tools for our node by running
PIP_REQUIRE_VIRTUALENV=true pip install --upgrade pip
PIP_REQUIRE_VIRTUALENV=true pip install -r requirements-dev.txt
Test if your previous steps were successful by running
Your output should look something like this:
You can compile your node by running the following command. Please stay in your virtual environment (venv) for this step. You will also be running your node from venv.
cargo build --release --bin pathfinder
This step will take a bit longer than the others (up to 30 minutes depending on your system configuration).
If you want to run a node on Layer 2 (StarkNet) you will also need to know what is happening on Layer 1 since your node will calculate StarkNet state’s root and confirm it against L1.
Thus, we need to access L1 full archive node. You can do that by connecting to your L1 node or if you don’t run one set up an account with a third party API provider like Infura, Alchemy, ArchiveNode or QuikNode.
In this tutorial we will set up an account with Infura or Alchemy. Choose one.
Additional tutorial on how to run your L2 node in parallel with Ethereum execution client like Nethermind, Erigon or Besu will be provided at a later date.
At this stage you will also have to decide on which Ethereum network you will run your node on. You can choose either Mainnet or Goerli.
If you choose the endpoint on the Goerli network, then your node will run on the StarkNet testnet on Goerli. If the chosen endpoint is on mainnet, then it will run on StarkNet Mainnet.
There is only one thing left to do → to run your first node on Layer 2!
You can test run your node by typing (replace the xxxxx with your Infura endpoint number)
cargo run --release --bin pathfinder -- --ethereum.url https://mainnet.infura.io/v3/xxxxx
or in case you are using Alchemy API (replace the xxxxx with your Alchemy API key)
cargo run --release --bin pathfinder -- --ethereum.url https://eth-goerli.alchemyapi.io/v2/xxxxx
Please make sure that you are in your pathfinder/py folder and have your virtual environment activated in order to successfully run the node.
You should see something like this:
Ubuntu installation (Win10 and Win11)