Skip to content
Zroarus
Documentation menu

Quickstart with Foundry

Create, deploy and inspect your first contract with Foundry.

TestnetVerified Sep 27, 2026
On this page

Prerequisites#

  1. Install Foundry from its official guide(opens in a new tab).
  2. Create a wallet account used only for testing and claim tZROAR from the faucet(opens in a new tab).

Create a project#

Terminal
forge init my-zroarus-app
cd my-zroarus-app

This creates a sample Counter contract in src/Counter.sol.

Configure for Zroarus#

Pin the EVM version to cancun. Solidity 0.8.30 and later default to Prague, which the Testnet does not run, so contracts compiled with the default can fail to deploy or behave differently.

foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.28"
evm_version = "cancun"

[rpc_endpoints]
zroarus_testnet = "https://rpc.testnet.zroarus.com"

Deploy#

Load your test key into the current shell session only. It is never written to a file or to your shell history.

Terminal
read -rs ZROARUS_TESTNET_KEY && export ZROARUS_TESTNET_KEY   # paste, then Enter

forge create src/Counter.sol:Counter \
  --rpc-url zroarus_testnet \
  --private-key "$ZROARUS_TESTNET_KEY" \
  --broadcast

The output includes Deployed to and Transaction hash. Paste either into the explorer(opens in a new tab) search. The transaction is final as soon as it is in a block.

Interact#

Terminal
CONTRACT=0xYourDeployedAddress

cast call "$CONTRACT" "number()(uint256)" --rpc-url zroarus_testnet
cast send "$CONTRACT" "increment()" --rpc-url zroarus_testnet --private-key "$ZROARUS_TESTNET_KEY"
cast call "$CONTRACT" "number()(uint256)" --rpc-url zroarus_testnet

unset ZROARUS_TESTNET_KEY

Scripted deployments#

Because the Testnet can be reset, keep deployments in a script so you can redeploy everything with one command.

script/Deploy.s.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {Script} from "forge-std/Script.sol";
import {Counter} from "../src/Counter.sol";

contract Deploy is Script {
    function run() external {
        vm.startBroadcast();
        new Counter();
        vm.stopBroadcast();
    }
}
Terminal
forge script script/Deploy.s.sol:Deploy \
  --rpc-url zroarus_testnet \
  --private-key "$ZROARUS_TESTNET_KEY" \
  --broadcast
Never commit a private key, even a Testnet one, and never reuse a Testnet key on another network. See Security practices.

Something wrong or missing on this page? Send developer feedback.