Skip to content
Logo

Cast

Cast performs Ethereum RPC calls, sends transactions, and decodes data from the command line. It's the Swiss Army knife for blockchain interaction.

Cast works both inside and outside a Foundry project.

Key capabilities

FeatureDescription
Chain dataRead blocks, transactions, logs, and account state
TransactionsSend transactions and interact with contracts
WalletsManage keys, sign messages, and verify signatures
ABI encodingEncode/decode calldata, events, and function signatures
UtilitiesConvert units, compute hashes, and manipulate data

Common workflows

Get the latest block number
$ cast block-number
Read a contract's storage
$ cast call $CONTRACT "balanceOf(address)" $ADDRESS
Send a transaction
$ cast send $CONTRACT "transfer(address,uint256)" $TO $AMOUNT --private-key $KEY
Decode calldata
$ cast 4byte-decode 0xa9059cbb000000000000000000000000...
Get an account's ETH balance
$ cast balance $ADDRESS

Learn more