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

# createWithMasterKey

> Create an authenticated wallet viewer using a mnemonic or seed.

Creates a `SparkReadonlyClient` authenticated with an identity key derived from a mnemonic or seed. Can query private wallets the key owns.

## Method Signature

```typescript theme={null}
static async createWithMasterKey(
  config: ConfigOptions | undefined,
  mnemonicOrSeed: Uint8Array | string,
  accountNumber?: number,
): Promise<SparkReadonlyClient>
```

## Parameters

<ResponseField name="config" type="ConfigOptions | undefined" required>
  Configuration options including network selection. Pass `undefined` for defaults.
</ResponseField>

<ResponseField name="mnemonicOrSeed" type="Uint8Array | string" required>
  BIP-39 mnemonic phrase, hex-encoded seed string, or raw seed bytes.
</ResponseField>

<ResponseField name="accountNumber" type="number">
  Account index for key derivation. Defaults to `0` for REGTEST, `1` otherwise.
</ResponseField>

## Returns

<ResponseField name="client" type="Promise<SparkReadonlyClient>" required>
  An authenticated wallet viewer. Requests include an identity key signature for access to private wallet data.
</ResponseField>

## Example

<CodeGroup>
  ```typescript From Mnemonic theme={null}
  import { SparkReadonlyClient } from "@buildonspark/spark-sdk";

  const client = await SparkReadonlyClient.createWithMasterKey(
    { network: "MAINNET" },
    "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
  );

  // Can see private wallet data
  const balance = await client.getAvailableBalance("sp1...");
  ```

  ```typescript From Seed theme={null}
  import { SparkReadonlyClient } from "@buildonspark/spark-sdk";

  const client = await SparkReadonlyClient.createWithMasterKey(
    { network: "MAINNET" },
    seedBytes, // Uint8Array
    1,         // account number
  );
  ```
</CodeGroup>
