Deploying Contracts
Deploy smart contracts to RISE using Hardhat Ignition
Deploy your compiled smart contracts to the RISE Testnet using Hardhat Ignition, our official deployment plugin.
Prerequisites
- Hardhat project configured for RISE (see Get Started)
- Testnet ETH from the RISE Faucet
- Private key configured with Configuration Variables
Deploy with Hardhat Ignition
Write a Deployment Module
Hardhat Ignition uses modules to describe deployments. Create ignition/modules/Counter.ts:
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
export default buildModule("CounterModule", (m) => {
const counter = m.contract("Counter");
return { counter };
});This module deploys an instance of the Counter contract. You can also call functions after deployment:
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
export default buildModule("CounterModule", (m) => {
const counter = m.contract("Counter");
// Call a function after deployment
m.call(counter, "setNumber", [42n]);
return { counter };
});Test Your Module Locally
Before deploying to a live network, test the module locally:
npx hardhat ignition deploy ignition/modules/Counter.tsyarn hardhat ignition deploy ignition/modules/Counter.tspnpm exec hardhat ignition deploy ignition/modules/Counter.tsbun x hardhat ignition deploy ignition/modules/Counter.tsThis simulates the deployment in a local network to verify everything works.
Deploy to RISE Testnet
Deploy your contract to RISE:
npx hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnetyarn hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnetpnpm exec hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnetbun x hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnetYou'll see output indicating successful deployment with the contract address.
Ignition remembers deployment state. If you run the same deployment again, nothing will happen because the module was already executed.
View on Explorer
View your deployed contract on the RISE Testnet Explorer by searching for the contract address from the deployment output.
Deploy with Constructor Arguments
If your contract has constructor parameters:
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
export default buildModule("CounterModule", (m) => {
const initialValue = m.getParameter("initialValue", 42n);
const counter = m.contract("Counter", [initialValue]);
return { counter };
});Deploy with parameters:
npx hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnet --parameters '{"CounterModule":{"initialValue":"100"}}'yarn hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnet --parameters '{"CounterModule":{"initialValue":"100"}}'pnpm exec hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnet --parameters '{"CounterModule":{"initialValue":"100"}}'bun x hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnet --parameters '{"CounterModule":{"initialValue":"100"}}'