Skip to Content
StagenetsGuidesDeploy with Hardhat V2

Deploy with Hardhat V2

This guide shows you how to deploy contracts from a Hardhat V2 project onto your 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 V2 project with a deployment script or Ignition module
  • A funded deployer wallet — generate one with contract.dev generate-wallet, or fund an existing address with the Faucet

Add your Stagenet as a network

Copy your Stagenet’s RPC URL from its dashboard and add a stagenet entry to the networks block in your hardhat.config.{js,ts}:

module.exports = { solidity: "0.8.21", networks: { stagenet: { url: "<YOUR_STAGENET_RPC_URL>", accounts: ["<YOUR_FUNDED_PRIVATE_KEY>"], }, }, };

Deploy contracts

npx hardhat run scripts/deploy.ts --network stagenet

Or use Ignition:

npx hardhat ignition deploy ignition/modules/MyModule.ts --network stagenet

Next steps

To get an automatic dashboard for each deployment, push your compiled contracts:

contract.dev push-contracts

Deployments matching pushed bytecode are detected and get dashboards automatically. See Pushing Contracts.

Last updated on