Lab: free tools · size first · stock scanner · crypto scanner · journal

General

Hardhat vs Foundry: Ethereum Development Framework Comparison

Hardhat and Foundry are the two dominant Ethereum smart contract development frameworks. Hardhat (JavaScript/TypeScript) dominates in production and integrates seamlessly with existing JS toolchains. Foundry (Rust-based) runs tests in Solidity, offers blazing-fast test execution, and has become the preferred framework for DeFi protocols and security researchers. Choosing between them depends on team skills, testing needs, and ecosystem integrations.

Hardhat and Foundry are the two most common Ethereum development frameworks. Hardhat is JavaScript and TypeScript based, with a large plugin ecosystem and familiar tooling for web developers. Foundry is written in Rust, is very fast, and lets developers write tests in Solidity, with strong fuzzing support. Many teams now use Foundry for testing and keep Hardhat for scripts or plugins they rely on.

What each one gives you

Foundry ships four command line tools. Forge builds, tests and deploys contracts. Cast talks to a live chain from the terminal, so you can read storage, decode calldata or send a transaction. Anvil runs a local node that can fork mainnet, and Chisel is a Solidity console for trying ideas quickly. Hardhat runs on Node.js and gets most of its features from plugins. Its config file is TypeScript, deployments go through a module system called Ignition, and tests can be written in TypeScript with a library like Viem. Hardhat 3 runs Solidity tests as well, so the old split where only Foundry tested in Solidity has narrowed.

How teams choose

A team whose front end and scripts already live in JavaScript tends to stay with Hardhat, since everything shares one language and one package manager. Teams doing heavy protocol math and security work lean toward Foundry for its fuzzing, invariant tests and gas snapshots. Running both side by side is common and works fine. The real cost is keeping two configs and two sets of dependencies in step.

What it means for everyone else

The framework a protocol picked tells you very little about its safety. What matters is whether the repository has real tests, whether they run on every change, and whether they cover the ugly cases like zero amounts, huge amounts and calls in an odd order. Either tool can do that. Neither one replaces an outside audit.