Skip to main content
Deploy a contract to Arc Testnet and interact with it onchain. You’ll initialize a starter project and use the generated Counter contract to complete the full deploy pipeline before developing your own contracts.

Prerequisites

Before you begin, ensure that you’ve:

Step 1. Initialize a project

From your working directory, initialize a new project:
This generates src/Counter.sol, a matching test file at test/Counter.t.sol, and a deployment script at script/Counter.s.sol. The generated .gitignore already excludes .env from version control.

Step 2. Configure the RPC connection

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

From your hello-arc project directory, run the Counter tests against Arc’s runtime before deploying:
The --network arc flag catches Arc-specific issues that a generic EVM simulator would miss. Use it when testing your own contracts, too.
Use arc-anvil --network arc to run a local Arc node during development. It supports forking testnet state and testing contract interactions manually before deploying.

Step 4. Set up your wallet

4.1. Create a wallet

Create a new wallet with arc-cast. If you already have a development wallet, skip this and add your wallet’s private key to your .env file in step 4.2 instead:
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.

4.2. Configure your .env

Add the private key to your .env file and reload:

4.3. Fund your wallet

Visit the Circle Faucet, select Arc Testnet, enter your wallet address, and request testnet USDC. Arc uses USDC for gas, so this balance covers your deployment fees.
Testnet USDC is for testing purposes only. You can’t use it in production.

Step 5. Deploy to Arc Testnet

5.1. Deploy the contract

Deploy to Arc Testnet:
Replace src/Counter.sol:Counter with your own contract path and name when deploying your own contracts. After deployment completes, you’ll see output similar to:
Save the Deployed to address from the output to your .env file and reload:

5.2. Verify the contract on Arc Testnet Explorer

Arc Testnet Explorer runs Blockscout, so you can publish your contract’s source code with arc-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 arc-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 explorer.testnet.arc.io to confirm the Contract tab now shows the verified source and lets you call functions directly from the UI.

Step 6. Interact with your contract

Confirm the deployment on the Arc Testnet Explorer by entering the transaction hash from step 5.1. Read the current counter value with arc-cast call:
A freshly deployed Counter returns 0. Increment it onchain with arc-cast send:
Re-run the arc-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.
If you encounter unexpected behavior after deploying, see Troubleshoot with Arc Foundry.