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.

The signature (sig) can be:

  • A fragment: someFunction(uint256,bytes32)
  • A selector and encoded calldata: 0xcdba2fd40000000000000000000000000000000000000000000000000000000000007a69
  • Only the function name: in this case Cast will try to fetch the function signature from Etherscan

OPTIONS

Transaction Options

--gas-limit gas_limit
    Gas limit for the transaction.

--gas-price price
    Gas price for the transaction, or max fee per gas for EIP1559 transactions.

--priority-gas-price price
    Max priority fee per gas for EIP1559 transactions.

--value value
    Ether to send in the transaction.

    Either specified as an integer (wei), or as a string with a unit, for example:
    - 1ether
    - 10gwei
    - 0.01ether

--nonce nonce
    Nonce for the transaction.

--legacy
    Send a legacy transaction instead of an EIP1559 transaction.

    This is automatically enabled for common networks without EIP1559.

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

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.

Wallet Options - Raw

-i
--interactive
    Open an interactive prompt to enter your private key.

--private-key raw_private_key
    Use the provided private key.

--mnemonic-path path
    Use the mnemonic file at the specified path.

--mnemonic-index index
    Use the private key from the given mnemonic index. Used with --mnemonic-path.
    Defaults to 0.

Wallet Options - Keystore

--keystore path
    Use the keystore in the given folder or file.
    Environment: ETH_KEYSTORE

--password password
    The keystore password. Used with --keystore.

Wallet Options - Hardware Wallet

-t
--trezor
    Use a Trezor hardware wallet.

-l
--ledger
    Use a Ledger hardware wallet.

--hd-path path
    The derivation path to use with hardware wallets.

Wallet Options - Remote

-f address
--from address
    Sign the transaction with the specified account on the RPC.
    Environment: ETH_FROM

RPC Options

--rpc-url url
    The RPC endpoint.
    Environment: ETH_RPC_URL

--flashbots
    Use the Flashbots RPC URL (https://rpc.flashbots.net).

Etherscan Options

-c chain_name
--chain chain_name
    The Etherscan chain.

--etherscan-api-key key
    Etherscan API key.
    Environment: ETHERSCAN_API_KEY

Display Options

-j
--json
    Output in JSON format.

Common Options

-h
--help
    Prints help information.

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)"
    

SEE ALSO

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