> **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.

# TxEnvelope.serialize

:::info
`TxEnvelope.serialize` is a re-export of ox's [`TransactionEnvelope.serialize`](https://oxlib.sh/api/TransactionEnvelope/serialize). Refer to the ox documentation for the full reference.
:::

Serializes a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope).

## Imports

```ts
import { TxEnvelope } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { TxEnvelope } from 'viem/utils'

const serialized = TxEnvelope.serialize({
  chainId: 1,
  maxFeePerGas: 1n,
  type: 'eip1559'
})
```

## Definition

```ts
function serialize<envelope>(
  envelope: envelope | Typeable,
  options?: serialize.Options,
): serialize.ReturnType<envelope>
```

## Parameters

### envelope

* **Type:** `envelope | Typeable`

The transaction envelope to serialize.

### options

* **Type:** `serialize.Options`
* **Optional**

Options.

#### options.sidecars

* **Type:** `Sidecars`
* **Optional**

PeerDAS sidecars to append, producing the 5-element network wrapper.

#### options.signature

* **Type:** `{ r: 0x${string}; s: 0x${string}; yParity: number; }`
* **Optional**

Signature to append to the serialized Transaction Envelope.

## Return Type

Serialized transaction envelope.

`serialize.ReturnType<envelope>`
