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

# signTransaction

> Sign a Bitcoin transaction with wallet keys.

Signs a Bitcoin transaction with wallet keys.

## Method Signature

```typescript theme={null}
async signTransaction(
  txHex: string,
  keyType?: string
): Promise<string>
```

## Parameters

<ResponseField name="txHex" type="string" required>
  The transaction hex to sign
</ResponseField>

<ResponseField name="keyType" type="string">
  Key type to use: `"identity"`, `"deposit"`, or `"auto-detect"` (default: `"auto-detect"`)
</ResponseField>

## Returns

<ResponseField name="signedTxHex" type="string" required>
  The signed transaction hex
</ResponseField>

## Example

```typescript theme={null}
// Auto-detect key type
const signedTx = await wallet.signTransaction("02000000...");

// Use specific key type
const signedWithIdentity = await wallet.signTransaction(
  "02000000...",
  "identity"
);
console.log("Signed transaction:", signedWithIdentity);
```
