Skip to content

Instantly share code, notes, and snippets.

@crazyoptimist
Last active September 26, 2026 11:45
Show Gist options
  • Select an option

  • Save crazyoptimist/2b0c9adf715543c20a3a4b2c50b46817 to your computer and use it in GitHub Desktop.

Select an option

Save crazyoptimist/2b0c9adf715543c20a3a4b2c50b46817 to your computer and use it in GitHub Desktop.
CLAUDE Config for using Foundry Cast

foundry-cast

Wallet operations (balance checks, transfers) using Foundry's cast CLI, based on: https://gist.github.com/crazyoptimist/232febf49ad0df9f039f9789b91129f1

Wallet

  • Keystore name: main (file: ~/.foundry/keystores/main, use with --account main)
  • "main" wallet address: 0xFaF2D6577eFDeC875cbcbcf930fe10c8fC547799
  • Password is NOT stored anywhere. cast send --account main ... prompts for the keystore password interactively on the terminal — always run send commands in the foreground so that prompt can be answered. Never pass --password on the command line (leaks into shell history / process list) and never write the password into any file.

Networks & RPC endpoints (from the gist)

Network RPC URL
Ethereum mainnet https://ethereum-rpc.publicnode.com
BNB Smart Chain (BSC) https://bsc-dataseed.binance.org

Default to Ethereum mainnet unless the user says BSC/BNB.

Token contracts

Token Network Contract address Decimals
USDT-ERC20 Ethereum 0xdAC17F958D2ee523a2206206994597C13D831ec7 6
USDT-BEP20 BSC 0x55d398326f99059fF775485246999027B3197955 18
USDC-ERC20 Ethereum 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 6
USDC-BEP20 BSC 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d 18

TRON (USDT-TRC20) is NOT supported by cast (not EVM-compatible).

Balance checks (safe, read-only — run directly, no confirmation needed)

# Native coin (ETH or BNB)
cast balance <ADDRESS> --rpc-url <RPC_URL> --ether

# USDT (ERC20 or BEP20) — raw uint256, divide by 10^decimals for human amount
cast call <TOKEN_CONTRACT> "balanceOf(address)(uint256)" <ADDRESS> --rpc-url <RPC_URL>

Example for the main wallet on Ethereum:

cast balance 0xFaF2D6577eFDeC875cbcbcf930fe10c8fC547799 --rpc-url https://ethereum-rpc.publicnode.com --ether
cast call 0xdAC17F958D2ee523a2206206994597C13D831ec7 "balanceOf(address)(uint256)" 0xFaF2D6577eFDeC875cbcbcf930fe10c8fC547799 --rpc-url https://ethereum-rpc.publicnode.com

Sending funds (irreversible — always confirm recipient + amount + network in one short line before running)

# Native coin
cast send <RECIPIENT> --value <AMOUNT>ether --rpc-url <RPC_URL> --account main

# ERC20/BEP20 token transfer (amount is in raw token units — apply the token's decimals)
cast send <TOKEN_CONTRACT> "transfer(address,uint256)" <RECIPIENT> <RAW_AMOUNT> --rpc-url <RPC_URL> --account main

Workflow for a send request like "send 5 USDT to 0xABC...":

  1. Check the main wallet's relevant balance first (native coin for gas, plus the token if sending a token) to confirm funds are sufficient.
  2. Compute the raw amount using the token's decimals table above (e.g. 5 USDT-ERC20 = 5000000).
  3. State a one-line confirmation: token/coin, amount, recipient, network — then run the command.
  4. Run the cast send command in the foreground so the user can type the keystore password when prompted.
  5. Report the transaction hash from the output.

Quick prompt patterns

  • "check balance" / "how much do I have" → run native, USDT and USDC balance checks on Ethereum mainnet (or BSC if specified) for the main wallet.
  • "send X ETH/USDT/BNB to ADDR" → follow the sending workflow above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment