1. Installing Monad Foundry
Install the Monad Foundry installer:forge, cast, anvil, and chisel with Monad support.
If you’re on Windows, you’ll need to use WSL, since Foundry currently doesn’t work natively on Windows. Please follow this link to learn more about WSL.
2. Create a new foundry project
The below command usesfoundry-monad to create a new foundry project:
3. Modify Foundry configuration
Update thefoundry.toml file to add Monad Testnet configuration.
foundry.toml
4. Write a smart contract
You can write your smart contracts under thesrc folder. There is already a Counter contract in the project located at src/Counter.sol.
src/Counter.sol
5. Compile the smart contract
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
- Using a Keystore (Recommended)
- Using a Private Key (Not Recommended)
Using a keystore is much safer than using a private key because keystore encrypts the private key and can later be referenced in any commands that require a private key.Create a new keystore by importing a newly generated private key with the command below.Here is what the command above does, step by step:Provide a password to encrypt the keystore file when prompted and do not forget it.Run the below command to deploy your smart contracts
- Generates a new private key
- Imports the private key into a keystore file named
monad-deployer - Prints the address of the newly created wallet to the console

