> ## 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

<ResponseField name="transferID" type="string" required>
  The transfer ID to generate a preimage for
</ResponseField>

## Returns

<ResponseField name="preimage" type="Uint8Array" required>
  The 32-byte preimage
</ResponseField>

## Example

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