Setup Foundry
Foundry is a blazing fast, portable, and modular toolkit for Ethereum application development written in Rust. This guide will help you set up Foundry for developing on SKALE.Prerequisites
- Rust installed on your machine
- Basic command-line knowledge
If you are on a Windows machine, you will need to use Windows Subsystem for Linux (WSL), since Foundry doesn’t work natively on Windows.
Step 1: Install Foundry
Install Foundry by running:- Forge: Build, test, and deploy smart contracts
- Cast: Interact with EVM smart contracts, send transactions, and read chain data
- Anvil: Local Ethereum node for testing
- Chisel: Solidity REPL
Step 2: Verify Installation
Verify that Foundry is installed correctly:Step 3: Create a New Foundry Project
Create a new Foundry project:Step 4: Configure Foundry for SKALE
Update thefoundry.toml file to add SKALE Chain endpoints:
Replace the RPC URLs with your specific SKALE Chain endpoint. You can find SKALE Chain endpoints in the SKALE Portal.
Step 5: Install Dependencies
Install OpenZeppelin Contracts (or other dependencies):lib directory.
Step 6: Configure Remappings
Update yourremappings.txt file to include:
Step 7: Create a Keystore (Optional but Recommended)
For secure deployment, create a Foundry keystore:Provide a password to encrypt the keystore file. If you forget this password, you will not be able to recover it.
Step 8: Test Your Setup
Compile your contracts:SKALE-Specific Considerations
When deploying to SKALE, remember to:-
Use the
--legacyflag: SKALE Chains require legacy transaction format -
Use
--slowflag for scripts: When running scripts with multiple transactions -
Verify contracts: Use the block explorer API for verification
