A Simple Guide to Deploy Celo dApps with Foundry


Foundry is a blazing fast, portable toolkit for Ethereum application development written in Rust. It enables us to build, test, deploy and Interact with smart contracts. In this article we will dive into how to deploy Celo dApps on the Celo Blockchain using Foundry. Whether you’re a beginner or a seasoned developer, this tutorial is a great resource for anyone looking to deploy smart contracts on the Celo network using Foundry.

Few of the advantages of using Foundry are the following:

  • Speed
  • Built-in Fuzzing
  • Solidity-based testing
  • Scripts based in bash / shell


You will need solid and prior knowledge of the following:

  • Solidity: Solidity is an object-oriented programming language for implementing smart contracts on various blockchain platforms.
  • Blockchain concepts: A good understanding of basic blockchain technologies and their useful tool for development will suffice to take you through this tutorial.


To complete this article

Let’s Begin: Installing Foundry

To install foundry, the first step will be to open our terminal and type the following command:

curl -L https://foundry.paradigm.xyz | bash

This will install foundryup, after installing foundryup, you can easily follow the on-screen instructions to make the foundryup command accessible in your Command Line Interface (CLI).


After running this command, you will now have four binaries at your disposal: forge, cast, anvil, and chisel.

On Windows

You need to build from the source if you use a windows os to get Foundry. Download and run rustup-init from rustup.rs 2. It will start the installation in a console. If you encounter an error, delete and install the latest version of VS Code which you can download Here and install. After this, run the following to build Foundry from the source:

cargo install --git https://github.com/foundry-rs/foundry foundry-cli anvil chisel --bins --locked

Deploying A Smart Contract

forge init foundry

To get a new project started we use the command forge init and the name we want to give to the project. Great work, the next step will be to open our newly created project file. Inside your project folder, you will find a folder named src. Create a file named contract.sol, this is where we will create our smart contract code. For example, let’s create a simple smart contract that stores your favorite number:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

contract SimpleStorage{

uint256 public favoriteNumber;

function store (uint256 _favoriteNumber) public {

favoriteNumber = _favoriteNumber;


function retrive() public view returns (uint256) {

return favoriteNumber;



After saving the file we will need to compile our code to make sure there are no errors. Foundry makes it very easy to compile our smart contract. All we have to do is run the following command in our terminal:

forge compile

If everything is successful and no error is shown, the next step will be to deploy our smart contract.

forge create --rpc-url https://alfajores-forno.celo-testnet.org --private-key <privatekey> src/contract.sol:SimpleStorage

Great work, your smart contract has been deployed.

Congratulations :sparkles:

That wraps up today’s topic where we deployed a dApp on the Celo blockchain using Foundry. One of the coolest things about Foundry is that it has a book where you can go right through and learn all there is to know about deploying, testing your Celo dApps on Foundry. Hopefully, you’ve learned a few things about Deploying on Celo with Foundry that you can apply in the real world.


About the Author

Oselukwue Kinyichukwu is a Fullstack developer with a passion for learning, building, and teaching. You can follow me on Twitter, check out my profile on LinkedIn, and see what I’m building on Github.


Hi @kinyichukwu I’ll be reviewing your piece in 1 to 2 days

1 Like