A fixed-supply ERC-20 token built with Hardhat v3 + TypeScript + ESM. 1,000,000 STC tokens are minted once at deployment — no more can ever be created.
- Node.js 18+
- A MetaMask wallet (use a dedicated dev wallet, not your main one)
- Free Sepolia ETH — get some at sepoliafaucet.com
- Free accounts at Alchemy and Etherscan
npm installCopy the example file and fill in your values:
cp env.example .envOpen .env and set:
| Variable | Where to get it |
|---|---|
PRIVATE_KEY |
MetaMask → Account → three dots → Account Details → Export Private Key (64 hex chars, no 0x prefix) |
SEPOLIA_RPC_URL |
Alchemy → Create App → Ethereum → Sepolia → copy HTTPS URL |
ETHERSCAN_API_KEY |
Etherscan → Sign in → API Keys → Add |
Never commit
.envto Git. It is already in.gitignore.
npx hardhat compileArtifacts are written to artifacts/contracts/SpottyCoin.sol/SpottyCoin.json.
node deploy-direct.mjsThe script will print your contract address when done. Copy it — you need it for the next steps.
Example output:
✔ SpottyCoin deployed!
Contract address : 0xABC...
Sepolia Etherscan: https://sepolia.etherscan.io/address/0xABC...
npx hardhat verify --network sepolia <CONTRACT_ADDRESS>Replace <CONTRACT_ADDRESS> with the address printed during deployment.
Wait ~30 seconds after deployment before running this — Etherscan needs time to index the bytecode.
- Open MetaMask → switch network to Sepolia Testnet
- Scroll down → Import tokens
- Paste your contract address
- MetaMask auto-fills: symbol
STC, decimals18 - Click Add custom token → Import tokens
You should now see 1,000,000 STC in your wallet.
contracts/
SpottyCoin.sol # ERC-20 token contract (OpenZeppelin)
scripts/
deploy.ts # Hardhat deploy script (local/testing)
deploy-sepolia.ts # Hardhat deploy script (Sepolia via config)
deploy-direct.mjs # Direct ethers.js deploy (bypasses Hardhat network config)
hardhat.config.ts # Hardhat v3 configuration
env.example # Environment variable template
spottycoin_icon.png # Token icon (512×512, use in MetaMask)
| Property | Value |
|---|---|
| Name | SpottyCoin |
| Symbol | STC |
| Decimals | 18 |
| Total supply | 1,000,000 STC |
| Network | Sepolia testnet |
| Compiler | solc 0.8.28 |
| Standard | ERC-20 (OpenZeppelin v5) |