Skip to main content

Overview

This guide walks you through creating Solana (SVM) wallets using Dynamic’s Python SDK. Solana wallets use Ed25519 key pairs and return base58-encoded addresses.

Prerequisites

Step 1: Choose Your Security Model

Dynamic supports two threshold signature schemes for Solana wallets:
  • Security: Highest — requires both your server and Dynamic’s infrastructure
  • Availability: Lower — both parties must be online to sign
  • Use case: High-value transactions, maximum security

TWO_OF_THREE (Advanced)

  • Security: High — requires 2 of 3 shares
  • Availability: Medium — tolerates one party being offline
  • Use case: Balanced security and availability

Step 2: Create Your First Solana Wallet

import asyncio
import os
from dynamic_wallet_sdk import DynamicSvmWalletClient, ThresholdSignatureScheme

async def main():
    async with DynamicSvmWalletClient(os.environ["DYNAMIC_ENV_ID"]) as client:
        await client.authenticate_api_token(os.environ["DYNAMIC_API_TOKEN"])

        wallet = await client.create_wallet_account(
            password="your-secure-password",
        )
        print(f"Address: {wallet.account_address}")
        print(f"Wallet ID: {wallet.wallet_id}")

asyncio.run(main())
create_wallet_account returns a WalletProperties dataclass — account_address is the base58-encoded Ed25519 public key (the standard Solana address format), and wallet_id is the Dynamic identifier you’ll need for delegated signing. To opt into the advanced threshold scheme, pass threshold_signature_scheme:
wallet = await client.create_wallet_account(
    threshold_signature_scheme=ThresholdSignatureScheme.TWO_OF_THREE,
    password="your-secure-password",
)

Step 3: Store Wallet Information

Persist what you need to operate on the wallet later:
wallet = await client.create_wallet_account(password="your-secure-password")

wallet_data = {
    "address": wallet.account_address,
    "wallet_id": wallet.wallet_id,
}
In a fresh process, rehydrate the wallet with load_wallet and pass password= on subsequent sign calls so the SDK can auto-recover the local key share:
wallet = await client.load_wallet(address)
signature = await client.sign_message(
    message="Hello",
    address=wallet.account_address,
    password="your-secure-password",
)

Step 4: Handle Errors

from dynamic_wallet_sdk import (
    DynamicSDKError,
    AuthenticationError,
    WalletNotFoundError,
)

try:
    wallet = await client.create_wallet_account(password="your-secure-password")
    print(f"Solana wallet created: {wallet.account_address}")
except AuthenticationError:
    print("Authentication failed — check your API token")
except WalletNotFoundError:
    print("Wallet not found")
except DynamicSDKError as e:
    print(f"Wallet creation failed: {e}")

Best Practices

  1. Password security — Use a strong, unique password per wallet. Store it encrypted in a secrets manager.
  2. Store wallet ID — Save wallet.wallet_id in your database. It’s required for delegated signing.
  3. Context manager — Use async with so the underlying HTTP client is properly closed.
  4. Rehydrate, don’t recreate — In long-lived servers or fresh processes, use load_wallet(address) plus password= instead of creating a new wallet.

Next Steps