Foundry

Foundry is an open-source toolkit for building and working with Ethereum and other EVM applications. Written in Rust, it brings several command-line tools together: Forge builds and tests contracts, Cast reads from and sends transactions to EVM networks, Anvil runs a local development node, and Chisel provides an interactive Solidity REPL. Foundry is a set of developer tools, not a blockchain, a smart-contract language, or a security certification.


What the Foundry tools do

  • Forge handles project builds, Solidity tests, scripts, and deployment workflows. Its test runner supports ordinary tests as well as fuzz tests that try many inputs and invariant tests that check stated properties across randomized call sequences.
  • Cast is a command-line interface for common EVM tasks such as querying contract data, inspecting blocks, encoding calls, and submitting transactions.
  • Anvil runs a local Ethereum-compatible development node. Developers can use it for local testing and, when configured, fork a network state for experiments without making those local changes on the real chain.
  • Chisel is an interactive Solidity read-eval-print loop for trying expressions and snippets.

Testing with Forge

Forge tests are commonly written in Solidity and run with forge test. A regular test checks a specific scenario. Fuzz testing varies inputs to look for cases a hand-picked example missed. Invariant testing runs randomized sequences of calls and checks properties the developer has written—for example, a stated relationship between accounting values. These techniques can expose bugs, but their results depend on the scenarios, properties, contracts, and limits the team defines. A passing test suite does not prove a contract is safe or replace independent review.

Foundry also provides test helpers called cheatcodes. They let a test set up conditions such as a timestamp, caller, balance, or forked state. These are controlled test-environment operations; a cheatcode does not grant an application the same power on a live network.


Foundry and Hardhat

Foundry and Hardhat are both development toolchains used for EVM projects, but they organize workflows differently. Foundry emphasizes command-line tools and Solidity-based testing. Hardhat has a JavaScript and TypeScript ecosystem many teams use for scripts, tests, plugins, or application integration. Some projects use both—for example, Forge for Solidity tests and a JavaScript tool for integration or deployment tasks. Which fits better depends on a team’s existing code, preferred languages, libraries, and workflow; Foundry is not simply a newer version of Hardhat.


Limitations and security

Foundry can help developers build repeatable tests and interact with EVM networks, but it cannot decide whether the chosen tests cover the important risks. Fuzzing only explores the inputs and call patterns allowed by its configuration; invariant tests only check properties the team encoded. Local forks also reproduce a selected state, not every possible future network condition. For projects handling valuable assets, testing is one part of a broader security process that can include code review, monitoring, and an independent smart contract audit.


Project and release history

Foundry is maintained as an open-source project, and its commands and configuration continue to evolve. The source repository and its release history are the best places to check the current installation method, supported features, and version-specific changes; older tutorials may describe behavior that has since changed.


Common misconceptions

“Foundry automatically finds every vulnerability.” Fuzz and invariant testing can find failures within their configured search space, but they do not establish that a contract is secure.

“Foundry and Hardhat cannot be used together.” Toolchains can coexist in one project when that suits the team’s tests, scripts, or integrations.

“Anvil changes the live blockchain.” Anvil is a local development node. A fork is a local simulation of selected network state unless a separate transaction is deliberately submitted to a live network.


Social Media Sentiment

A September 2025 r/ethdev thread about moving from Truffle to Foundry shows a practical, mixed discussion rather than a consensus ranking. Some replies favor Foundry’s Solidity-centered workflow and testing capabilities; others point out that Hardhat may feel more familiar to developers coming from JavaScript or Truffle, and that teams use the tools for different jobs. It is one small discussion, not a measure of developer adoption or preference.

Last updated: 2026-10


Related Terms


See Also


Sources