# Utilities

The following functions do not belong to the `ZkBobClient` object and should be imported before using:

## <mark style="background-color:green;">Deriving Spending Key from the Mnemonic</mark>

```typescript
function deriveSpendingKeyZkBob(mnemonic: string): Uint8Array
```

### Parameters

`mnemonic` - 12-words [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) valid mnemonic phrase (English dictionary)

### Returns

The spending key bytes array (32 bytes)

### Example

```typescript
const mnemonic = 'magic trophy foil direct marriage glad bench wash doctor risk end cheap';
const sk = deriveSpendingKeyZkBob(mnemonic);
const hexSk = [...sk].map(x => x.toString(16).padStart(2, '0')).join('')
console.log(`Your top secret key: 0x${hexSk}`);
// output:
// Your top secret key: 0xc792b86b61d8fe174c0a1fd44a23aa8db64d18f4d94f9e35b049b4c9af4b8401
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zkbob.com/implementation/client-library-sdk/utilities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
