Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions docs/get-started/deploy-smart-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,35 @@ Never share or commit your private key. Always keep it secure and handle with ca

Now that your environment is set up, let's deploy your contracts to Base Sepolia.

1. Use the following command to compile and deploy your contract
1. (Optional) Perform a dry run to simulate the deployment and verify your configuration:

```bash
forge create ./src/Counter.sol:Counter --rpc-url $BASE_SEPOLIA_RPC_URL --account deployer
```

This simulates the deployment without broadcasting the transaction to the network.

2. Deploy your contract by adding the `--broadcast` flag:

```bash
forge create ./src/Counter.sol:Counter --rpc-url $BASE_SEPOLIA_RPC_URL --account deployer --broadcast
```

<Tip>
The `--broadcast` flag is **required** to actually deploy your contract to the network. Without it, Foundry only performs a dry run simulation.
</Tip>

Note the format of the contract being deployed is `<contract-path>:<contract-name>`.

2. After successful deployment, the transaction hash will be printed to the console output
3. After successful deployment, the transaction hash and deployed contract address will be printed to the console output

3. Copy the deployed contract address and add it to your `.env` file
4. Copy the deployed contract address and add it to your `.env` file

```bash
COUNTER_CONTRACT_ADDRESS="0x..."
```

4. Load the new environment variable
5. Load the new environment variable

```bash
source .env
Expand Down