Setting Up a Web3 Dev Environment
Lesson by Uvin Vindula
Moving beyond the browser-based Remix IDE, serious Web3 development requires a local development environment. This lesson walks you through setting up a professional Web3 development stack. By the end, you'll have everything needed to write, test, and deploy smart contracts from your own machine.
The Web3 Developer Toolkit
A standard Web3 development environment consists of four core components:
- Node.js: The JavaScript runtime that powers most Web3 tooling
- Hardhat: A development framework for compiling, testing, and deploying smart contracts
- MetaMask: A browser wallet for interacting with dApps and testnets
- Testnet ETH: Free test cryptocurrency for deploying and testing contracts without spending real money
Step 1: Install Node.js
Node.js is the foundation of the Web3 development stack. Most tools, libraries, and frameworks in the Ethereum ecosystem are built on JavaScript/TypeScript running on Node.js.
- Download the LTS (Long Term Support) version from nodejs.org
- Run the installer with default settings
- Verify installation by opening a terminal and running:
node --versionandnpm --version - You should see version numbers for both (Node.js 18+ recommended)
Node.js comes with npm (Node Package Manager), which you'll use to install Hardhat and other dependencies.
Step 2: Set Up Hardhat
Hardhat is the most popular Ethereum development framework. It provides a local blockchain for testing, a Solidity compiler, and tools for deploying contracts to live networks.
To create a new Hardhat project:
# Create a new directory for your project
mkdir my-first-dapp
cd my-first-dapp
# Initialize a new npm project
npm init -y
# Install Hardhat
npm install --save-dev hardhat
# Initialize Hardhat project
npx hardhat init
When prompted, select "Create a JavaScript project" (or TypeScript if you're comfortable). Hardhat will create a project structure with:
contracts/— where your Solidity files livetest/— where your test files goscripts/— deployment and interaction scriptshardhat.config.js— project configuration
Why Hardhat over alternatives?
- Hardhat Network: A local Ethereum network that runs on your machine. Deploy contracts, run tests, and debug — all without spending real ETH or waiting for block confirmations.
- Stack traces: Hardhat provides Solidity stack traces for failed transactions, making debugging dramatically easier.
- Plugin ecosystem: Rich ecosystem of plugins for verification, gas reporting, contract sizing, and more.
- TypeScript support: First-class TypeScript support for type-safe development.
Step 3: Install and Configure MetaMask
MetaMask is a browser extension wallet that serves as your gateway to Web3:
- Install MetaMask from metamask.io (only from the official website — phishing sites abound)
- Create a new wallet and write down your seed phrase on paper — never store it digitally
- Your MetaMask wallet will connect to dApps and testnets for development
Step 4: Get Testnet ETH
Testnets are blockchain networks that mirror Ethereum's functionality but use worthless test ETH. This allows you to deploy and test contracts for free. The primary Ethereum testnet is Sepolia.
To get testnet ETH:
- Switch MetaMask to the Sepolia test network (Settings → Networks → Show Test Networks)
- Visit a Sepolia faucet — search for "Sepolia faucet" and use a reputable provider (Google Cloud, Alchemy, or Infura faucets)
- Paste your MetaMask wallet address and request test ETH
- You should receive a small amount (typically 0.1-0.5 Sepolia ETH) within minutes
Test ETH is free and has no real value. Use it to deploy contracts, test transactions, and experiment without financial risk.
Step 5: Essential Additional Tools
Round out your development environment with these recommended tools:
- VS Code: The most popular code editor for Web3 development. Install the "Solidity" extension by Juan Blanco for syntax highlighting and linting.
- Ethers.js: A JavaScript library for interacting with Ethereum. Install with
npm install ethers. Hardhat integrates with ethers.js for scripting and testing. - Alchemy or Infura: RPC providers that give your local environment access to live blockchain networks. Both offer generous free tiers. You'll need an RPC URL to deploy to testnets or mainnet.
- Etherscan (etherscan.io): The block explorer for verifying deployed contracts and examining transactions.
Your Development Workflow
Once set up, the typical Web3 development workflow is:
- Write: Create Solidity contracts in
contracts/ - Compile: Run
npx hardhat compileto check for errors - Test: Write and run tests with
npx hardhat test— always test thoroughly before deploying - Deploy locally: Deploy to Hardhat's local network to verify behavior
- Deploy to testnet: Deploy to Sepolia for more realistic testing
- Verify: Verify your contract source code on Etherscan
- Deploy to mainnet: Only after thorough testing and (if handling funds) a professional audit
This setup is identical to what professional Web3 developers worldwide use. With these tools installed, you're equipped to build your first smart contract — which we'll do in the next lesson.
Key Takeaways
- •A Web3 dev environment requires Node.js (runtime), Hardhat (development framework), MetaMask (browser wallet), and testnet ETH (free test currency)
- •Hardhat provides a local blockchain, Solidity compiler, debugger with stack traces, and deployment tools — the industry standard for Ethereum development
- •ALWAYS use a separate development wallet — never use a wallet containing real funds for testing and development
- •Sepolia is the primary Ethereum testnet — faucets provide free test ETH for deploying and testing contracts without financial risk
- •The professional workflow: write contracts, compile, test locally, deploy to testnet, verify on Etherscan, then deploy to mainnet only after thorough testing
Quick Quiz
Question 1 of 3
0 correct so far
Why should you use a separate MetaMask wallet for development?