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.
What you’ll learn
By the end of this tutorial, you’ll be able to:- Set up your development environment
- Configure Foundry to connect with Arc
- Implement your smart contract
- Deploy your contract to Arc Testnet
- Interact with your deployed contract
Set up your development environment
Before you deploy to Arc, you need a working development environment. In this step, you install Foundry, a portable Ethereum development toolkit, and initialize a new Solidity project.- Install Development Tools
- Install binaries
- Initialize a new Solidity Project
Configure Foundry to interact with Arc
In this step, you set up Foundry to connect to the Arc network by adding Arc’s RPC URLs to your project environment.- Create a
.envfile
hello-arc project in your preferred code editor (for example, VS
Code). Then, create a new file named .env in the root of the project
directory.
- Add the Arc Testnet RPC URL
.env file:
Never commit your
.env file to version control. Store private keys and
sensitive variables securely.Implement your smart contract
In this step, you create the HelloArchitect contract, update the test and script files, and compile the project.HelloArchitect is a simple storage contract that manages a greeting
message: it starts with a default greeting, lets you update it, and emits an
event whenever the greeting changes.
1. Write the HelloArchitect contract
First, delete the defaultCounter.sol template file from the /src directory:
HelloArchitect.sol inside the /src directory,
and add the following code:
greeting variable that stores the greeting
string, along with two public functions:
setGreetingupdates thegreetingvalue and emits theGreetingChangedeventgetGreetingreturns the current value ofgreeting
2. Update scripts and tests
Since you deletedCounter.sol, you need to remove or replace any scripts and
tests that reference it to avoid compilation errors.
Delete the script directory
The script directory includes files that reference Counter.sol. Since you’ve
removed Counter.sol, delete the entire script directory to avoid compilation
errors:
You can recreate this directory later with updated deployment scripts for your
own contracts.
Counter.t.sol with HelloArchitect.t.sol
Navigate to the /test directory, delete the existing Counter.t.sol file, and
create a new test file named HelloArchitect.t.sol. Then, add the following
test cases to validate your contract:
3. Test the contract
Run the following command to execute the contract’s unit tests locally:HelloArchitect.t.sol,
and display the results in your terminal.
4. Compile the contract
To compile the HelloArchitect contract and generate build artifacts, run:/out directory containing the compiled bytecode and ABI,
which you’ll use when deploying the contract.
Deploy your contract to Arc Testnet
In this step, you generate a wallet, fund it with testnet USDC (Arc’s native gas token), and deploy your smart contract to the Arc Testnet using Foundry.1. Generate a wallet
To deploy the HelloArchitect contract, you need a funded wallet. Use the Foundry command-line tool to generate a new wallet:Important: Keep your private key secure. Never share it or commit it to
source control.
.env file:
2. Fund your wallet
Visit https://faucet.circle.com, select Arc Testnet, paste your wallet address, and request testnet USDC. Since USDC is Arc’s native gas token, this will provide the funds needed to cover gas fees when deploying your contract.Testnet USDC is for testing purposes only. It has no real-world value and must
not be used in production.
3. Deploy the contract
With your wallet funded with testnet USDC, deploy the HelloArchitect contract to the Arc Testnet using the Foundry command-line tool:Important: Never expose your real private key in production. Use
environment variables or secrets management in real deployments.
4. Store the contract address
Copy the deployed contract address from theDeployed to: line and save it to
your .env file:
Interact with your deployed contract
In this step, you verify that the deployment succeeded by checking the transaction in the Arc Testnet Explorer, then usecast to call a function from
your contract.
1. Check transaction on the explorer
Open the Arc Testnet Explorer, and paste the transaction hash from the deployment output. This lets you view the transaction details and confirm that the contract was deployed successfully.2. Use cast to call a contract function
Use the cast call command to interact with your deployed contract from the
command line. Run the following:
getGreeting function on the HelloArchitect contract
and returns the current value of the greeting variable.
Next steps
Congratulations, you’ve deployed and interacted with your first contract on Arc Testnet. From here, you can:- Extend the HelloArchitect contract with more logic for additional features.
- Explore Arc’s stablecoin-native features like USDC as gas and deterministic finality
- Build more advanced applications for payments, FX, or tokenized assets