--- name: evm-swiss-knife description: Interact with EVM-compatible blockchains using Foundry's cast tool for querying balances, calling contracts, sending transactions, and blockchain exploration. Use when needing to interact with Ethereum Virtual Machine networks via command-line, including reading contract state, sending funds, executing contract functions, or inspecting blockchain data. --- # EVM Swiss Knife This skill enables interaction with EVM-compatible blockchains through Foundry's `cast` command-line tool. It covers common blockchain operations like balance queries, contract calls, transaction sending, and network inspection. ## Installation To use this skill, you need Foundry installed, which provides the `cast` command. Follow the official installation guide: https://getfoundry.sh/introduction/installation ### Quick Install (Linux/Mac) 1. Install Foundryup: ```bash curl -L https://foundry.paradigm.xyz | bash ``` 2. Source your shell configuration or start a new terminal: ```bash source ~/.bashrc # or ~/.zshrc ``` 3. Install Foundry: ```bash foundryup ``` 4. Verify installation: ```bash cast --version ``` For other platforms or detailed instructions, see the full guide at https://getfoundry.sh/introduction/installation ## Prerequisites - Foundry installed (`cast` command available) - RPC endpoint configured (via `--rpc-url` or environment variables) - Private key for transaction operations (if sending txs) ## RPC URL Selection To interact with different EVM networks, you need reliable RPC endpoints. Use ChainList's API at https://chainlist.org/rpcs.json to get a comprehensive JSON list of RPC URLs for all supported chains. ### How to Select RPC URLs: 1. Fetch the RPC data: ```bash curl -s https://chainlist.org/rpcs.json | jq '.[] | select(.chainId == 1)' # For Ethereum (chain ID 1) ``` 2. Look for RPC URLs that are: - **Public and free**: No API keys required - **No or limited tracking**: Avoid URLs with "tracking": "yes" - **Fast and reliable**: Prefer URLs with low latency or high score - **Open source**: Prefer community-maintained endpoints 3. Popular choices (extracted from ChainList): - Ethereum (ID 1): https://ethereum-rpc.publicnode.com - BNB Smart Chain (ID 56): https://bsc-dataseed.binance.org - Base (ID 8453): https://mainnet.base.org - Polygon (ID 137): https://polygon-rpc.com 4. For production use, consider paid RPC services like Alchemy, Infura, or QuickNode for higher reliability and rate limits. 5. Always verify the chain ID matches your intended network to avoid connecting to wrong chains. ## Common Operations ### Query Account Balance Get ETH balance of an address: ```bash cast balance
--rpc-url