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

# TxEnvelopeLegacy.hash

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

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

## Imports

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

## Examples

```ts twoslash
// @noErrors
import { Secp256k1, TxEnvelopeLegacy } from 'viem/utils'

const envelope = TxEnvelopeLegacy.from({
  chainId: 1,
  nonce: 0n,
  gasPrice: 1000000000n,
  gas: 21000n,
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: 1000000000000000000n
})

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

const envelope_signed = TxEnvelopeLegacy.from(envelope, {
  signature
})

const hash = TxEnvelopeLegacy.hash(envelope_signed) // [!code focus]
```

## Definition

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

## Parameters

### envelope

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

The Legacy Transaction Envelope to hash.

#### envelope.gasPrice

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

Base fee per gas.

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