> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nullark.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepare a deposit with the SDK

Prepare a recoverable Nullark deposit and hand its unsigned request to your wallet layer.

## Prepare a deposit

Generate the recovery key in the trusted client, then pass it to the SDK.

```ts
import type { Nullark } from "@nullark/sdk";

export function createRecoveryKey(nullark: Nullark): Uint8Array {
  return nullark.recovery.createKey();
}

export async function prepareDeposit(nullark: Nullark, recoveryKey: Uint8Array) {
  if (!(recoveryKey instanceof Uint8Array) || recoveryKey.length !== 32) {
    throw new Error("Recovery key must contain exactly 32 bytes.");
  }

  return nullark.deposits.prepare({
    templateId: "one-as-two-halves",
    recoveryKey
  });
}
```

`deposits.prepare` creates the private bundle, recovery envelope, proof, and unsigned transaction. Nothing has been sent yet.

| Input | Type | Use |
| --- | --- | --- |
| `templateId` | `string` | One template ID from the pinned runtime |
| `recoveryKey` | `Uint8Array` | Exactly 32 bytes kept by the trusted client |

The result includes `transaction`, `recovery.bundle`, `recovery.envelope`, and redacted `publicEvidence` for safe status reporting.

## Save recovery data first

Write the recovery key and envelope to durable user-controlled storage before opening the wallet. The [recovery page](/developers/sdk/recovery.md) uses the starter's tested backup format.

## Submit once

Review and simulate `deposit.transaction`, then submit it through the selected wallet. Keep the original transaction hash until the commitment is confirmed.

| Check | Expected value |
| --- | --- |
| `transaction.chainId` | The active SDK runtime |
| `transaction.to` | The runtime pool |
| `transaction.value` | The selected deposit amount |
| `transaction.data` | SDK-generated deposit calldata |

If submission becomes uncertain, keep the recovery backup and [reconcile the original transaction](/developers/sdk/errors.md).
