Wallet operations (balance checks, transfers) using Foundry's cast CLI, based on:
https://gist.github.com/crazyoptimist/232febf49ad0df9f039f9789b91129f1
- 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--passwordon the command line (leaks into shell history / process list) and never write the password into any file.
| 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 | 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).
# 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.comSending 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 mainWorkflow for a send request like "send 5 USDT to 0xABC...":
- Check the main wallet's relevant balance first (native coin for gas, plus the token if sending a token) to confirm funds are sufficient.
- Compute the raw amount using the token's decimals table above (e.g. 5 USDT-ERC20 =
5000000). - State a one-line confirmation: token/coin, amount, recipient, network — then run the command.
- Run the
cast sendcommand in the foreground so the user can type the keystore password when prompted. - Report the transaction hash from the output.
- "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.