# TransactionEnvelope.serialize

Serializes a [`TransactionEnvelope.TxEnvelope`](/api/TransactionEnvelope/types#txenvelope).

## Imports

:::code-group
```ts [Named]
import { TransactionEnvelope } from 'ox'
```

```ts [Entrypoint]
import * as TransactionEnvelope from 'ox/TransactionEnvelope'
```
:::

## Examples

```ts twoslash
import { TransactionEnvelope } from 'ox'

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

## Definition

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

**Source:** [src/core/TxEnvelope.ts](https://github.com/wevm/ox/blob/main/src/core/TxEnvelope.ts#L952)

## 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>`
