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

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

Converts an arbitrary transaction object into an EIP-4844 Transaction Envelope.

## Imports

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

## Examples

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

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

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

### Attaching Signatures

It is possible to attach a `signature` to the 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 envelope_signed = TxEnvelopeEip4844.from(envelope, {
  // [!code focus]
  signature // [!code focus]
}) // [!code focus]
// @log: {
// @log:   blobVersionedHashes: [...],
// @log:   chainId: 1,
// @log:   maxFeePerBlobGas: 3000000000n,
// @log:   maxFeePerGas: 10000000000n,
// @log:   maxPriorityFeePerGas: 1000000000n,
// @log:   to: '0x0000000000000000000000000000000000000000',
// @log:   type: 'eip4844',
// @log:   value: 1000000000000000000n,
// @log:   r: 125...n,
// @log:   s: 642...n,
// @log:   yParity: 0,
// @log: }
```

### From Serialized

It is possible to instantiate an EIP-4844 Transaction Envelope from a [`TxEnvelopeEip4844.Serialized`](/docs/utilities/txenvelopeeip4844/types#serialized) value.

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

const envelope = TxEnvelopeEip4844.from(
  '0x03f858018203118502540be4008504a817c800809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c08477359400e1a001627c687261b0e7f8638af1112efa8a77e23656f6e7945275b19e9deed80261'
)
// @log: {
// @log:   blobVersionedHashes: [...],
// @log:   chainId: 1,
// @log:   maxFeePerGas: 10000000000n,
// @log:   to: '0x0000000000000000000000000000000000000000',
// @log:   type: 'eip4844',
// @log:   value: 1000000000000000000n,
// @log: }
```

## Definition

```ts
function from<envelope, signature>(
  envelope: envelope | UnionPartialBy<TxEnvelopeEip4844, 'type'> | Serialized,
  options?: from.Options<signature>,
): from.ReturnType<envelope, signature>
```

## Parameters

### envelope

* **Type:** `envelope | UnionPartialBy<TxEnvelopeEip4844, 'type'> | Serialized`

The transaction object to convert.

### options

* **Type:** `from.Options<signature>`
* **Optional**

Options.

#### options.signature

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

## Return Type

An EIP-4844 Transaction Envelope.

`from.ReturnType<envelope, signature>`
