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 you have:
  • 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):
curl -L https://foundry.paradigm.xyz | bash
foundryup
Initialize a new Solidity project:
forge init hello-arc && cd hello-arc
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:
ARC_TESTNET_RPC_URL="https://rpc.testnet.arc.network"
Load the variables into your shell:
source .env
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:
forge test
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:
cast wallet new
The command returns an address and private key:
Successfully created new keypair.
Address:     0xB815A0c4bC23930119324d4359dB65e27A846A2d
Private key: 0xcc1b30a6af68ea9a9917f1dd••••••••••••••••••••••••••••••••••••••97c5
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:
PRIVATE_KEY="0x..."
source .env
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:
forge create src/Counter.sol:Counter \
  --rpc-url $ARC_TESTNET_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast
After deployment completes, you’ll see output similar to:
Deployer: 0xB815A0c4bC23930119324d4359dB65e27A846A2d
Deployed to: 0x32368037b14819C9e5Dbe96b3d67C59b8c65c4BF
Transaction hash: 0xeba0fcb5e528d586db0aeb2465a8fad0299330a9773ca62818a1827560a67346
Save the deployed address to your .env file and reload:
COUNTER_ADDRESS="0x..."
source .env

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:
cast call $COUNTER_ADDRESS "number()(uint256)" \
  --rpc-url $ARC_TESTNET_RPC_URL
A freshly deployed Counter returns 0. Increment it onchain with cast send:
cast send $COUNTER_ADDRESS "increment()" \
  --rpc-url $ARC_TESTNET_RPC_URL \
  --private-key $PRIVATE_KEY
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.