forge and cast know both networks by name, compile for the right EVM version and sign with an encrypted key.
What you’ll build
A Foundry project with:bot_testnetandbot_mainnetRPC aliases you can pass to any command.evm_version = "cancun", so your bytecode runs on BOT Chain.- A keystore wallet called
uzo-dev, so no private key sits in a file or your shell history.
Prerequisites
- Foundry installed. If you followed the quickstart you already have it. Otherwise run
curl -L https://foundry.paradigm.xyz | bash, thenfoundryup. These docs were tested with Foundry 1.8.3. - Some tBOT for the wallet you’ll create. See Get testnet tokens.
Steps
1
Create a project
foundry.toml.2
Configure foundry.toml
Replace the contents of
foundry.toml with:foundry.toml
evm_version = "cancun"matters most. Newer compilers default to a later EVM version that BOT Chain doesn’t support. See Supported EIPs.[rpc_endpoints]lets you write--rpc-url bot_testnetinstead of the full URL.
3
Create a keystore wallet
Create a new key and save it encrypted under the name To use a key you already have instead, import it. Cast prompts for the key, so it never appears in your shell history:Keystores live in From now on, add
uzo-dev. Cast asks you for a password.~/.foundry/keystores/. List them and print the address:--account uzo-dev to any command that sends a transaction.4
Fund the wallet
Claim tBOT for the address
cast wallet address printed. See Get testnet tokens.Verify it worked
Check that both aliases reach the right chain:968 and then 677. Then check your balance and build:
Troubleshooting
error: Unknown RPC alias or a URL parse error
error: Unknown RPC alias or a URL parse error
Run the command from the folder that contains
foundry.toml. Aliases are read from the project config, so they don’t work in other folders.transaction underpriced
transaction underpriced
Foundry reads the 20 gwei minimum tip from the node, so this is rare. If you set
--priority-gas-price or --gas-price yourself, use at least 20gwei. See Gas and fees.invalid opcode when calling a deployed contract
invalid opcode when calling a deployed contract
The contract was compiled for a newer EVM version. Check
evm_version = "cancun", then run forge clean and forge build.Keystore not found
Keystore not found
--account only looks in ~/.foundry/keystores/. Run cast wallet list to check the name.Next steps
Deploy with Foundry
Use
forge create or a deploy script.Verify with Foundry
Publish your source on BOTScan.