This is a simple example showing how a Rust (Stylus) smart contract talks to a Solidity contract (FinalVerifier).
We have a deploy.sh script that automatically builds and deploys everything for you.
- Compiles the Solidity contract (
FinalVerifier.sol). - Deploys the Solidity contract to your local network.
- Builds and deploys the Stylus contract (
DeepCalculator). - Runs test transactions to trigger internal logic and cross-contract calls.
- Creates a
deployment.envfile where you can see all the deployed contract addresses and test transaction hashes.
Make sure you have these installed:
solc(Solidity compiler)cast(from Foundry, to send transactions)cargo stylustool (Installation guide)soldb(walnuthq/soldb) for tracing interop contracts. Start it by runningsoldb bridgein a separate terminal.
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.shAfter it finishes, you will see a deployment.env file with your addresses and hashes. Your contracts are ready to use!