Skip to main content
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.
In this tutorial, you’ll use Foundry to deploy and interact with the default 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):
After the installer finishes, run the source command shown in the installer output, or open a new terminal session. Then install Foundry’s tools:
Navigate to the directory where you want to create your project, then initialize a new Solidity project:
This generates 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:
Load the variables into your shell:
Never commit your .env file to version control. Store private keys and sensitive variables securely.

Step 3. Test the contract

Run the included tests to compile the contract and verify it works locally:
The 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 with cast:
The command returns an address and private key:
Keep your private key secure. Never share it or commit it to source control. Use environment variables or a secrets manager for any non-test deployment.
Add the private key to your .env file and reload:
Visit the Circle Faucet, select Arc Testnet, paste your wallet address, and request testnet USDC. Arc uses USDC as its native gas token—transaction fees are paid in USDC instead of a separate cryptocurrency—so this funds the wallet for deployment.
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

Deploy Counter to Arc Testnet:
After deployment completes, you’ll see output similar to:
Save the 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 with forge 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:
If your contract’s constructor takes arguments, ABI-encode them with cast abi-encode and pass the result with --constructor-args. For example:
You can also submit source code manually from the contract verification page on the explorer if you didn’t deploy with Foundry.
After verification succeeds, open the deployed address on testnet.arcscan.app to confirm the Contract tab now shows the verified source and lets you call functions directly from the UI.

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 with cast call:
A freshly deployed Counter returns 0. Increment it onchain with cast send:
Re-run the 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.