# Foundry — Blazing Fast Ethereum Development Toolkit in Rust > Foundry is a portable, modular toolkit for Ethereum smart contract development written in Rust. It includes Forge for testing, Cast for chain interaction, Anvil for local node simulation, and Chisel for an interactive Solidity REPL. Foundry compiles and runs tests significantly faster than JavaScript-based alternatives. ## Install Save in your project root: # Foundry — Blazing Fast Ethereum Development Toolkit in Rust ## Quick Use ```bash # Install Foundry curl -L https://foundry.paradigm.xyz | bash foundryup # Create a new project forge init my-project && cd my-project # Compile and test forge build forge test ``` ## Introduction Foundry is an Ethereum development toolkit built in Rust by Paradigm. It replaces JavaScript-based workflows with native-speed tooling for compiling, testing, deploying, and interacting with smart contracts. Foundry has become the preferred toolkit for teams that write tests in Solidity rather than JavaScript. ## What Foundry Does - Compiles Solidity and Vyper contracts with parallel compilation via `forge build` - Runs Solidity-native unit and fuzz tests at native speed with `forge test` - Provides `cast` CLI for sending transactions, querying chain state, and decoding calldata - Spins up a local Ethereum node with `anvil` for development and forked mainnet testing - Offers `chisel`, an interactive Solidity REPL for quick experimentation ## Architecture Overview Foundry is a set of Rust binaries sharing a common library layer. Forge handles project management, compilation (via solc), and test execution using a built-in EVM (revm). Anvil implements a full JSON-RPC server backed by revm, supporting mainnet forking at any block. Cast wraps common RPC calls and ABI encoding into one-line CLI commands. The toolkit uses the Alloy library for Ethereum type handling and RPC transport. ## Self-Hosting & Configuration - Install via `foundryup` or build from source with `cargo build --release` - Configure project settings in `foundry.toml` (Solidity version, optimizer runs, RPC URLs) - Use `forge install` to manage Solidity dependencies as Git submodules - Set `ETH_RPC_URL` environment variable for default chain interaction - Fork mainnet with `anvil --fork-url ` for realistic integration tests ## Key Features - Fuzz testing with configurable runs and shrinking for finding edge cases - Mainnet forking in Anvil lets you test against live contract state - Gas snapshots (`forge snapshot`) track contract gas usage across commits - Cheatcodes in tests allow time manipulation, storage overrides, and impersonation - Script system (`forge script`) deploys contracts with simulation before broadcast ## Comparison with Similar Tools - **Hardhat** — JavaScript-based with a rich plugin ecosystem; Foundry is faster and uses Solidity for tests - **Brownie** — Python-based framework now largely unmaintained; Foundry is actively developed - **Truffle** — Early Ethereum framework; Foundry offers modern DX and superior test speed - **Ape** — Python framework by ApeWorX; Foundry appeals to developers preferring Solidity-native testing ## FAQ **Q: Can I use Foundry alongside Hardhat?** A: Yes. Many teams use Forge for testing and Hardhat for deployment scripts or plugins. The two can coexist in the same repository. **Q: Does Foundry support Vyper?** A: Foundry supports compiling Vyper contracts, though the primary testing workflow targets Solidity. **Q: How does fuzz testing work in Forge?** A: Forge generates random inputs for test function parameters and runs them many times (default 256 runs). Failing inputs are automatically minimized to the simplest reproducing case. **Q: Is Foundry production-ready?** A: Yes. Major protocols including Uniswap, Optimism, and Paradigm use Foundry in production. ## Sources - https://github.com/foundry-rs/foundry - https://book.getfoundry.sh --- Source: https://tokrepo.com/en/workflows/asset-2b86396f Author: AI Open Source