---
# System prepended metadata

title: Run your first StarkNet node

---

# Run your first StarkNet node

Thanks to great work of [Equilibrium](https://www.equilibrium.co/) and [Starkware](https://starkware.co/) 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**.


# Part 1: Install Windows Subsystem for Linux
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. 

1. First, open **Windows PowerShell** or CMD by searching for it in your Windows search bar, then select Run as administrator.
 ![](https://i.imgur.com/5M0NvNN.png)


2. At the command prompt type:

    `wsl –install`

    And wait for the process to complete.

    For WSL to be properly activated, you will now need to **restart** your computer.

3. 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.
![](https://i.imgur.com/EhCk59D.png)
  

5. **Configure Ubuntu**

    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).
![](https://i.imgur.com/SM5Z0f3.png)

    Finally, it’s always good practice to install the latest **updates** with the following commands, entering your password when prompted.

    `sudo apt update`

    Then

    `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](https://hackmd.io/6OHE-4y8SRidp1IVm1qRqg#Resources). 

# Part 2: Install dev tools on your Linux distro

1. First check the **version of Python 3** that is installed in the system by typing:

    `python3 -V`

    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:

    ![](https://i.imgur.com/o6EV0E6.png)
    
2. 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`

3. 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`
    
    Then

    `sudo apt-get install libgmp-dev`

    And then

    `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`

# Part 3: Install Rust 

1. We also need to install **Rust programming language** and its tools since Equilibrium node is built in Rust. 

    Run

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

2. Just in case if there was something left uninstalled in previous step then run 

    `sudo apt install cargo`
    
# Part 4: Clone pathfinder github repository

Congratulations, you now made it to the part where we will actually start preparing enviroment for our node. 

**Create a local copy** of pathfinder's github repository by typing:

`git clone https://github.com/eqlabs/pathfinder.git`
        

# Part 5: Create a virtual environment for a node

1. Install a **tool that will enable us to create virtual environment** in which our node will run:

    `sudo apt install python3.8-venv`

2. Move to **py folder** by typing

    `cd pathfinder/py`
    
    You should now see something like this
    
    ![](https://i.imgur.com/jDqeYpW.png)

3. Create the **virtual environment** called *venv*

    `python3 -m venv .venv`

    and activate it

    `source .venv/bin/activate`
    
    You will know that you are in your virtual environment when you will see (.venv) on the left side of you command line:
    
    ![](https://i.imgur.com/2jqgyBx.png)


4. Install some **more tools** for our node by running 

    `PIP_REQUIRE_VIRTUALENV=true pip install --upgrade pip`

    then

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

5. **Test** if your previous steps were successful by running

    `pytest`

    Your output should look something like this

    ![](https://i.imgur.com/NBdnoIX.png)

# Part 6: Assemble your node 

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).

# Part 7: Create Infura or Alchemy account

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](https://infura.io/), [Alchemy](https://alchemyapi.io/), [ArchiveNode](https://archivenode.io/) or [QuikNode](https://www.quiknode.io/). 

In this tutorial we will set up an account with **Infura** or **Alchemy**. Choose either one. 
> Additional tutorial on how to run your L2 node in parallel with **Ethereum execution client** like [Nethermind](http://nethermind.io/), [Erigon](https://github.com/ledgerwatch/erigon) or [Besu](https://consensys.net/quorum/developers/) will be provided at a later date.

## Infura

1. Go to infura.io and sing up
2. On your dashboard click on *Connect to the Ethereum network in seconds* 
    ![](https://i.imgur.com/XcOkH7m.png)
4. Create a new project and gave it a name. 
5. Still on your dashboard click on Settings 
    ![](https://i.imgur.com/YD4ivxH.png)
7. In settings panel you will be able to see the endpoints. Copy the **https** one. 

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**. 

## Alchemy

1. Go to [alchemy.com](https://www.alchemy.com/)and sing up
2. On your dashboard click on *Create App* 
    ![](https://i.imgur.com/9thPpyI.png)
3. Give your new app a name and choose either Mainnet or Goerli Network 
    ![](https://i.imgur.com/ABYjQZ4.png)
4. You will now be able to see the endpoint on your dashboard. Copy the **https** one. 
    ![](https://i.imgur.com/NF22X1T.png)



# Part 8: Run your node

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 by running (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 enviroment activated in order to successfully run the node.

You should see something like this:
![](https://i.imgur.com/e28hgMb.png)

# Resources

**Ubuntu** installation (WIN10 and WIN11)

https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview

https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#1-overview

**Rust** insatllation

https://www.rust-lang.org/tools/install

**Pathfinder** repository

https://github.com/eqlabs/pathfinder











