Prerequisites
Before starting, ensure you have:- Node.js 16.x or higher
- Yarn or npm package manager
- Git for version control
- Code editor (VS Code recommended)
Installation
Compile Contracts
Compile with Hardhat
- Compiled bytecode in
artifacts/ - TypeChain type definitions in
typechain-types/ - ABI files for contract interaction
Project Structure
Available Scripts
Thepackage.json defines several useful scripts:
Compilation
Testing
Code Quality
Contract Size
IDE Setup
VS Code Extensions
Recommended extensions:- Solidity by Juan Blanco
- Hardhat Solidity by Nomic Foundation
- Prettier for code formatting
- ESLint for JavaScript/TypeScript linting
VS Code Settings
Add to.vscode/settings.json:
Hardhat Network
Hardhat provides a local Ethereum network for development:http://127.0.0.1:8545/ with:
- 20 test accounts with 10000 ETH each
- Fast block mining
- Console logging of transactions
- State that persists until the node is stopped
Interacting with Local Network
Troubleshooting
Cannot find module '../typechain-types'
Cannot find module '../typechain-types'
TypeChain types haven’t been generated.Solution:This regenerates all type definitions.
Compilation errors with OpenZeppelin
Compilation errors with OpenZeppelin
Version mismatch with OpenZeppelin contracts.Solution:
Out of memory during compilation
Out of memory during compilation
Increase Node.js memory limit:Solution:
Next Steps
Testing Guide
Learn how to write and run tests
Deployment
Deploy contracts to networks
Quickstart
Get started with your first transfer
Examples
Explore integration examples