DOCUMENTATION

import SigDescription from "./sig-descriptionx"; import TransactionOptions from "../../reference/common/transaction-optionsx"; import WalletOptions from "../../reference/common/wallet-optionsx"; import RpcOptions from "../../reference/common/rpc-optionsx"; import EtherscanOptions from "../../reference/common/etherscan-optionsx"; import DisplayOptions from "../../reference/common/display-optionsx"; import CommonOptions from "./common-optionsx";

cast send


NAME

cast-send - Sign and publish a transaction.

SYNOPSIS

cast send [options] to [sig] [args...]

DESCRIPTION

Sign and publish a transaction.

The destination (to) can be an ENS name or an address.

<SigDescription />

OPTIONS

<TransactionOptions />

--resend
    Reuse the latest nonce of the sending account.

--create code [sig args...]
    Deploy a contract by specifying raw bytecode, in place of specifying a to address.

--auth auth
    EIP-7702 authorization list.

    Can be either a hex-encoded signed authorization or an address.

--access-list access_list
    EIP-2930 access list.

    Accepts either a JSON-encoded access list or an empty value to create the access list via an RPC call to eth_createAccessList. To retrieve only the access list portion, use the cast access-list command.

Receipt Options

--async
--cast-async
    Do not wait for the transaction receipt if it does not exist yet.
    Environment: CAST_ASYNC

-c confirmations
--confirmations confirmations
    Wait a number of confirmations before exiting. Default: 1.

<WalletOptions />

--unlocked
    Send via eth_sendTransaction using the --from argument or $ETH_FROM as sender.

<RpcOptions /> <EtherscanOptions /> <DisplayOptions /> <CommonOptions />

EXAMPLES

  1. Send some ether to Vitalik using your Ledger:

    cast send --ledger vitalik.eth --value 0.1ether
    
  2. Call deposit(address token, uint256 amount) on a contract:

    cast send --ledger 0x... "deposit(address,uint256)" 0x... 1
    
  3. Call a function that expects a struct:

    contract Test {
        struct MyStruct {
            address addr;
            uint256 amount;
        }
        function myfunction(MyStruct memory t) public pure {}
    }
    

    Structs are encoded as tuples (see struct encoding)

    cast send 0x... "myfunction((address,uint256))" "(0x...,1)"
    
  4. Send a transaction with hex data in the input field of the transaction object:

    cast send 0x... 0x68656c6c6f20776f726c64
    
  5. Sign an EIP-7702 authorization and attach it to a transaction from a different sender:

    cast send $(cast az) --private-key <sender-pk> --auth $(cast wallet sign-auth <address> --private-key <delegator-pk>)
    
  6. Send an EIP-7702 transaction delegating the sender to <address>:

    cast send $(cast az) --auth <address>
    

SEE ALSO

cast, cast call, cast publish, cast receipt, cast mktx, struct encoding