This repository is a personal backend starter for Solidity + Hardhat projects. It is meant to help quickly boot a local blockchain backend, compile contracts, run tests, and deploy contracts during development.
- Booting a local Hardhat blockchain backend
- Deploying Solidity contracts locally (and optionally to Sepolia)
- Running contract tests
- Reusing a clean starter for future Solidity projects
- Node.js
- Hardhat (latest 2.x line)
- Ethers (via Hardhat toolbox)
- Mocha/Chai test tooling
- Optional gas reporting
Current development dependency versions from package.json:
- @nomicfoundation/hardhat-toolbox: ^6.1.2
- hardhat: ^2.28.6
- hardhat-gas-reporter: ^2.3.0
- dotenv: ^17.4.1
- Node.js 18+ recommended
- npm
- Open terminal in project root.
- Install dependencies.
For full end-to-end setup (clone, install, compile, test, localhost deploy, optional Sepolia), see LocalSetupGuide.md.
npm installRun these in separate terminals from the project root.
- Start local blockchain node:
npx hardhat node- Deploy contract to localhost:
npx hardhat run scripts/deploy.js --network localhostYou can also use npm script:
npm run deploy:localhost- npm run compile: runs
hardhat compile - npm test: runs
hardhat test - npm run node: runs
hardhat node - npm run clean: runs
hardhat clean - npm run deploy: runs
hardhat run scripts/deploy.js - npm run deploy:localhost: runs
hardhat run scripts/deploy.js --network localhost
contracts/
Starter.sol
scripts/
deploy.js
test/
Starter.js
hardhat.config.js
The Starter contract includes:
- count state variable
- owner-based access control for increment and reset
- CountIncremented event
- increment(amount), getCount(), and reset()
Optional values can be set in .env for Sepolia deploys, verification, and gas reporting:
- SEPOLIA_ALCHEMY_RPC_URL
- METAMASK_PRIVATE_KEY
- ETHERSCAN_API_KEY
- COINMARKETCAP_API_KEY
- REPORT_GAS_USAGE=true (optional)
- This repo is intentionally minimal and backend-focused.
- Clone/copy this starter when beginning a new Solidity Hardhat backend project.