.claude/skills/cast-commands/SKILL.md
Interact with EVM chains using Cast CLI. Use when querying blockchain data, sending transactions, calling contracts, or converting between formats. Cast is the Swiss Army knife for chain interaction.
npx skillsauth add cyotee/crane cast-commandsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cast is Foundry's command-line tool for interacting with EVM-compatible blockchains.
# Call a view function
cast call 0xContract "balanceOf(address)(uint256)" 0xAddress
# Call with RPC URL
cast call 0xContract "totalSupply()(uint256)" --rpc-url mainnet
# Call function with multiple return values
cast call 0xContract "getReserves()(uint112,uint112,uint32)"
# Get balance in wei
cast balance 0xAddress --rpc-url mainnet
# Get balance in ether
cast balance 0xAddress --rpc-url mainnet -e
# Read slot 0
cast storage 0xContract 0 --rpc-url mainnet
# Read specific slot
cast storage 0xContract 0x2 --rpc-url mainnet
# Get deployed bytecode
cast code 0xContract --rpc-url mainnet
# Send transaction
cast send 0xContract "transfer(address,uint256)" \
0xRecipient 1000000000000000000 \
--rpc-url mainnet \
--private-key $PRIVATE_KEY
# Send with value (ETH)
cast send 0xContract "deposit()" \
--value 1ether \
--rpc-url mainnet \
--private-key $PRIVATE_KEY
# Send raw ETH transfer
cast send 0xRecipient --value 1ether \
--rpc-url mainnet \
--private-key $PRIVATE_KEY
# Specify gas limit
cast send 0xContract "mint()" --gas 500000
# Specify gas price (legacy)
cast send 0xContract "mint()" --gas-price 50gwei
# Specify EIP-1559 fees
cast send 0xContract "mint()" \
--priority-gas-price 2gwei \
--gas-price 100gwei
# Encode function call data
cast abi-encode "transfer(address,uint256)" 0xRecipient 1000
# Encode constructor arguments
cast abi-encode "constructor(string,string,uint8)" "Token" "TKN" 18
# Decode function output
cast abi-decode "balanceOf(address)(uint256)" 0x000...0001
# Decode with multiple outputs
cast abi-decode "getReserves()(uint112,uint112,uint32)" 0x...
# Encode function selector + arguments
cast calldata "transfer(address,uint256)" 0xRecipient 1000
# Output: 0xa9059cbb...
# Decode calldata
cast calldata-decode "transfer(address,uint256)" 0xa9059cbb...
# Get 4-byte selector
cast sig "transfer(address,uint256)"
# Output: 0xa9059cbb
# Get event signature
cast sig-event "Transfer(address,address,uint256)"
# Hex to decimal
cast to-dec 0xff
# Output: 255
# Decimal to hex
cast to-hex 255
# Output: 0xff
# Convert to wei
cast to-wei 1.5 ether
# Output: 1500000000000000000
# Convert from wei
cast from-wei 1500000000000000000
# Output: 1.5
# Parse units
cast to-unit 1000000000000000000 ether
# Output: 1
# Format units
cast to-wei 100 gwei
# Output: 100000000000
# String to bytes32
cast format-bytes32-string "hello"
# Bytes32 to string
cast parse-bytes32-string 0x68656c6c6f...
# ASCII to hex
cast from-utf8 "hello"
# Hex to ASCII
cast to-ascii 0x68656c6c6f
# Checksum address
cast to-checksum-address 0xaddress
# Compute CREATE address
cast compute-address 0xDeployer --nonce 5
# Compute CREATE2 address
cast create2 --starts-with 0000 \
--deployer 0xDeployer \
--init-code-hash 0x...
# Get latest block
cast block latest --rpc-url mainnet
# Get specific block
cast block 18000000 --rpc-url mainnet
# Get block field
cast block latest --field timestamp --rpc-url mainnet
# Get transaction by hash
cast tx 0xTxHash --rpc-url mainnet
# Get specific field
cast tx 0xTxHash --field gasPrice --rpc-url mainnet
# Get receipt
cast receipt 0xTxHash --rpc-url mainnet
# Get logs
cast receipt 0xTxHash --field logs --rpc-url mainnet
# Get logs by event signature
cast logs "Transfer(address,address,uint256)" \
--from-block 18000000 \
--to-block latest \
--address 0xTokenContract \
--rpc-url mainnet
# Get chain ID
cast chain-id --rpc-url mainnet
# Get gas price
cast gas-price --rpc-url mainnet
# Get base fee
cast base-fee --rpc-url mainnet
# Get nonce
cast nonce 0xAddress --rpc-url mainnet
# Resolve ENS name
cast resolve-name vitalik.eth --rpc-url mainnet
# Lookup address
cast lookup-address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --rpc-url mainnet
# Generate new wallet
cast wallet new
# Get address from private key
cast wallet address --private-key $PRIVATE_KEY
# Sign message
cast wallet sign "message" --private-key $PRIVATE_KEY
# Verify signature
cast wallet verify --address 0xAddress "message" 0xSignature
# Run transaction trace
cast run 0xTxHash --rpc-url mainnet
# Quick trace
cast run 0xTxHash --quick --rpc-url mainnet
# Lookup function signature
cast 4byte 0xa9059cbb
# Output: transfer(address,uint256)
# Lookup event signature
cast 4byte-event 0xddf252ad...
# Keccak256 hash
cast keccak "hello"
# Hash function signature (for selector)
cast keccak "transfer(address,uint256)" | cut -c1-10
cast concat-hex 0x1234 0x5678
# Output: 0x12345678
# Generate access list for transaction
cast access-list 0xContract "swap(uint256)" 1000 \
--rpc-url mainnet
[rpc_endpoints]
mainnet = "${MAINNET_RPC_URL}"
sepolia = "${SEPOLIA_RPC_URL}"
# Use named endpoint
cast call 0xContract "totalSupply()(uint256)" --rpc-url mainnet
export ETH_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/...
cast call 0xContract "totalSupply()(uint256)"
See patterns.md for more examples.
cast call $TOKEN "balanceOf(address)(uint256)" $ADDRESS --rpc-url mainnet | cast to-dec
# Approve
cast send $TOKEN "approve(address,uint256)" $SPENDER $AMOUNT \
--rpc-url mainnet --private-key $PK
# Transfer
cast send $TOKEN "transferFrom(address,address,uint256)" $FROM $TO $AMOUNT \
--rpc-url mainnet --private-key $PK
# Get reserves
cast call $PAIR "getReserves()(uint112,uint112,uint32)" --rpc-url mainnet
# Get price
cast call $ROUTER "getAmountsOut(uint256,address[])(uint256[])" \
1000000000000000000 "[$WETH,$USDC]" --rpc-url mainnet
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
documentation
Write to contracts and send transactions. Use when executing state-changing contract functions.
development
HTTP and WebSocket transports for blockchain connectivity. Use when configuring network connections.
data-ai
Read contract data with type-safe ABI. Use when querying smart contract view/pure functions.