> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Send Raw Transaction \[transaction.sendRaw]

Sends a signed serialized transaction and waits for its transaction receipt.

## Usage

Use `sendRawSync` to send a signed serialized transaction and wait for its receipt.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const receipt = await client.transaction.sendRawSync({
  transaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33',
})
// @log: {
// @log:   status: 'success',
// @log:   transactionHash: '0x...',
// @log: }
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

### Asynchronous Usage

Use `sendRaw` to broadcast with `eth_sendRawTransaction` and return the transaction hash
immediately.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const hash = await client.transaction.sendRaw({
  transaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33',
})
// @log: '0x...'
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

### Standalone Action

Call `Actions.transaction.sendRawSync` directly by passing the Client as the first argument. Use
`Actions.transaction.sendRaw` for the asynchronous variant.

:::code-group
```ts twoslash [example.ts]
import { Actions } from 'viem'
import { client } from './viem.config'

const receipt = await Actions.transaction.sendRawSync(client, {
  transaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33',
})
// @log: {
// @log:   status: 'success',
// @log:   transactionHash: '0x...',
// @log: }
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
})
```
:::

## Recipes

### Reject a Reverted Receipt

Set `throwOnReceiptRevert` when a reverted receipt must reject instead of returning normally.

:::code-group
```ts twoslash [example.ts]
import { Hex } from 'viem/utils'
import { client } from './viem.config'

export function sendChecked(transaction: Hex.Hex) {
  return client.transaction.sendRawSync({
    throwOnReceiptRevert: true, // [!code focus]
    transaction,
  })
}
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

### Cancel or Time Out the Request

Use the request signal to cancel from application code. Use `timeout` to cap the sync RPC response
time.

:::code-group
```ts twoslash [example.ts]
import { Hex } from 'viem/utils'
import { client } from './viem.config'

export function sendWithDeadline(transaction: Hex.Hex) {
  return client.transaction.sendRawSync({
    requestOptions: { signal: AbortSignal.timeout(5_000) }, // [!code focus]
    timeout: 10_000, // [!code focus]
    transaction,
  })
}
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

## Return Value

### Synchronous

`TransactionReceipt`

The transaction receipt.

### Asynchronous

`Hex`

The transaction hash.

## Parameters

### requestOptions

* **Type:** `{ dedupe?: boolean; signal?: AbortSignal; ... }`

Per-request transport options forwarded to the transaction RPC request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const controller = new AbortController()
const hash = await Actions.transaction.sendRaw(client, {
  requestOptions: { signal: controller.signal }, // [!code focus]
  transaction: '0x02f850018203118080825208808080c080a0…',
})
```

### throwOnReceiptRevert

* **Type:** `boolean`

Whether `sendRawSync` throws if the returned receipt status is `reverted`.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const receipt = await Actions.transaction.sendRawSync(client, {
  throwOnReceiptRevert: true, // [!code focus]
  transaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33',
})
```

### timeout

* **Type:** `number`

Timeout, in milliseconds, for the `sendRawSync` RPC response.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const receipt = await Actions.transaction.sendRawSync(client, {
  timeout: 60_000, // [!code focus]
  transaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33',
})
```

### transaction

* **Type:** `Hex`

The signed serialized transaction.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const hash = await Actions.transaction.sendRaw(client, {
  transaction: '0x02f850018203118080825208808080c080a0…', // [!code focus]
})
```

## Errors

| Error | Description |
| --- | --- |
| `Actions.transaction.Errors.TransactionReceiptRevertedError` | The transaction receipt status was `reverted` and `throwOnReceiptRevert` was enabled. |
