Skip to main content
contract.write.<fn>(...args, options?) encodes calldata for nonpayable and payable functions, submits the transaction via eth_sendTransaction, and returns a 32-byte HashType transaction hash immediately upon submission.

Basic Usage

eth_sendTransaction resolves once the node accepts the transaction into its mempool. Execution happens asynchronously and may revert on-chain. Always wait for a receipt before treating state changes as final.

Transaction Options

Pass a trailing WriteCallOptions object after the ABI arguments to set sender, fees, gas limit, ETH value, or nonce:

Simulate Before Sending

Call estimateGas first to catch reverts before broadcasting and add a 20% headroom buffer:

Waiting for Confirmation

Use pollForReceipt from @tevm/voltaire/utils to wait until the transaction is mined:

Error Handling

write throws ContractFunctionNotFoundError if the function is absent or is view/pure. Wallet rejections, insufficient funds, invalid nonces, and simulation reverts are wrapped in ContractWriteError with error.cause holding the underlying RpcError.