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

# TxEnvelopeEip4844.serialize

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

Serializes a [`TxEnvelopeEip4844.TxEnvelopeEip4844`](/docs/utilities/txenvelopeeip4844/types#txenvelopeeip4844).

## Imports

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

## Examples

```ts twoslash
// @noErrors
import { Blobs, TxEnvelopeEip4844 } from 'viem/utils'
import { kzg } from './kzg'

const blobs = Blobs.from('0xdeadbeef')
const blobVersionedHashes = Blobs.toVersionedHashes(blobs, {
  kzg
})

const envelope = TxEnvelopeEip4844.from({
  blobVersionedHashes,
  chainId: 1,
  maxFeePerGas: Value.fromGwei('10'),
  to: '0x0000000000000000000000000000000000000000',
  value: Value.fromEther('1')
})

const serialized = TxEnvelopeEip4844.serialize(envelope) // [!code focus]
```

### Attaching Signatures

It is possible to attach a `signature` to the serialized Transaction Envelope.

```ts twoslash
// @noErrors
import {
  Blobs,
  Secp256k1,
  TxEnvelopeEip4844,
  Value
} from 'viem/utils'
import { kzg } from './kzg'

const blobs = Blobs.from('0xdeadbeef')
const blobVersionedHashes = Blobs.toVersionedHashes(blobs, {
  kzg
})

const envelope = TxEnvelopeEip4844.from({
  blobVersionedHashes,
  chainId: 1,
  maxFeePerBlobGas: Value.fromGwei('3'),
  maxFeePerGas: Value.fromGwei('10'),
  maxPriorityFeePerGas: Value.fromGwei('1'),
  to: '0x0000000000000000000000000000000000000000',
  value: Value.fromEther('1')
})

const signature = Secp256k1.sign({
  payload: TxEnvelopeEip4844.getSignPayload(envelope),
  privateKey: '0x...'
})

const serialized = TxEnvelopeEip4844.serialize(envelope, {
  // [!code focus]
  signature // [!code focus]
}) // [!code focus]

// ... send `serialized` transaction to JSON-RPC `eth_sendRawTransaction`
```

## Definition

```ts
function serialize(
  envelope: PartialBy<TxEnvelopeEip4844, 'type'>,
  options?: serialize.Options,
): Serialized
```

## Parameters

### envelope

* **Type:** `PartialBy<TxEnvelopeEip4844, 'type'>`

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

The serialized Transaction Envelope.

`Serialized`
