A Hedera-ready monorepo for building dApps with Next.js, Hardhat or Foundry, and Hedera networks (testnet, mainnet, local fork). Generated by create-scaffold-hbar or used as the production template when you run npx create-scaffold-hbar@latest.
- Node.js >= 20.18.3
- Yarn — required (this project uses Yarn workspaces; npm and pnpm are not supported)
Install via Corepack:corepack enable && corepack prepare yarn@stable --activate - Git
- If using Foundry: Foundry (
forge,cast,anvil)
- Create a new project (recommended):
npx create-scaffold-hbar@latestFollow the prompts to pick a template (blank, payments-scheduler, or hedera-demo), frontend, Solidity framework (Hardhat or Foundry), and network.
2. Or use this repo as the template (e.g. after cloning or downloading):
yarn install
yarn hardhat:chain # terminal 1: start local Hedera-forked node
yarn hardhat:deploy --network localhost # terminal 2: deploy to the running fork (8545)
yarn next:start # terminal 3: start Next.js appOpen http://localhost:3000 and use the Debug Contracts page to interact with your contracts.
The create-scaffold-hbar CLI resolves templates from this repository's template branches.
Current built-in templates are:
| Template | Branch | What you get |
|---|---|---|
| blank | templates/blank-template |
Minimal baseline scaffold with no opinionated app features; ideal starting point for custom products. |
| payments-scheduler | templates/payments-scheduler |
Starter for scheduled-payment style flows, with app and contract structure tailored for recurring/payment orchestration patterns using HSS. |
| hedera-demo | templates/hedera-demo |
Hedera demo/proofwall-style starter focused on showcasing Hedera integrations with Hedera Services[HTS, HCS, MirroNode] and end-to-end demo UX. |
# Interactive
npx create-scaffold-hbar@latest
# Explicit built-in template key
npx create-scaffold-hbar@latest --template blank
npx create-scaffold-hbar@latest --template payments-scheduler
npx create-scaffold-hbar@latest --template hedera-demoTo deploy or verify on Hedera testnet, you need a deployer account with testnet HBAR. Generate or import one with your selected framework command, such as yarn hardhat:account:generate, yarn hardhat:account:import, yarn foundry:account:generate, or yarn foundry:account:import, then fund it using the Hedera Portal faucet. Without funds, deploy and verify will fail with "Sender account not found".
- Deploy to Hedera testnet:
From repo root (you will be prompted to decrypt your deployer key):Or useyarn hardhat:deploy --network hederaTestnet
yarn hardhat:deploy --network hedera_testnet(same network, alternate name). - Verify on Hashscan: After deploy, run (no extra arguments needed; uses last deployment):
yarn hardhat:verify:testnet # chain 296
yarn hardhat:verify:mainnet # chain 295- Deploy to Hedera testnet:
Use a keystore with testnet HBAR (fund via Hedera Portal faucet). From repo root orpackages/foundry:Or fromyarn foundry:deploy --network hedera_testnet
packages/foundry:make deploywithRPC_URLand account set via env / Makefile. - Verify on Hashscan:
After deploy, run (no extra arguments needed):yarn foundry:verify:testnet # 296 yarn foundry:verify:mainnet # 295
Verified contracts appear on Hashscan (testnet) or Hashscan (mainnet).
You can test contracts and the app locally against a Hedera-forked execution environment before deploying to public networks.
Details and rationale (including localhost vs default hardhat network) are in packages/hardhat/README.md.
- Start a local chain (Hedera forking enabled in scripts):
yarn hardhat:chain- Deploy contracts to the running node on http://127.0.0.1:8545:
yarn hardhat:deploy --network localhostyarn hardhat:deploy without --network localhost targets the in-process hardhat network, not this long-running fork.
- Run Hardhat tests:
yarn hardhat:test- Run the app against local contracts:
yarn next:startThis path uses Foundry (packages/foundry) while sharing the same local JSON-RPC started by yarn hardhat:chain from the repo root. Details: packages/foundry/README.md.
- Start the local chain first:
yarn hardhat:chain- Run Foundry tests against that JSON-RPC:
yarn foundry:test:local- Optionally run Foundry tests directly against Hedera RPC endpoints (no local node):
yarn foundry:test:testnet
yarn foundry:test:mainnetThis keeps local testing on a single path and avoids chain id drift between different local node commands.
- packages/hardhat — Hardhat config, contracts,
deploy/scripts, tests,verifyHedera.js - packages/foundry — Forge config, contracts,
script/deploy scripts, tests,scripts-js/verifyHedera.js - packages/nextjs — Next.js app, RainbowKit, wagmi, scaffold config
Network and RPC URLs are in packages/hardhat/hardhat.config.ts or packages/foundry/foundry.toml.
- Hedera Documentation
- Hashscan — block explorer
- Hedera Token Service (HTS)
- create-scaffold-hbar — CLI to scaffold Hedera dApps