A local testnet for Starknet
Project description
Introduction
A Flask wrapper of Starknet state. Similar in purpose to Ganache.
Aims to mimic Starknet's Alpha testnet, but with simplified functionality.
Install
pip install starknet-devnet
Requirements
Works with Python versions <=3.9.7.
On Ubuntu/Debian, first run:
sudo apt install -y libgmp3-dev
On Mac, you can use brew
:
brew install gmp
Disclaimer
- This devnet should not be used as a replacement for Alpha testnet. After testing on devnet, be sure to test on testnet!
- Hash calculation of transactions and blocks differs from the one used in Alpha testnet.
Run
Installing the package adds the starknet-devnet
command.
usage: starknet-devnet [-h] [-v] [--host HOST] [--port PORT]
Run a local instance of Starknet devnet
optional arguments:
-h, --help show this help message and exit
-v, --version Print the version
--host HOST Specify the address to listen at; defaults to localhost (use the address the program outputs on start)
--port PORT, -p PORT Specify the port to listen at; defaults to 5000
Run - Docker
This devnet is available as a Docker container (shardlabs/starknet-devnet):
docker pull shardlabs/starknet-devnet
The server inside the container listens to the port 5000, which you need to publish to a desired <PORT>
on your host machine:
docker run -it -p [HOST:]<PORT>:5000 shardlabs/starknet-devnet
E.g. if you want to use your host machine's 127.0.0.1:5000
, you need to run:
docker run -it -p 127.0.0.1:5000:5000 shardlabs/starknet-devnet
You may ignore any address-related output logged on container startup (e.g. Running on all addresses
or Running on http://172.17.0.2:5000
). What you will use is what you specified with the -p
argument.
If you don't specify the HOST
part, the server will indeed be available on all of your host machine's addresses (localhost, local network IP, etc.), which may present a security issue if you don't want anyone from the local network to access your devnet.
Interaction
Interact with this devnet as you would with the official Starknet alpha network.
Hardhat integration
- If you're using the Hardhat plugin, see here on how to edit its config file to integrate this devnet.
Development - Prerequisite
If you're a developer willing to contribute, be sure to have installed Poetry.
Development - Run
poetry run starknet-devnet
Development - Test
When running tests locally, do it from the project root.
Setup an example project by running:
./scripts/setup-example.sh
To see if the devnet can interact with starknet CLI commands, run:
./scripts/test-cli.sh
To see if the devnet can interact with the plugin, run:
./scripts/test-plugin.sh
Development - Build
poetry build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for starknet_devnet-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bca746a7b34b51bdcc35623724c0c243c1e7b60194ddfa7e0c68133f4bc9ca7 |
|
MD5 | 245205e2b060fab6075f57aa2c022516 |
|
BLAKE2b-256 | 19ccf250de0f9c441ba523b6f4433e6b8f1b3ae3b09de2cdac4bf9172a2a1fff |