# Ed25519.sign

Signs the payload with the provided private key and returns an Ed25519 signature.

## Imports

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

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

## Examples

```ts twoslash
import { Ed25519 } from 'ox'

const signature = Ed25519.sign({
  // [!code focus]
  payload: '0xdeadbeef', // [!code focus]
  privateKey: '0x...' // [!code focus]
}) // [!code focus]
```

## Definition

```ts
function sign<as>(
  options: sign.Options<as>,
): sign.ReturnType<as>
```

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

## Parameters

### options

* **Type:** `sign.Options<as>`

The signing options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

Format of the returned signature.

#### options.payload

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

Payload to sign.

#### options.privateKey

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

Ed25519 private key.

## Return Type

The Ed25519 signature.

`sign.ReturnType<as>`
