> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# broadcastFlow

# broadcastFlow

Records that a flow transaction has been broadcast. For wallet sources, pass the `txHash` from the on-chain transaction. For exchange sources, `txHash` can be omitted.

<Note>
  Most integrations should use [`submitFlowTransaction`](/docs/javascript/reference/client/submit-flow-transaction) instead, which calls `broadcastFlow` automatically after signing. Use `broadcastFlow` directly only when you handle signing and broadcasting yourself.
</Note>

## When to call

* For a wallet source, call `broadcastFlow` after the on-chain transaction is submitted and `executionState` is `signing`. Pass its transaction hash.
* For an exchange source, call it after the user completes the exchange transfer and `executionState` is `source_attached`. The transaction hash is optional.

Before retrying after an interruption or network error, call [`getFlow`](/docs/javascript/reference/client/get-flow). If the state is already `broadcasted` or `source_confirmed`, the broadcast was recorded successfully; poll the flow instead of calling `broadcastFlow` again. If the flow is `cancelled`, `expired`, or `failed`, create a new flow for another attempt.

<Warning>
  Calling `broadcastFlow` from any other state returns `409`. If a transaction
  hash was already recorded, re-fetch the flow to verify its state instead of
  retrying the same broadcast call.
</Warning>

## Usage

```javascript theme={"system"}
import { broadcastFlow } from '@dynamic-labs-sdk/client';

const flow = await broadcastFlow({
  flowId: 'your-flow-id',
  txHash: '0xabc123def456...',
});
```

## Parameters

| Parameter | Type                | Description                                                                                |
| --------- | ------------------- | ------------------------------------------------------------------------------------------ |
| `flowId`  | `string`            | The flow ID.                                                                               |
| `txHash`  | `string` (optional) | The on-chain transaction hash. Required for wallet sources, optional for exchange sources. |

## Returns

`Promise<Flow>` — the flow with `executionState: 'broadcasted'`.

<Warning>
  After broadcast, the flow cannot be cancelled. The backend begins monitoring the blockchain and orchestrating settlement.
</Warning>

## Examples

### Wallet source

```javascript theme={"system"}
import { broadcastFlow } from '@dynamic-labs-sdk/client';

const flow = await broadcastFlow({
  flowId: 'your-flow-id',
  txHash: '0xabc123def456...',
});
```

### Exchange source

```javascript theme={"system"}
import { broadcastFlow } from '@dynamic-labs-sdk/client';

// No txHash needed — the user completed payment on the exchange
const flow = await broadcastFlow({
  flowId: 'your-flow-id',
});
```

## React

```tsx theme={"system"}
import { useBroadcastFlow } from '@dynamic-labs-sdk/react-hooks';

function BroadcastButton({ flowId, txHash }) {
  const { mutate: broadcast, isPending } = useBroadcastFlow();

  return (
    <button onClick={() => broadcast({ flowId, txHash })} disabled={isPending}>
      {isPending ? 'Broadcasting...' : 'Broadcast'}
    </button>
  );
}
```

## Related

* [Fireblocks Flow JavaScript SDK guide](/docs/overview/fireblocks-flow-js-sdk) - End-to-end flow guide
* [`submitFlowTransaction`](/docs/javascript/reference/client/submit-flow-transaction) - Recommended: handles prepare, sign, and broadcast
* [`prepareFlowSigning`](/docs/javascript/reference/client/prepare-flow-signing) - Prepare signing payload
* [`getFlow`](/docs/javascript/reference/client/get-flow) - Poll flow state after broadcast
