In this tutorial we will show how to run Starknet devnet on Windows.
Hello there! 👋
So, you use Windows, and want to get started with Cairo and Starknet? In this tutorial we will show how to run Starknet devnet on Windows!
The purpose of using the Starknet devnet is to try out your smart contracts locally, on your machine, to play around and run tests, before deploying it on a testnet / mainnet.
Devnet doesn't run on Windows out of the box, so a workaround is needed, either by:
We recommend using WSL2! It's like running Linux on your Windows machine, but without the overhead of running a virtual machine.
We won't be going into details on how to set up WSL2 on your machine, because there is a ton of info on the web - first and foremost the official Microsoft documentation: https://docs.microsoft.com/en-us/windows/wsl/
After you got WSL2 up and running, search the Microsoft Store and install:
* note: Maybe easiest to Ubuntu 20.04.4 LTS which comes with Python version 3.8.10 by default, since Ubuntu 22 comes with Python >3.10 which we do not support
Open the Terminal, and click on the little arrow to get a dropdown:
Choose Ubuntu, and follow the instructions to finish your setup. To get the latest updates for your Ubuntu you can also run:
Go to Shard-Labs/starknet-devnet and take a look at the documentation.
Install the devnet:
That’s because we have a fresh Ubuntu, and we don’t have pip installed. Luckily, Ubuntu gives us a suggestion what to do:
After it is done, run this command again:
That’s because we didn’t install Cairo dependencies! You can take a look at: Setting up the environment — Cairo documentation
But basically, you have to run:
And now finally running pip install starknet-devnet should do the trick.
Last thing to do is to start a new shell (new window with Ubuntu in the Terminal) and you can start the devnet with the command:
There you go! You finally set up the starknet devnet on your Windows machine!
*This article is also available on SpaceShard Medium.