Skip to content
Logo

Sending transactions

Cast sends transactions to deploy contracts, call functions, and transfer value. Transactions require a signer (private key, keystore, or hardware wallet).

Basic transaction

$ cast send $TO --value 1ether --private-key $PRIVATE_KEY

Signing options

Private key

Pass directly (not recommended for production):

$ cast send $CONTRACT "mint()" --private-key $PRIVATE_KEY

Keystore file

Use an encrypted keystore:

$ cast send $CONTRACT "mint()" --keystore ~/.foundry/keystores/my-key --password $PASSWORD

Or prompt for password:

$ cast send $CONTRACT "mint()" --keystore ~/.foundry/keystores/my-key --interactive

Hardware wallet

Use Ledger or Trezor:

$ cast send $CONTRACT "mint()" --ledger
$ cast send $CONTRACT "mint()" --trezor

AWS KMS

Use a key stored in AWS KMS:

$ cast send $CONTRACT "mint()" --aws

Transaction parameters

$ cast send $CONTRACT "mint()" --gas-limit 100000 --private-key $KEY

Waiting and confirmations

By default, cast send waits for the transaction to be mined.

$ cast send $CONTRACT "mint()" --private-key $KEY --async

Transaction simulation

Preview a transaction without sending:

Simulate with cast call
$ cast call $CONTRACT "transfer(address,uint256)" $TO $AMOUNT --from $SENDER
Estimate gas
$ cast estimate $CONTRACT "transfer(address,uint256)" $TO $AMOUNT --from $SENDER

Access lists (EIP-2930)

Create an access list to reduce gas costs:

Generate access list
$ cast access-list $CONTRACT "transfer(address,uint256)" $TO $AMOUNT --from $SENDER
Send with access list
$ cast send $CONTRACT "transfer(address,uint256)" $TO $AMOUNT --access-list $ACCESS_LIST --private-key $KEY

Raw transactions

Sign without sending
$ cast mktx $CONTRACT "mint()" --private-key $KEY
Publish a signed transaction
$ cast publish $SIGNED_TX

Blob transactions (EIP-4844)

Send transactions with blob data:

Send blob transaction
$ cast send $CONTRACT "submitBlob()" --blob "0x..." --private-key $KEY