# sign

Signs data using the Chain Signatures contract.

## Usage

```ts twoslash
// [!include ~/snippets/code/contract.ts]
// ---cut---
const signature = await evmChainSigContract.sign({
  path: 'my_derivation_path',
  payload: Array.from(new Uint8Array(32).fill(1)), // 32-byte array
  key_version: 1,
})
```

## Parameters

| Parameter                                   | Type          | Description                                                  |
| ------------------------------------------- | ------------- | ------------------------------------------------------------ |
| `args`                                      | `SignArgs`    | Arguments for signing data                                   |
| `args.path`                                 | `string`      | The derivation path to use                                   |
| `args.payload`                              | `number[]`    | The data to sign as an array of 32 bytes                     |
| `args.key_version`                          | `number`      | Version of the key to use                                    |
| `options?`                                  | `SignOptions` | Optional configuration for signing                           |
| `options.sign.algo?`                        | `string`      | Optional algorithm to use for signing                        |
| `options.sign.dest?`                        | `string`      | Optional destination for the signature                       |
| `options.sign.params?`                      | `string`      | Optional parameters for the signing process                  |
| `options.retry.delay?`                      | `number`      | Delay between retries in milliseconds (default: 5000)        |
| `options.retry.retryCount?`                 | `number`      | Number of retries to attempt (default: 12)                   |
| `options.transaction?`                      | `object`      | Optional transaction overrides for the signing contract call |
| `options.transaction.gas?`                  | `bigint`      | Gas limit for the signing transaction                        |
| `options.transaction.maxFeePerGas?`         | `bigint`      | Maximum fee per gas (EIP-1559)                               |
| `options.transaction.maxPriorityFeePerGas?` | `bigint`      | Maximum priority fee per gas (EIP-1559)                      |
| `options.transaction.nonce?`                | `number`      | Nonce for the signing transaction                            |

## Returns

| Type                    | Description                 |
| ----------------------- | --------------------------- |
| `Promise<RSVSignature>` | The signature in RSV format |

## Working Examples

* [E2E tests](https://github.com/sig-net/signet.js/blob/main/tests/e2e/evm/EVM.e2e.test.ts) — real MPC signing with retry options
