StarkNet from StarkWare is a permissionless scaling zkRollup that has been live (Alpha) on the Ethereum Mainnet since November 2021. One of the big hitters in Ethereum scaling, StarkNet works by producing STARK proofs off-chain, before verifying those proofs on-chain. Put simply, this means that StarkNet takes all the transactions that take place on the network, bundles them all into a neat little package, and then sends verification that these transactions took place to the Ethereum mainnet.
As the data involved in verifying transactions is both reduced in size and shared among users, you end up with faster transaction speeds and reduced costs – StarkNet makes Ethereum fast and cheap.
Perhaps the biggest critique of StarkNet at present is that it is not yet fully decentralised (although it is fully non-custodial). This is understandable as, up until now, the StarkWare team have been focusing on usability and performance. It is however essential that now they move onto decentralising the network – and that is exactly what they are doing.
Thanks to Equilibrium and Starkware, you finally have the chance to run a full StarkNet node, locally, on your home PC (or Raspberry Pi).
The decentralisation process has started!
StarkNet ✨ node running on my Raspberry Pi 4 🥧
— Joel Kite 🪁 (@joelkite) March 10, 2022
Why run a node?
By running a node and providing feedback you are helping StarkNet become more secure as it moves towards being a fully decentralised and permissionless network. However, there are currently no financial rewards for running a node.
It’s also fun if you like to tinker.
If you want to join in and run a StarkNet node on a Raspberry Pi you will first need to get a few things.
- Raspberry Pi 3 or 4 (or a Pi Zero 2 – more on this below)
- Raspberry Pi OS (64-bit)
- SD card
The Raspberry Pi
The choice of Raspberry Pi is essential. It needs to be able to run Raspberry Pi OS (64-bit) and that means a Pi 3 or Pi 4.
It is possible to run a node on a Pi Zero 2 (I have been running one for over a week with no problems) but this isn’t recommended. The first issue is that compiling the node caused the Pi to crash, so I had to compile it on the Pi 4 and move the SD card over to the Pi Zero.
The second, non-current, issue is that as the StarkNet decentralisation process evolves additional processes will be added. One of these processes will be the ability for all the nodes to communicate with each other over a P2P network. On the upside this is great for decentralisation as the data will be in more places (it is currently downloaded from the StarkNet sequencer). It will also make syncing faster as each node can pull data from across the network. On the downside the hardware requirements will likely increase and the Pi Zero, with its 1 GHz processor and 512mb SRAM will probably fall over.
Who knows… I’ll keep the Pi Zero running and find out.
— Joel Kite 🪁 (@joelkite) March 21, 2022
You’ll need a microSD card – 16gb should be enough.
Although an HDD does work there is a lot of file I/O, especially with shorter Goerli testnet block times, so an SSD is preferred.
I am using a SanDisk Ultra 3D SSD 500 GB on the Pi 4, but the Pi Zero is still running on a SanDisk Ultra 32 GB microSDHC Memory Card – no idea how long this will last but it’s not a long term solution.
The node requires a 64bit system to run and it just so happens that Raspberry Pi released a 64bit version just last month.
This is also the reason that you need a Pi 3, Pi 4 or Pi Zero 2, as these are the only hardware versions to run 64bit.
Note: compiling the node will fail if you try to use the 32bit OS.
So you’ve got your hardware sorted so it’s now time to get your Pi set up.
The node requires a 64bit system to run and it just so happens that Raspberry Pi released a 64bit version just last month. This is also the reason that you need a Pi 3, Pi 4 or Pi Zero 2, as these are the only hardware versions to run 64bit.
- Insert your SD card into your computer.
- Download the correct Raspberry Pi imager for your system (Linux, Windows, or Mac)
- Open the imager and select Raspberry Pi OS (other).
- Then select Raspberry Pi OS (64-bit) or Raspberry Pi OS Lite (64-bit)*.
- If you are installing Raspberry Pi OS Lite you will need to click on settings (gear symbol) and enable SSH, along with usernames, passwords, and WiFi credentials.
- Click Storage and choose what SD card to install to.
- Click write.
Once the SD card is written you can remove it from your computer and add it to the Raspberry Pi. Don’t forget to also plug in your SSD.
You can then plug it in and let it boot up.
*Whether you install the Desktop or the Lite (headless – no desktop) environment is up to you. Desktop is easier but if you are running the node on a Pi Zero than headless may be less resource intensive and requires less hardware as there is no need to connect to a screen or keyboard (more on this under SSH below).
Formatting your SSD
Once you have booted up your Pi and gone through the initial setup – wifi credentials etc, you will need to format your SSD.
- Plug your SSD into your Pi.
- Open GParted*.
- Select your SSD
- Click “New” and “Format” – select NTFS.
- Right-click the partition and choose “Properties.”
- Select “Label” and enter a new name for the partition – i.e. PiSSD
- Click “Done” and it will format the partition with the new name.
*WARNING: You can accidentally format your SD card with GParted – use it with caution – I once accidentally formatted my Linux boot partition – it wasn’t fun.
Running your Node
You are now ready to build and install your StarkNet node.
This post won’t go into the details of exactly how to set up a node, but will provide some notes for setting it up on a Pi.
The guide I followed was the one by dzupp – skip Part one and go straight to Part 2.
Various guides and install methods, including Docker and a 3 minute set-up, are available below.
Notes on Raspberry Pi installation
Don’t skip updates
The first thing you need to do when starting the node install is run
sudo apt update and sudo apt full-upgrade
No not skip this step or the set-up will fail!
Make sure you use the latest Pathfinder version
The team often releases updates that fix bugs so copy-pasting the code will put you on an older, more buggy, version.
If you get an error when running sudo apt install python3.8-venv you can just skip straight to “Move to py folder” as it is likely that the update in Part 2 would have given you the latest Python version.
Compiling on a Pi Zero
If you are using a Pi Zero it will likely fail at this point – you may wish to assemble your node on another, more powerful, device.
If you used a headless setup and connected via SSH you will need to install ‘Screen’ as closing SSH will kill the process.
Details on Screen can be found here – https://raspi.tv/2012/using-screen-with-raspberry-pi-to-avoid-leaving-ssh-sessions-open
Confirming your Raspberry Pi StarkNet Node is Running
If you have done everything successfully and you see the node syncing you are done.
And that’s it. You are now running your own StarkNet node and all you need to do is sit back and check in on it every so often.
Help and Feedback
If you have any feedback, or if you need any help, just pop into the StarkWare Discord channel where someone is always ready and able to help.