crypto-wallet-testing
Crypto Wallet for Testing
A pre-funded wallet you can tap into whenever you need funds for on-chain testing or experiments. This is a low-value utility wallet — draw what you need, leave the rest for future operations.
You already know how to deploy contracts, send transactions, and interact with chains. This skill just tells you where the funds are and the rules for using them.
Finding the Wallet
Resolve the private key using this precedence (stop at the first match):
TESTING_WALLET_PK_FILEenv var — path to a file containing the hex-encoded private keycat "$TESTING_WALLET_PK_FILE"- Convention path —
~/.config/crypto-wallet-testing/pk.hexcat ~/.config/crypto-wallet-testing/pk.hex TESTING_WALLET_PKenv var — raw hex string (less preferred; can leak in shell history/logs)echo "$TESTING_WALLET_PK"
If none are found, stop and tell the user:
I need a funding wallet for this task. Set one up by either:
- Creating
~/.config/crypto-wallet-testing/pk.hexwith your hex-encoded private key- Setting the
TESTING_WALLET_PK_FILEenv var to point to your key file
Deriving the Address
Once you have the private key, derive the wallet address using cast (from Foundry):
cast wallet address --private-key "$PK"
Check the balance on the target chain before doing anything:
cast balance "$ADDRESS" --rpc-url <chain_rpc>
Rules of Use
Never print or log the private key
Even for a low-value wallet — if the key leaks into logs, terminal history, or tool output, the wallet can be drained. Load it into variables, pass it to commands, but never echo it or include it in output shown to the user.
Draw only what the task needs
Don't sweep the entire balance. Future tasks may need these funds too. Transfer the minimum required for the current operation plus a small buffer for gas.
Prefer funding disposable wallets
For most interactions, create a fresh wallet(or use the one that is being passed in context) and fund it from this one. This limits blast radius — if something goes wrong, only the disposable wallet is exposed, not the funding source + the tests might require a specific address, and not this one.
Check balance before operating
Before starting any on-chain work:
- Check the balance on the target chain
- If insufficient, bridge funds first (see Bridging below)
- If the funding wallet itself is empty, tell the user
Gas awareness
Always ensure enough native gas token (ETH) on the target chain(unless using EIP-7702 or ERC-4337 acconts). Bridging tokens without gas means you can't execute transactions. LiFi handles this (see Bridging).
Bridging
When the target chain doesn't have enough funds, bridge from a chain where the wallet has a balance.
Tool: defi CLI
The preferred bridging tool. If not installed:
curl -fsSL https://raw.githubusercontent.com/ggonzalez94/defi-cli/main/scripts/install.sh | sh
Provider: LiFi (preferred)
Use LiFi as the bridge provider when possible. Key advantage: it can deliver both native gas and the bridged token to chains where the wallet has zero balance. This solves the cold-start problem on new chains.
Bridging workflow
- Identify which chain has funds (check balances across major chains)
- Bridge to the target chain using
defiCLI with LiFi - Request native gas as part of the bridge if the target chain has zero ETH
- Verify arrival before proceeding with the original task
Quick Reference
See references/chain-reference.md for:
- Chain IDs (don't guess these — they differ per network)
- Common token addresses per chain (USDC, USDT, WETH — these vary across chains)