Assuming you already have Rust and Foundry installed.
See the Book of Foundry to learn more.
forge install
- Compile the project
forge build
- Run test suite
forge test
forge doc
forge coverage
forge fmt
forge inspect <YourContractName> methods
Open Anvil local node
anvil
Encryption using ERC2335
In the forge console:
- Open the interactive console to import your private key
cast wallet import <KEYNAME> --interactive
- Paste your private key in the prompt
- Input a password for that key (remember, a safe and brand-new one. REMEMBER it)
See all stored keys
cast wallet list
Use it in your scripts like I do on the following scripts
View the full video from Patrick Collins for Cyfrin if it's not clear
Load .env variables in .env file->NO spaces between variable name and value, value with quotes. ETHERSCAN_KEY="blablabla"
source .env
Run on local node
Note --sender
is the public address of your private key
forge script script/DeployLocal.s.sol:Deploy --fork-url http://localhost:8545 --account <PRIVATE_KEY_NAME> --sender <ACCOUNT_ADDRESS> --broadcast -vvvv
Deploy to Sepolia
Deploy to Sepolia and verify.
Note --sender
is the public address of your private key
forge script script/DeployTestnet.s.sol:Deploy --rpc-url $SEPOLIA_KEY --account <PRIVATE_KEY_NAME> --sender <ACCOUNT_ADDRESS> --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv