Repository
- Code: github.com/berachain/guides/tree/main/apps/hardhat-viem-helloworld
- README (raw): raw README
Requirements
- Node
v18.18.2+, npm - MetaMask (or other wallet) with $BERA — use Berachain testnet faucet or similar
Stack
Hardhat, Viem, Solidity, TypeScript.Quick start
- Clone and install
Set
WALLET_PRIVATE_KEYin.env. - Compile and deploy to Berachain testnet
(Uses
scripts/deploy.tsand networkberachainTestnet.) - Verify on block explorer
- Optional — local node:
npm run nodein one terminal, thennpm run deploy:localhostin another. - Run tests:
npm run test
Key files
| Purpose | Path |
|---|---|
| Contract | contracts/HelloWorld.sol |
| Deploy script | scripts/deploy.ts |
| Tests | test/HelloWorld.test.ts |