Deploy with Hardhat V3
Use Hardhat with a Stagenet
Configure Hardhat to deploy contracts to your Stagenet, run scripts against its RPC URL, and activate Workspaces for deployed contracts.
Deploy contracts from an existing Hardhat V3 project to your Stagenet by adding it as a custom HTTP network in hardhat.config and using your existing scripts or Ignition modules with --network stagenet.
You do not need to change your contracts or your scripts. Just add a network entry pointing at your Stagenet’s RPC URL.
Prerequisites
- A Hardhat V3 project with a deployment script or Ignition module
- A Stagenet — create one in the dashboard if you don’t have one yet
- A funded deployer wallet — generate one with the Wallet Generator, or fund an existing address using the Faucet
Add your Stagenet as a network
Copy your Stagenet’s RPC URL from its dashboard and add a stagenet entry under networks in your hardhat.config.ts:
export default defineConfig({
networks: {
stagenet: {
type: "http",
chainType: "l1",
url: "<YOUR_STAGENET_RPC_URL>",
accounts: [
"<YOUR_FUNDED_PRIVATE_KEY>",
],
},
},
});Stagenets expose a standard Ethereum JSON-RPC interface, so Hardhat talks to them the same way it talks to any other network.
For real projects, load the RPC URL and key from .env rather than hard-coding them.
Deploy with hardhat run
Run your existing deploy script with --network stagenet:
npx hardhat run scripts/deploy.ts --network stagenetHardhat sends the deployment transactions through your Stagenet’s RPC. The contracts persist on the Stagenet and can be inspected from the dashboard.
Deploy with Ignition
Run your Ignition module against the stagenet network:
npx hardhat ignition deploy ignition/modules/MyModule.ts --network stagenetTo get auto-generated Workspaces while using Ignition, pass --build-profile default. Ignition uses an optimised build profile by default, which strips the metadata needed to match deployed bytecode against pushed artifacts:
npx hardhat ignition deploy ignition/modules/MyModule.ts --network stagenet --build-profile defaultAuto-generated Workspaces
To get a dedicated Workspace for each deployed contract — with activity, balances, TVL, storage, and tracked metrics — push the contracts to your Stagenet before deploying.
Install the CLI and initialise it with your Stagenet’s RPC URL:
npm install contract.dev
npx contract.dev init --rpc-url=<YOUR_STAGENET_RPC_URL>Then compile and push:
npx hardhat compile
npx contract.dev push-contractsEach pushed contract becomes a pending Workspace. When a deployed contract’s bytecode matches a pushed artifact, the Stagenet activates its Workspace automatically.
Re-run npx contract.dev push-contracts after any contract changes to keep your Stagenet in sync. To have new and updated contracts pushed automatically on every commit, set up GitHub CI/CD.
See the push-contracts reference for details on source/artifact directory overrides and Hardhat configs that compute paths dynamically.
Next steps
- Workspaces — inspect each deployed contract in its own dashboard.
- Tracked Data — record and graph contract balances, storage variables, and function outputs over time.