# TxEnvelopeLegacy.toRpc

Converts an [`TxEnvelopeLegacy.TxEnvelopeLegacy`](/api/TxEnvelopeLegacy/types#txenvelopelegacy) to an [`TxEnvelopeLegacy.Rpc`](/api/TxEnvelopeLegacy/types#rpc).

## Imports

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

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

## Examples

```ts twoslash
import { RpcRequest, TxEnvelopeLegacy, Value } from 'ox'

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

const envelope_rpc = TxEnvelopeLegacy.toRpc(envelope) // [!code focus]

const request = RpcRequest.from({
  id: 0,
  method: 'eth_sendTransaction',
  params: [envelope_rpc]
})
```

## Definition

```ts
function toRpc(
  envelope: toRpc.Input,
): Rpc
```

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

## Parameters

### envelope

* **Type:** `toRpc.Input`

The legacy transaction envelope to convert.

#### envelope.gasPrice

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

Base fee per gas.

## Return Type

An RPC-formatted legacy transaction envelope.

`Rpc`
