Arc is currently in its testnet phase. During this period, the network may
experience instability or unplanned downtime. Note: Throughout this page,
all references to Arc refer specifically to the Arc Testnet.
Counter contract on the Arc Testnet. forge init
scaffolds a working Solidity project—contract, tests, and deployment script—so
you can ship to Arc without writing any new contract code. By the end, you’ll
have configured Foundry for Arc, deployed Counter, and called it from the
command line with cast.
Prerequisites
Before you begin, ensure that you’ve:- Confirmed access to a Unix-like shell (macOS, Linux, or Windows with WSL)
- Installed
curl(used by the Foundry installer) - Installed a code editor such as VS Code
Step 1. Set up Foundry
Install Foundry’s command-line tools (forge, cast, anvil, chisel):
source command shown in the installer
output, or open a new terminal session. Then install Foundry’s tools:
src/Counter.sol, a matching test file at test/Counter.t.sol,
and a deployment script at script/Counter.s.sol.
Step 2. Configure Foundry for Arc
Create a.env file in the project root with the Arc Testnet RPC URL:
Step 3. Test the contract
Run the included tests to compile the contract and verify it works locally:Counter tests pass, confirming compilation and local correctness.
Step 4. Deploy to Arc Testnet
4.1. Create and fund a wallet
Generate a new keypair withcast:
.env file and reload:
Testnet USDC is for testing purposes only. It has no real-world value and must
not be used in production.
4.2. Deploy the contract
DeployCounter to Arc Testnet:
Deployed to address from the output to your .env file and reload:
4.3. Verify the contract on Arc Testnet Explorer
Arc Testnet Explorer runs Blockscout, so you can publish your contract’s source code withforge verify-contract and Foundry’s Blockscout verifier. Verified
contracts show a Contract tab on the explorer with source code, ABI, and a
read/write UI.
Run the verification command from your Foundry project root, using the same
compiler settings you used to deploy:
cast abi-encode and pass the result with --constructor-args. For example:
Step 5. Interact with your contract
Confirm the deployment on the Arc Testnet Explorer by pasting the transaction hash from the previous step. Read the current counter value withcast call:
Counter returns 0. Increment it onchain with cast send:
cast call command. The returned value is now 1.
You now have a working deployment pipeline on Arc Testnet. To deploy
production-ready tokens or NFTs without writing Solidity, see
Deploy contracts.