Skip to content

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.

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:

Terminal window
cast chain-id --rpc-url https://rpc.testnet.evm.dusk.network
# 745

Do not continue if the RPC is unavailable or returns a different chain ID.

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.

Initialize a project and import the deployment key into Foundry’s encrypted keystore:

Terminal window
forge init duskevm-quickstart
cd duskevm-quickstart
cast wallet import duskevm-testnet-deployer --interactive

Deploy the example Counter contract created by forge init:

Terminal window
forge create src/Counter.sol:Counter \
--rpc-url https://rpc.testnet.evm.dusk.network \
--account duskevm-testnet-deployer \
--broadcast

Initialize a Hardhat project:

Terminal window
npx hardhat --init

Choose 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:

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:

Terminal window
npx hardhat keystore set DUSKEVM_TESTNET_RPC_URL
npx hardhat keystore set DUSKEVM_TESTNET_PRIVATE_KEY

Deploy the example Ignition module created by npx hardhat --init:

Terminal window
npx hardhat ignition deploy ignition/modules/Counter.ts \
--network duskEvmTestnet

Both tools print the deployed contract address. Confirm that the address contains bytecode:

Terminal window
cast code <CONTRACT_ADDRESS> \
--rpc-url https://rpc.testnet.evm.dusk.network

The result should be longer than 0x. Inspect the deployment transaction and contract in the DuskEVM testnet explorer.

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.