The tools you need
The Solidity development ecosystem has standardized around a few core tools. You'll need Node.js, a package manager (npm or yarn), and one of two frameworks: Hardhat or Foundry. These notes use Hardhat because it's JavaScript-first and easier to integrate with frontend tooling.
Install Node.js
Use nvm (Node Version Manager) to install and manage Node.js versions. This gives you flexibility when different projects need different versions.
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Install and use Node 20
nvm install 20
nvm use 20Create a Hardhat project
Hardhat is the most widely used Solidity development framework. It handles compilation, testing, local node simulation, and deployment scripts.
mkdir my-solidity-project
cd my-solidity-project
npm init -y
npm install --save-dev hardhat
# Initialize Hardhat
npx hardhat initWhen prompted, choose "Create a JavaScript project" (or TypeScript if you prefer). Hardhat will scaffold the following structure:
my-solidity-project/
├── contracts/ # Your .sol files go here
├── ignition/modules/ # Deployment scripts
├── test/ # Test files (Mocha + Chai)
├── hardhat.config.js # Configuration
└── package.jsonInstall the Solidity VS Code extension
The official Solidity extension for VS Code (by Nomic Foundation, the team behind Hardhat) gives you syntax highlighting, inline error checking, and go-to-definition support.
Open VS Code, go to Extensions, search for "Solidity" and install the one by Nomic Foundation.
Compile your first contract
Hardhat ships with a sample contract. To compile it, run:
npx hardhat compileYou'll see output confirming the contract compiled successfully. The compiled artifacts (ABI + bytecode) land in the artifacts/ directory.
Run a local node
Hardhat includes a built-in Ethereum node for local development. It starts with 20 pre-funded accounts and fast block times.
npx hardhat nodeKeep this running in a terminal tab while you develop. You can deploy contracts and send transactions to it without spending real ETH.
Run the tests
npx hardhat testYou're ready. Let's write some contracts.