Skip to main content
Deploy a Solidity contract to StableNet Testnet using Hardhat and verify it on the Explorer.

What you’ll learn

By the end of this tutorial, you’ll be able to:
  • Configure Hardhat and hardhat.config.js for StableNet Testnet
  • Deploy a WKRC payment contract using a Hardhat deploy script
  • Verify the deployment on the StableNet Explorer

Prerequisites

  • Node.js ≥ 18 — run node --version to check
  • Testnet WKRC from the Faucet

Create a Hardhat project

When prompted, select “Create a JavaScript project”.
Store your private key in a .env file and add it to .gitignore. Never commit it to version control.

Configure hardhat.config.js

Replace the contents of hardhat.config.js:
Do not set evmVersion to cancun. StableNet does not support blob opcodes (BLOBHASH, BLOBBASEFEE). Use paris or shanghai.

Write WKRCPayment.sol

Delete the placeholder and create contracts/WKRCPayment.sol:

Write the deploy script

Create scripts/deploy.js:
You must pass maxPriorityFeePerGas and maxFeePerGas on every deploy and send call. Hardhat does not pick up the network-enforced minimum automatically — omitting them causes the transaction to be rejected.

Deploy to Testnet

Block inclusion can take up to 1–2 minutes. If waitForDeployment() appears to hang, the transaction is already in the mempool. Do not cancel and retry — that may cause a nonce conflict.

Verify on Explorer

Open explorer.stablenet.network and search for your contract address. You should see a Contract Creation transaction with status Success.

Next steps

Deploy with Foundry

Deploy the same contract using Foundry’s forge and cast.

Listen to Events

Subscribe to on-chain events with WebSocket.

RPC API Reference

Full list of supported JSON-RPC methods.

Fee Delegation

Let a separate account pay gas for your users.