A tutorial that teaches how to set up your development environment to work with Foundry.
In this tutorial, you’ll learn how to set up Foundry, a toolchain for smart contract development. You’ll also learn how to configure it to work with Base.
By the end of this tutorial, you should be able to:
Foundry is a smart contract development toolchain that is composed of multiple small command line tools:
Using Foundry you can manage your dependencies, compile your project, run tests, deploy smart contracts and interact with the chain from the command-line and via Solidity scripts.
For a deep dive on the Foundry features and full capabilities, check out the Foundry Book.
In order to install Foundry, you can use Foundryup
, the Foundry’s toolchain installer.
To install Foundryup
you have to run in the terminal:
After Foundryup
is installed, you can install Foundry
by running:
You can verify the installation by trying the following commands:
To create a foundry project you can simply run:
This will create a foundry project with the following structure:
You will also notice a .gitmodules
file — this is because Foundry
handles dependencies using Git submodules.
By default the Foundry structure stores smart contracts in the src
folder. You can change this in the foundry.toml
configuration file.
For instance:
In order to compile the project, simply run:
In order to work with Base, you need to configure a couple of settings in the configuration foundry.toml
file.
The first thing is the Solidity version.
You need to configure your config file as follows:
Be sure that you modify the pragma of your contracts and simply run forge build
to ensure everything works well.
We also recommend setting up JSON RPC endpoints for Base and the API key for Basescan in the configuration file so that your environment is ready to deploy your smart contracts.
Your configuration file should look like the following:
We included 2 JSON RPC endpoints for Base
and Base Sepolia
and similar for the Etherscan section, we included the configuration for Basescan
for Sepolia and Mainnet. Both rely on the same API Key, BASESCAN_API_KEY
.
In this tutorial, you’ve embarked on the journey of smart contract development with Base and Foundry. You’ve learned the essential steps, from installing Foundry using the convenient Foundryup
toolchain installer to creating your first project and configuring Foundry to seamlessly integrate with Base.
A tutorial that teaches how to set up your development environment to work with Foundry.
In this tutorial, you’ll learn how to set up Foundry, a toolchain for smart contract development. You’ll also learn how to configure it to work with Base.
By the end of this tutorial, you should be able to:
Foundry is a smart contract development toolchain that is composed of multiple small command line tools:
Using Foundry you can manage your dependencies, compile your project, run tests, deploy smart contracts and interact with the chain from the command-line and via Solidity scripts.
For a deep dive on the Foundry features and full capabilities, check out the Foundry Book.
In order to install Foundry, you can use Foundryup
, the Foundry’s toolchain installer.
To install Foundryup
you have to run in the terminal:
After Foundryup
is installed, you can install Foundry
by running:
You can verify the installation by trying the following commands:
To create a foundry project you can simply run:
This will create a foundry project with the following structure:
You will also notice a .gitmodules
file — this is because Foundry
handles dependencies using Git submodules.
By default the Foundry structure stores smart contracts in the src
folder. You can change this in the foundry.toml
configuration file.
For instance:
In order to compile the project, simply run:
In order to work with Base, you need to configure a couple of settings in the configuration foundry.toml
file.
The first thing is the Solidity version.
You need to configure your config file as follows:
Be sure that you modify the pragma of your contracts and simply run forge build
to ensure everything works well.
We also recommend setting up JSON RPC endpoints for Base and the API key for Basescan in the configuration file so that your environment is ready to deploy your smart contracts.
Your configuration file should look like the following:
We included 2 JSON RPC endpoints for Base
and Base Sepolia
and similar for the Etherscan section, we included the configuration for Basescan
for Sepolia and Mainnet. Both rely on the same API Key, BASESCAN_API_KEY
.
In this tutorial, you’ve embarked on the journey of smart contract development with Base and Foundry. You’ve learned the essential steps, from installing Foundry using the convenient Foundryup
toolchain installer to creating your first project and configuring Foundry to seamlessly integrate with Base.