starknet-devnet-rs
asdf
version manager withasdf scarb
plugin
- Install
starknet-devnet-rs
. Since it has yet to be released, you will need to build it manually:git clone https://github.com/0xSpaceShard/starknet-devnet-rs.git starknet-devnet-rs cd starknet-devnet-rs cargo build --release export DEVNET_PATH=$(pwd)/target/release/starknet-devnet
- Run devnet with specific parameters on your host machine:
$DEVNET_PATH --host 127.0.0.1 --port 5050 --seed 1053545547
- Compile a Cairo 1 demo contract. Run:
cd src/main/resources/contracts scarb --release build
- Run the demo:
./gradlew :javademo:run
Running the demo on a network other than devnet (Mainnet/Testen/Integration) requires some tweaks to be made.
- URL of a Starknet RPC node.
- Details (address and private key) of an account deployed on said network with some funds on it. If you're using Sepolia testnet, you can obtain some funds from the faucet.
asdf
version manager withasdf scarb
plugin
- Set a config with your data.
To do so, you can modify
DemoConfig
in Main.java. Make sure to change profile toNETWORK
and set the correct values for:- RPC node URL
- account address
- account private key
- Make sure to slightly modify the demo contract source code (e.g. add a salt to the function names). Duplicate contracts are not allowed on the same network.
- Repeat steps 3-4 from Running (devnet).
The time it takes for a transaction to be processed on a network other than devnet can vary. If the demo fails because transaction was not processed in time, try increasing the timeouts in Main.java.