DuskEVM quickstart
Deploy a Solidity contract to DuskEVM Testnet with Foundry or Hardhat. DuskEVM uses the standard Ethereum JSON-RPC interface, so the workflow is the same one used for other OP Stack networks.
Install either Foundry or Node.js for the Hardhat path. Use a dedicated deployment account rather than a wallet that holds production funds.
Testnet
Section titled “Testnet”| Setting | Value |
|---|---|
| Chain ID | 745 |
| RPC | https://rpc.testnet.evm.dusk.network |
| Gas token | DUSK |
| Explorer | https://explorer.testnet.evm.dusk.network |
Confirm the RPC before signing:
cast chain-id --rpc-url https://rpc.testnet.evm.dusk.network
# 745Do not continue if the RPC is unavailable or returns a different chain ID.
1. Fund the deployer
Section titled “1. Fund the deployer”Create a dedicated EVM deployment account, then bridge testnet DUSK to it. Keep enough DUSK in the account to pay deployment gas.
Use an encrypted keystore or hardware signer. Do not place raw private keys in source files or shell history.
2. Deploy
Section titled “2. Deploy”Foundry
Section titled “Foundry”Initialize a project and import the deployment key into Foundry’s encrypted keystore:
forge init duskevm-quickstartcd duskevm-quickstartcast wallet import duskevm-testnet-deployer --interactiveDeploy the example Counter contract created by forge init:
forge create src/Counter.sol:Counter \ --rpc-url https://rpc.testnet.evm.dusk.network \ --account duskevm-testnet-deployer \ --broadcastHardhat 3
Section titled “Hardhat 3”Initialize a Hardhat project:
npx hardhat --initChoose Hardhat 3 and the TypeScript project using Node Test Runner and Viem. Then replace the generated network configuration with DuskEVM Testnet in hardhat.config.ts:
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";import { configVariable, defineConfig } from "hardhat/config";
export default defineConfig({ plugins: [hardhatToolboxViemPlugin], solidity: { version: "0.8.28" }, networks: { duskEvmTestnet: { type: "http", chainType: "op", chainId: 745, url: configVariable("DUSKEVM_TESTNET_RPC_URL"), accounts: [configVariable("DUSKEVM_TESTNET_PRIVATE_KEY")], }, },});Store the configuration values in Hardhat’s encrypted keystore:
npx hardhat keystore set DUSKEVM_TESTNET_RPC_URLnpx hardhat keystore set DUSKEVM_TESTNET_PRIVATE_KEYDeploy the example Ignition module created by npx hardhat --init:
npx hardhat ignition deploy ignition/modules/Counter.ts \ --network duskEvmTestnet3. Confirm the deployment
Section titled “3. Confirm the deployment”Both tools print the deployed contract address. Confirm that the address contains bytecode:
cast code <CONTRACT_ADDRESS> \ --rpc-url https://rpc.testnet.evm.dusk.networkThe result should be longer than 0x. Inspect the deployment transaction and contract in the DuskEVM testnet explorer.
4. Verify the source
Section titled “4. Verify the source”Open the contract in Blockscout and select Verify & Publish. Use the compiler version, optimizer settings, source files, and constructor arguments from the deployment build.
Blockscout also supports automated verification from Foundry and Hardhat.
Before deploying to mainnet, review the DuskEVM network and compatibility reference.