---
description: Makes the next call create a transaction that can be signed and sent onchain
---

## `broadcast`

### Signature

```solidity
function broadcast() external;
function broadcast(address who) external;
function broadcast(uint256 privateKey) external;
```

### Description

Using the address that calls the test contract or the address/private key provided as the sender, has the next call (at this call depth only and excluding cheatcode calls) create a transaction that can later be signed and sent onchain.

### Parameters

| Parameter    | Type      | Description                                      |
|--------------|-----------|--------------------------------------------------|
| `who`        | `address` | The address to broadcast from (optional)         |
| `privateKey` | `uint256` | The private key to broadcast from (optional)     |

### Examples

```solidity [script/Deploy.s.sol]
function deploy() public {
    vm.broadcast(ACCOUNT_A);
    Test test = new Test();

    // This won't generate a tx to sign
    uint256 b = test.t(4);

    // This will
    vm.broadcast(ACCOUNT_B);
    test.t(2);

    // Using a private key from environment variables
    vm.broadcast(vm.envUint("PRIVATE_KEY"));
    test.t(3);
}
```

### Related Cheatcodes

- [`startBroadcast`](/reference/cheatcodes/start-broadcast) - Broadcast all subsequent calls
- [`stopBroadcast`](/reference/cheatcodes/stop-broadcast) - Stop broadcasting
- [`readCallers`](/reference/cheatcodes/read-callers) - Read the current caller mode
