> For the complete documentation index, see [llms.txt](https://docs.zkbob.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zkbob.com/implementation/client-library-sdk/utilities.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
