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

# Create SVM Wallet

> Learn how to create and manage SVM server wallets with Dynamic's Node SDK

## Overview

This guide walks you through creating Solana (SVM) wallets using Dynamic's Node SDK. You'll learn how to set up different threshold signature schemes and understand the security implications for Solana blockchain operations.

## Prerequisites

Before you begin, make sure you have:

* [Set up your Dynamic project](/node/quickstart)
* [Created an authenticated client](/node/quickstart)
* [Enabled Solana chains in your dashboard](https://app.dynamic.xyz/dashboard/chains)

## Step 1: Choose Your Security Model

Dynamic supports two threshold signature schemes for Solana wallets:

### TWO\_OF\_TWO (Recommended for most use cases)

* **Security**: Highest - requires both your server and Dynamic's infrastructure
* **Availability**: Lower - both parties must be online
* **Use case**: High-value transactions, maximum security

### TWO\_OF\_THREE

* **Security**: High - requires 2 out of 3 shares
* **Availability**: Medium - can tolerate one party being offline
* **Use case**: Balanced security and availability

## Step 2: Create Your First Solana Wallet

Here's a complete example of creating a Solana wallet:

```typescript theme={"system"}
import { DynamicSvmWalletClient } from '@dynamic-labs-wallet/node-svm';
import { ThresholdSignatureScheme } from '@dynamic-labs-wallet/node';

// Create authenticated client
export const authenticatedSvmClient = async () => {
  const client = new DynamicSvmWalletClient({
    environmentId: process.env.DYNAMIC_ENVIRONMENT_ID!,
  });

  await client.authenticateApiToken(process.env.DYNAMIC_AUTH_TOKEN!);
  return client;
};

export const createSvmWallet = async ({
  thresholdSignatureScheme = ThresholdSignatureScheme.TWO_OF_TWO,
  password,
  onError
}: {
  thresholdSignatureScheme?: ThresholdSignatureScheme;
  password?: string;
  onError?: (error: Error) => void;
}) => {
  const svmClient = await authenticatedSvmClient();

  const { walletMetadata, externalServerKeyShares, rawPublicKey } =
    await svmClient.createWalletAccount({
      thresholdSignatureScheme,
      password,
      onError,
      backUpToDynamic: true,
    });

  return { walletMetadata, externalServerKeyShares, rawPublicKey };
};

// Usage example
const { walletMetadata, externalServerKeyShares } = await createSvmWallet({
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  password: 'your-secure-password',
  onError: (error: Error) => {
    console.error('SVM wallet creation error:', error);
  },
});

console.log('Solana wallet created:', walletMetadata.accountAddress);
```

## Step 3: Handle Errors Gracefully

Always implement proper error handling for Solana wallet creation:

```typescript theme={"system"}
try {
  const { walletMetadata } = await createSvmWallet({
    thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
    password: 'your-secure-password',
    onError: (error: Error) => {
      console.error('Wallet creation error:', error);
    },
  });
  console.log('Solana wallet created successfully:', walletMetadata.accountAddress);
} catch (error) {
  if (error.message.includes('insufficient funds')) {
    console.error('Insufficient funds for wallet creation');
  } else if (error.message.includes('invalid session')) {
    console.error('Invalid session ID - please re-authenticate');
  } else {
    console.error('Solana wallet creation failed:', error.message);
  }
}
```

## Step 4: Store Wallet Information Securely

After creating a Solana wallet, you'll receive important information that should be stored securely:

```typescript theme={"system"}
const { walletMetadata, externalServerKeyShares } = await svmClient.createWalletAccount({
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  password: 'your-secure-password',
  backUpToDynamic: true,
});

// Persist walletMetadata in your cache; externalServerKeyShares in your secrets vault.
await redis.set(`wallet:${walletMetadata.accountAddress}`, JSON.stringify(walletMetadata));
await vault.write(`wallet:${walletMetadata.accountAddress}/shares`, externalServerKeyShares);

// Never store externalServerKeyShares in plain text
// They should be encrypted and stored securely
```

## Step 5: Verify Your Solana Wallet

You can verify your wallet was created correctly by checking the Solana network:

```typescript theme={"system"}
import { Connection, PublicKey } from '@solana/web3.js';

const connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');
const publicKey = new PublicKey(walletMetadata.accountAddress);

// Check if the account exists
const accountInfo = await connection.getAccountInfo(publicKey);
if (accountInfo) {
  console.log('Solana wallet verified on network');
} else {
  console.log('Wallet created but not yet on network (normal for new wallets)');
}
```

## Best Practices

1. **Password Security**: Use strong, unique passwords for each Solana wallet
2. **Error Handling**: Always handle potential errors during wallet creation with the `onError` callback
3. **Monitoring**: Log wallet creation events for audit purposes
4. **Backup Strategy**: Implement secure backup strategies for key shares with `backUpToDynamic: true`
5. **Network Selection**: Choose the appropriate Solana network (mainnet, devnet, testnet)

## Solana-Specific Considerations

### Network Selection

* **Mainnet**: For production applications
* **Devnet**: For development and testing
* **Testnet**: For testing with test tokens

### Account Types

* **System Accounts**: Standard Solana accounts for SOL storage
* **Token Accounts**: For SPL token storage (created separately)

### Rent Exemption

Solana accounts require rent exemption (minimum balance). Dynamic handles this automatically during wallet creation.

## Next Steps

Now that you've created a Solana wallet, you can:

* [Sign Solana transactions](/node/svm/sign-transactions)
* [Sign Solana messages](/node/svm/sign-messages)
* [Import existing Solana private keys](/node/svm/import-private-keys)
* [Use imported Solana wallets](/node/svm/use-imported-wallets)
