> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy on Arc

> Learn how to deploy, test, and interact with a Solidity smart contract on the Arc Testnet.

<Info>
  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.
</Info>

In this tutorial, you'll use [Foundry](https://getfoundry.sh/) 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](https://learn.microsoft.com/en-us/windows/wsl/install))
* Installed [`curl`](https://curl.se/) (used by the Foundry installer)
* Installed a code editor such as [VS Code](https://code.visualstudio.com/)

## Step 1. Set up Foundry

Install Foundry's command-line tools (`forge`, `cast`, `anvil`, `chisel`):

```shell theme={null}
curl -L https://foundry.paradigm.xyz | bash
foundryup
```

Initialize a new Solidity project:

```shell theme={null}
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:

```ini theme={null}
ARC_TESTNET_RPC_URL="https://rpc.testnet.arc.network"
```

Load the variables into your shell:

```shell theme={null}
source .env
```

<Tip>
  Never commit your `.env` file to version control. Store private keys and
  sensitive variables securely.
</Tip>

## Step 3. Test the contract

Run the included tests to compile the contract and verify it works locally:

```shell theme={null}
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`:

```shell theme={null}
cast wallet new
```

The command returns an address and private key:

```text theme={null}
Successfully created new keypair.
Address:     0xB815A0c4bC23930119324d4359dB65e27A846A2d
Private key: 0xcc1b30a6af68ea9a9917f1dd••••••••••••••••••••••••••••••••••••••97c5
```

<Warning>
  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.
</Warning>

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

```ini theme={null}
PRIVATE_KEY="0x..."
```

```shell theme={null}
source .env
```

Visit the [Circle Faucet](https://faucet.circle.com), 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.

<Info>
  Testnet USDC is for testing purposes only. It has no real-world value and must
  not be used in production.
</Info>

### 4.2. Deploy the contract

Deploy `Counter` to Arc Testnet:

```shell theme={null}
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:

```text theme={null}
Deployer: 0xB815A0c4bC23930119324d4359dB65e27A846A2d
Deployed to: 0x32368037b14819C9e5Dbe96b3d67C59b8c65c4BF
Transaction hash: 0xeba0fcb5e528d586db0aeb2465a8fad0299330a9773ca62818a1827560a67346
```

Save the deployed address to your `.env` file and reload:

```ini theme={null}
COUNTER_ADDRESS="0x..."
```

```shell theme={null}
source .env
```

## Step 5. Interact with your contract

Confirm the deployment on the
[Arc Testnet Explorer](https://testnet.arcscan.app) by pasting the transaction
hash from the previous step.

Read the current counter value with `cast call`:

```shell theme={null}
cast call $COUNTER_ADDRESS "number()(uint256)" \
  --rpc-url $ARC_TESTNET_RPC_URL
```

A freshly deployed `Counter` returns `0`. Increment it onchain with `cast send`:

```shell theme={null}
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](/arc/tutorials/deploy-contracts).
