This is a very simple Rust (Stylus) smart contract that acts as a counter. It can store a number and increase it.
Use the deploy.sh script to quickly deploy and test the contract.
- Builds and deploys the Stylus Counter contract.
- Sends a test transaction to increment the counter.
- Creates a
deployment.envfile with the counter address and test transaction hash.
Make sure you have these installed:
cast(from Foundry, to send transactions)cargo stylustool (Installation guide)
Nitro Dev Node: A local Nitro node is required. Start it using Docker:
docker run -it --rm --name nitro-dev -p 8547:8547 offchainlabs/nitro-node:v3.9.5-rc.2-762ee40 --dev --http.addr 0.0.0.0 --http.api=net,web3,eth,arb,arbdebug,debugOpen your terminal in this folder and run:
chmod +x deploy.sh
./deploy.shWhen it finishes, look for the deployment.env file. The script also shows instructions on how to call the counter yourself.