# Create chain wallet

> Enable EVM or Solana later and let users create the missing chain account with createChainWallet

Use the dashboard **Networks** setting to control which chain accounts are created at signup, then call `createChainWallet` so existing users can opt in when you enable another chain later.

## Dashboard: Networks

1. Open your app in the [Abstraxn Dashboard](https://dashboard.abstraxn.com/).
2. Go to **Wallets** → select your wallet service → **Networks**.
3. Choose **EVM only**, **Solana only**, or **Both**.

Rules:

- **New apps** default to **EVM only**.
- Changing the setting affects **new** signups and **new** server wallets only.
- Existing users keep their current addresses. Turning a chain on does **not** auto-create missing accounts; turning a chain off does **not** delete keys.
- The SDK modal hides chains your app setting disables (you can still force Solana in demos with `chains.enableSolana: true`).

## Enable Solana later (example)

1. In the dashboard, change Networks from **EVM only** to **Both** (or **Solana only** if that matches your product).
2. In your app, show a control when the user is missing a Solana address and the app allows Solana:

```tsx
import { useAbstraxnWallet, useWhoami } from "@abstraxn/signer-react";

export function EnableSolanaButton() {
  const { createChainWallet, walletChains, isConnected } = useAbstraxnWallet();
  const { whoami, refreshWhoami } = useWhoami();

  const solanaAllowed =
    walletChains === "solana" || walletChains === "both";
  const needsSolana =
    isConnected &&
    solanaAllowed &&
    !whoami?.solanaAddress &&
    !!createChainWallet;

  if (!needsSolana) return null;

  const handleEnable = async () => {
    try {
      const result = await createChainWallet("solana");
      console.log("Solana address:", result.address, result.alreadyExists);
      await refreshWhoami();
    } catch (error) {
      console.error("createChainWallet failed:", error);
    }
  };

  return (
    <button onClick={() => void handleEnable()}>Enable Solana wallet</button>
  );
}
```

The same pattern works for EVM with `createChainWallet("evm")` when `walletChains` is `evm` or `both` and `whoami.address` is missing.

## Core SDK

```ts
import { AbstraxnWallet } from "@abstraxn/signer-core";

const wallet = new AbstraxnWallet({ apiKey: "your-api-key" });
await wallet.connect();

const { address, alreadyExists } = await wallet.createChainWallet("solana");
```

## What happens

1. Client calls `POST /wallet/create-chain-account/prepare` with `{ blockchain: "evm" | "solana" }`.
2. If the account already exists, the API returns that address (idempotent).
3. Otherwise the client stamps a Turnkey create-wallet-accounts activity and submits `POST /wallet/create-chain-account/submit-stamped`.
4. Backend inserts the `org_wallets` row for that chain.

If the app `walletChains` setting does not allow the requested chain, the API rejects the request.

## See also

- [Solana](./solana) — signing and balances after the account exists
- [Hooks](./hooks) — `useAbstraxnWallet().createChainWallet`
- [Dashboard customization](./dashboard-customization) — other wallet settings
