> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Pre-Generated Wallets

> Speed up wallet creation by claiming a share from a pre-computed pool instead of running the interactive MPC protocol in real time.

## Overview

Wallet creation normally runs the MPC key generation (DKG) protocol interactively between the device and the MPC servers at the moment `createWallet` is called. Pre-generated wallets let the SDK instead claim a share that was already computed ahead of time from a standing pool, which can make wallet creation noticeably faster.

This is entirely opt-in and transparent to your integration: you don't call any new APIs, and the shape of `createWallet` doesn't change. You only need to enable a feature flag when initializing Portal.

## How It Works

| Step                             | Behavior                                                                                                                                                                                                                                                                     |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Flag disabled (default)**      | `createWallet` runs the standard interactive DKG protocol, exactly as it does today.                                                                                                                                                                                         |
| **Flag enabled**                 | `createWallet` first attempts to claim a pre-generated share. If that succeeds, wallet creation completes faster than the standard flow.                                                                                                                                     |
| **Pool temporarily unavailable** | If claiming a pre-generated share fails with an HTTP 5xx response from the enclave, the SDK automatically falls back to the standard interactive DKG protocol. The fallback is transparent—`createWallet` resolves or rejects exactly as it would through the standard flow. |
| **Any other failure**            | Errors that aren't a 5xx (for example, a malformed request, an invalid API key, or a network failure) are returned as-is, since retrying with the standard flow wouldn't resolve them.                                                                                       |

## Key Details

| Property           | Details                                                                                                                                                       |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Default**        | Disabled                                                                                                                                                      |
| **Fallback scope** | Automatic fallback to standard generation only occurs on an HTTP 5xx response from the enclave. Other errors, including network failures, propagate normally. |
| **API surface**    | No change—continue calling `createWallet` exactly as before.                                                                                                  |
| **Wallet result**  | Identical to a wallet created through the standard flow; there's no difference in how the resulting wallet is used, backed up, or recovered.                  |

## Best Practices

* **Treat it as a pure performance optimization.** Enable the flag to reduce wallet creation latency; no other integration changes are needed.
* **Keep your existing error handling around `createWallet`.** The SDK already falls back automatically where it can—your existing error handling for `createWallet` continues to cover the cases that aren't recoverable.

## SDK behavior

Enable pre-generated wallets with the **`usePreGeneratedWallet`** feature flag. With the flag enabled, the SDK attempts to claim a pre-generated share on `createWallet` and falls back to the standard MPC generation flow automatically if that attempt fails with an HTTP 5xx response from the enclave.

## Next Steps

Ready to use pre-generated wallets? Choose your platform:

* **Flutter** — Enable the [`usePreGeneratedWallet`](/sdks/flutter/guide/feature-flags#usepregeneratedwallet) feature flag when initializing Portal
* **React Native** — Enable the [`usePreGeneratedWallet`](/sdks/react-native/guide/feature-flags#usepregeneratedwallet) feature flag when initializing Portal
* **Web** — Enable the [`usePreGeneratedWallet`](/sdks/web/guide/feature-flags) feature flag when initializing Portal
