Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
- Chisel: Fast, utilitarian, and verbose solidity REPL.
forge buildforge testforge fmtforge snapshotanvilFirst, you need to create a keystore file. Do not forget to remember the password! You will need it to deploy your contract.
cast wallet import monad-deployer --private-key $(cast wallet new | grep 'Private key:' | awk '{print $3}')After creating the keystore, you can read its address using:
cast wallet address --account monad-deployerThe command above will create a keystore file named monad-deployer in the ~/.foundry/keystores directory.
Then, you can deploy your contract to the Monad Testnet using the keystore file you created.
forge create src/Counter.sol:Counter --rpc-url https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6 --account monad-deployer --broadcast## Verify Your Contract on Monad Testnet
forge verify-contract <contract_address> <contract_name> --chain-id 10143 --verifier sourcify --verifier-url https://sourcify-api-monad.blockvision.org cast <subcommand>forge --help
anvil --help
cast --helpThis error happens when you don't have enough balance to deploy your contract. You can check your balance with the following command:
cast wallet address --account monad-deployer### I have constructor arguments, how do I deploy my contract?
forge create src/Counter.sol:Counter --rpc-url https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6 --account monad-deployer --broadcast --constructor-args <constructor_arguments>### I have constructor arguments, how do I verify my contract?
forge verify-contract <contract_address> <contract_name> --chain-id 10143 --verifier sourcify --verifier-url https://sourcify-api-monad.blockvision.org --constructor-args <abi_encoded_constructor_arguments>Please refer to the Foundry Book for more information.