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

# TxEnvelope.hash

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

Hashes a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope). This is the "transaction hash".

## Imports

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

## Examples

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

const hash = TxEnvelope.hash(
  {
    chainId: 1,
    maxFeePerGas: 1n,
    type: 'eip1559'
  },
  { presign: true }
)
```

## Definition

```ts
function hash<presign>(
  envelope: TxEnvelope<presign extends true ? false : true>,
  options?: hash.Options<presign>,
): hash.ReturnType
```

## Parameters

### envelope

* **Type:** `TxEnvelope<presign extends true ? false : true>`

The transaction envelope to hash.

#### envelope.accessList

* **Type:** `readonly { address: abitype_Address; storageKeys: readonly 0x${string}[]; }[]`
* **Optional**

EIP-2930 Access List.

#### envelope.authorizationList

* **Type:** `readonly { address: abitype_Address; chainId: numberType; nonce: bigintType; r: 0x${string}; s: 0x${string}; yParity: numberType; }[]`

EIP-7702 Authorization List.

#### envelope.blobVersionedHashes

* **Type:** `readonly 0x${string}[]`
* **Optional**

Versioned blob hashes.

#### envelope.chainId

* **Type:** `number | bigint`

Chain ID. Use bigint for IDs beyond the safe integer range.

#### envelope.data

* **Type:** `0x${string}`
* **Optional**

Contract code or a hashed method call with encoded args

#### envelope.frames

* **Type:** `readonly Frame[]`

Frames to execute, in order.

#### envelope.from

* **Type:** `Address.Address | undefined`
* **Optional**

Sender of the transaction. RPC-only metadata; not part of the
serialized envelope. Carried here for parity with
[`TransactionRequest.TransactionRequest`](/docs/utilities/transactionrequest/types#transactionrequest) and
[`Transaction.Transaction`](/docs/utilities/transaction/types#transaction).

#### envelope.gas

* **Type:** `bigintType`
* **Optional**

Gas provided for transaction execution

#### envelope.gasPrice

* **Type:** `bigintType`
* **Optional**

Base fee per gas.

#### envelope.input

* **Type:** `0x${string}`
* **Optional**

#### envelope.maxFeePerBlobGas

* **Type:** `bigint`
* **Optional**

Maximum fee per blob gas, in wei.

#### envelope.maxFeePerGas

* **Type:** `bigint`
* **Optional**

Maximum fee per gas, in wei.

#### envelope.maxPriorityFeePerGas

* **Type:** `bigint`
* **Optional**

Maximum priority fee per gas, in wei.

#### envelope.nonce

* **Type:** `bigint`
* **Optional**

Sender nonce or shared sequence. With `nonceKeys`, the sequence must be less than 2^64 - 1.

#### envelope.nonceKeys

* **Type:** `readonly bigint[]`
* **Optional**

EIP-8250 domains: 1–16 strictly increasing uint256 keys. `[0n]` selects the legacy account nonce; zero cannot accompany other keys.

#### envelope.r

* **Type:** `0x${string}`

#### envelope.s

* **Type:** `0x${string}`

#### envelope.sender

* **Type:** `abitype_Address`

Account authorizing execution.

#### envelope.sidecars

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

PeerDAS sidecars. Excluded from transaction and signing hashes.

#### envelope.signatures

* **Type:** `readonly FrameSignature[]`
* **Optional**

Signature entries, including unsigned placeholders before signing.

#### envelope.to

* **Type:** `Address.Address | null | undefined`
* **Optional**

Transaction recipient

#### envelope.type

* **Type:** `"eip8141"`

Transaction type.

#### envelope.v

* **Type:** `numberType`
* **Optional**

#### envelope.value

* **Type:** `bigintType`
* **Optional**

Value in wei sent with this transaction

#### envelope.yParity

* **Type:** `numberType`
* **Optional**

ECDSA signature yParity.

### options

* **Type:** `hash.Options<presign>`
* **Optional**

Options.

#### options.presign

* **Type:** `boolean | presign`
* **Optional**

Whether to hash this transaction for signing.

## Return Type

The hash of the transaction envelope.

`hash.ReturnType`
