Skip to Content
GuidesFoundry

Deploy with Foundry

This guide shows you how to deploy contracts from a Foundry project onto your Stagenet.

You do not need to change your contracts or your scripts. Just point Foundry at your Stagenet’s RPC URL.

Prerequisites

  • A Foundry project
  • A funded deployer wallet:

Configure your environment

Copy your Stagenet’s RPC URL from its dashboard and add it to your .env alongside the funded private key:

STAGENET_RPC_URL=<YOUR_STAGENET_RPC_URL> PRIVATE_KEY=<YOUR_FUNDED_PRIVATE_KEY>

Stagenets expose a standard Ethereum JSON-RPC interface, so Foundry talks to them the same way it talks to any other EVM blockchain.

Deploy contracts

Load the variables and run your existing script with --rpc-url and --private-key:

source .env # Run your deployment script through your Stagenet's RPC forge script script/Deploy.s.sol:DeployScript \ --rpc-url $STAGENET_RPC_URL \ --private-key $PRIVATE_KEY \ --broadcast # Or deploy directly with forge create forge create src/Counter.sol:Counter \ --rpc-url $STAGENET_RPC_URL \ --private-key $PRIVATE_KEY \ --broadcast

Next steps

To get automatic Workspaces — dashboards that show contract transaction, balances, TVL, storage, and more — for each of your deployed contracts, import them onto your Stagenet.

You can do this via:

When you import them, their deployments will be detected as instances of the imported contracts and they will have Workspaces created for them automatically.

Last updated on