square-codeDeploy Your Contract (Hardhat)

Deploy Your First Contract (Hardhat)

This guide deploys a simple Solidity contract to SATUCHAIN Testnet using Hardhat and a private key from MetaMask.

Requirements

1) Create a Hardhat Project

Open a terminal:

mkdir satuchain-hardhat
cd satuchain-hardhat
npm init -y
npm install --save-dev hardhat
npx hardhat init

If prompted, choose a basic TypeScript or JavaScript project (either is fine).

2) Install Dependencies

3) Add Your Private Key

Create a .env file:

Notes:

  • Use a testnet-only wallet.

  • Never commit .env to git.

4) Add SATUCHAIN Testnet Network

Open hardhat.config.js (or hardhat.config.ts) and add the network:

hardhat.config.js

5) Create the Contract

Create contracts/Storage.sol:

6) Create the Deploy Script

Create scripts/deploy.js:

7) Compile and Deploy

Compile:

Deploy to SATUCHAIN Testnet:

You should see the deployed contract address printed in the terminal.

8) Verify the Deployment

  1. Copy the contract address from the terminal output.

  2. Search the address to confirm:

    • Contract exists

    • Deployment transaction is successful

Troubleshooting

Insufficient funds

  • Claim more tSTU from the faucet and retry.

Invalid sender / signature error

  • Your PRIVATE_KEY is wrong or missing 0x prefix.

  • Ensure .env is loaded and the account is configured.

RPC issues

Last updated