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

# getHTLCPreimage

> Generate a deterministic HTLC preimage from a transfer ID.

Generates a deterministic HTLC preimage from a transfer ID using the wallet's keys.

## Method Signature

```typescript theme={null}
async getHTLCPreimage(transferID: string): Promise<Uint8Array>
```

## Parameters

**transferID** `string` *required*

The transfer ID to generate a preimage for

## Returns

**preimage** `Uint8Array` *required*

The 32-byte preimage

## Example

```typescript theme={null}
const preimage = await wallet.getHTLCPreimage("transfer-id");
console.log("Preimage:", bytesToHex(preimage));
```
