Skip to main content
This guide uses the official Foundry v1.8 or later to compile and deploy a contract on Monad Testnet.

1. Install Foundry

Install the official Foundry installer:
Follow the installer instructions to add foundryup to your shell, then install the latest stable release:
Confirm that forge --version reports v1.8.0 or later. See the Foundry toolkit page for more installation and migration guidance.

2. Create a new foundry project

You can use foundry-monad template to create a new project.Foundry-Monad is a Foundry template with Monad configuration.
The below command uses foundry-monad to create a new foundry project:
Alternatively, you can create a foundry project using the command below:

3. Modify Foundry configuration

Update foundry.toml to select the Monad execution environment and configure Monad Testnet:
foundry.toml
The network = "monad" setting is the persistent equivalent of passing --network monad. It makes Forge use Monad’s execution rules for local compilation, testing, scripts, and transaction simulation. Foundry selects the active hardfork automatically when interacting with Monad Testnet.

4. Write a smart contract

You can write your smart contracts under the src folder. There is already a Counter contract in the project located at src/Counter.sol.
src/Counter.sol

5. Compile the smart contract

Compilation process output can be found in the newly created out directory, which includes contract ABI and bytecode.

6. Deploy the smart contract

For deploying contracts, we recommend using keystores instead of private keys.

Get testnet funds

Deploying smart contracts requires testnet funds. Claim testnet funds via a faucet.

Deploy smart contract

On successful deployment of the smart contract, the output should be similar to the following:

Next Steps

Check out how to verify the deployed smart contract on MonadVision.