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

# Python SDK Quickstart

> Create server-side MPC wallets and sign transactions on EVM and Solana with the Dynamic Python SDK.

> [tab] Agent-friendly
>
> > [!TIP]
> >
> > Add the Dynamic docs MCP to your AI editor first — your agent can then query the docs directly. Instructions are on the [Welcome page](https://docs.dynamic.xyz/docs/overview/introduction/welcome.md).
>
> Copy this prompt into your LLM (e.g. Claude, ChatGPT, Cursor) to implement Dynamic in your Python backend.
>
> ````markdown theme={"system"}
> # Python SDK Quickstart
>
> ## Purpose and Usage
>
> This document provides structured quickstart information for the Dynamic Python SDK. It is designed to be consumed by LLMs to generate accurate installation commands and code examples based on user requirements.
>
> > **Important scope note:** The Dynamic Python SDK is for **server-side wallet operations only** — creating MPC wallets, signing messages, signing transactions, and key export/recovery. It does NOT handle frontend authentication or UI. If the user needs client-side auth, direct them to the React, JavaScript, or mobile SDK docs.
>
> ---
>
> ## How to use this document
>
> Start by asking the user which path they want:
>
> > "Would you like a **Quick start** (EVM + TWO_OF_TWO threshold scheme, zero configuration — recommended if you're just getting started) or a **Custom setup** (choose your chains and threshold scheme)?"
>
> - If the user chooses **Quick start**: follow the Quick Start Path section exactly. Do not ask any configuration questions — execute the happy path as written.
> - If the user chooses **Custom setup**: follow the Custom Setup Path section and ask all configuration questions before proceeding.
>
> ---
>
> ## Quick Start Path
>
> > Use this path when the user chooses Quick start. Execute every step in order. Do not skip steps. Do not ask configuration questions.
>
> **Stack:** Python + EVM only + TWO_OF_TWO threshold scheme
>
> ### Step 1 — Prerequisites
>
> Tell the user:
> - Python 3.11+ is required
> - A Dynamic environment ID and API token are required — get them at https://console.dynamic.xyz/dashboard/developer/api
>
> Ask the user for their environment ID and API token before proceeding.
>
> ### Step 2 — Install
>
> ```bash
> pip install dynamic-wallet-sdk
> ```
>
> Pre-built wheels are provided for Linux (x86_64, ARM64) and macOS (x86_64, Apple Silicon). No Rust toolchain required.
>
> ### Step 3 — Set up environment variables
>
> Create a `.env` file or export directly:
>
> ```bash
> export DYNAMIC_ENV_ID=your_environment_id_here
> export DYNAMIC_API_TOKEN=your_api_token_here
> export WALLET_PASSWORD=your_secure_wallet_password_here
> ```
>
> > These names are a convention — the SDK does not auto-read environment variables. You pass values directly to the client constructor and `authenticate_api_token`.
>
> ### Step 4 — Initialize the client
>
> ```python
> import asyncio
> import os
> from dynamic_wallet_sdk import DynamicEvmWalletClient
>
> async def main():
>     async with DynamicEvmWalletClient(os.environ["DYNAMIC_ENV_ID"]) as client:
>         await client.authenticate_api_token(os.environ["DYNAMIC_API_TOKEN"])
>         # client is now ready for wallet operations
>
> asyncio.run(main())
> ```
>
> > The SDK is fully async. Use `async with` for proper resource cleanup.
>
> ### Step 5 — Create a wallet
>
> ```python
> from dynamic_wallet_sdk import DynamicEvmWalletClient, ThresholdSignatureScheme
>
> async def main():
>     async with DynamicEvmWalletClient(os.environ["DYNAMIC_ENV_ID"]) as client:
>         await client.authenticate_api_token(os.environ["DYNAMIC_API_TOKEN"])
>
>         wallet = await client.create_wallet_account(
>             threshold_signature_scheme=ThresholdSignatureScheme.TWO_OF_TWO,
>             password=os.environ["WALLET_PASSWORD"],
>         )
>         print(f"Wallet created: {wallet.account_address}")
>
> asyncio.run(main())
> ```
>
> > The `password` encrypts your key shares and backs them up to Dynamic. Keep this password — you need it to sign and recover shares.
>
> ### Step 6 — Sign a message
>
> ```python
> signature = await client.sign_message(
>     message="Hello from Dynamic!",
>     address=wallet.account_address,
>     password=os.environ["WALLET_PASSWORD"],
> )
> print(f"Signature: {signature}")
> ```
>
> ### Step 7 — Run the app
>
> ```bash
> python main.py
> ```
>
> ---
>
> ## Custom Setup Path
>
> > Use this path when the user chooses Custom setup. Ask ALL questions below before generating any code.
>
> **Questions to ask the user:**
> 1. Which chains? (EVM only / Solana only / Both EVM and Solana)
> 2. Which threshold signature scheme? (TWO_OF_TWO recommended, or TWO_OF_THREE for higher availability)
> 3. Do you need key export or recovery capabilities?
>
> ### Chain-specific clients
>
> **EVM:**
> ```python
> from dynamic_wallet_sdk import DynamicEvmWalletClient
> async with DynamicEvmWalletClient(env_id) as client:
>     ...
> ```
>
> **Solana (SVM):**
> ```python
> from dynamic_wallet_sdk import DynamicSvmWalletClient
> async with DynamicSvmWalletClient(env_id) as client:
>     ...
> ```
>
> ### Threshold signature schemes
>
> - **TWO_OF_TWO** (default, recommended) — requires your server and Dynamic's infrastructure to sign together. Most thoroughly tested.
> - **TWO_OF_THREE** — requires two of three shares. Tolerates one party being offline.
>
> ### EVM transaction signing
>
> ```python
> signature = await client.sign_transaction(
>     address=wallet.account_address,
>     tx={
>         "to": "0xRecipientAddress",
>         "value": 0,
>         "nonce": 0,
>         "gas": 21000,
>         "gasPrice": 20_000_000_000,
>         "chainId": 1,
>         "data": "0x",
>     },
>     password=os.environ["WALLET_PASSWORD"],
> )
> ```
>
> ### SVM wallet creation and signing
>
> ```python
> from dynamic_wallet_sdk import DynamicSvmWalletClient, ThresholdSignatureScheme
>
> 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(
>         threshold_signature_scheme=ThresholdSignatureScheme.TWO_OF_TWO,
>         password=os.environ["WALLET_PASSWORD"],
>     )
>
>     signature = await client.sign_message(
>         message="Hello from Dynamic!",
>         address=wallet.account_address,
>         password=os.environ["WALLET_PASSWORD"],
>     )
> ```
>
> ---
>
> ## Critical Reference
>
> | Correct | Incorrect | Notes |
> |---|---|---|
> | `async with DynamicEvmWalletClient(env_id) as client` | `client = DynamicEvmWalletClient(env_id)` without context manager | Leaks resources without `async with` |
> | `password=os.environ["WALLET_PASSWORD"]` | `password="hardcoded-value"` | Never hardcode passwords |
> | `ThresholdSignatureScheme.TWO_OF_TWO` | `"TWO_OF_TWO"` as a string | Use the enum from the SDK |
> | Import from `dynamic_wallet_sdk` | Import from `dynamic_labs` or similar | Only `dynamic_wallet_sdk` is the correct package |
>
> ---
>
> ## Troubleshooting — Console Configuration
>
> If the SDK initializes but wallet creation fails, verify:
>
> ### 1 — Embedded wallets not enabled
> Go to **Wallets** in the Dynamic Console and enable embedded wallets.
>
> ### 2 — Chains not enabled
> Go to **Chains & Networks** and enable Ethereum or Solana depending on which client you're using.
>
> ### 3 — API token permissions
> Go to **Developer → API Tokens** and confirm the token has wallet operation scopes. See https://www.dynamic.xyz/docs/platform/console/api-token-permissions.
>
> ### 4 — Platform not supported
> The SDK ships pre-built wheels for Linux (x86_64, ARM64) and macOS (x86_64, Apple Silicon). Windows is not yet supported — use WSL2.
>
> If the issue persists, check https://docs.dynamic.xyz/overview/troubleshooting/general.
>
> ---
>
> ## Beyond This Quickstart
>
> This prompt covers initial setup only. For deeper guides (EVM transactions, Solana operations, key export, delegated access, etc.), fetch the full documentation index:
>
> **https://www.dynamic.xyz/docs/llms.txt**
>
> This file contains every page in the Dynamic documentation organized by SDK. Search for the "Python SDK" section to discover all available pages and their URLs. Use it as your navigation source for any question beyond what this quickstart covers.
>
> Alternatively, if the Dynamic MCP server is available in your environment, query it directly for any documentation page.
> ````

> [tab] Step-by-step
>
> ## Prerequisites
>
> * **Python 3.11+**
> * **Dynamic Account**: Set up your project and get credentials from the [Dynamic Console](https://console.dynamic.xyz/dashboard/overview)
>
> The Python SDK runs on your server so you can create [MPC-backed](https://docs.dynamic.xyz/docs/embedded-wallets/mpc/overview.md) **embedded wallets**, sign transactions, and work with EVM and Solana chains without putting full keys anywhere. Signing uses Multi-Party Computation (MPC): your server and Dynamic each hold part of the key material so neither side alone can sign.
>
> ## Install the SDK
>
> ```bash theme={"system"}
> pip install dynamic-wallet-sdk
> ```
>
> Pre-built wheels are provided for Linux (`x86_64`, `aarch64`) and macOS (`x86_64`, Apple Silicon). No Rust toolchain required.
>
> ## Get Your Credentials
>
> Navigate to the [Dynamic Console](https://console.dynamic.xyz/dashboard/developer/api) and:
>
> 1. Copy your `Environment ID`
> 2. Create a new API token
>
> ![Environment ID and API Token](https://mintlify.s3.us-west-1.amazonaws.com/dynamic-docs/images/dashboard/console-env-id-api-token.png)
>
> ## Enable Features in Console
>
> Before you can use wallet features, you need to enable them in your Dynamic Console:
>
> 1. Go to your [Dynamic Console](https://console.dynamic.xyz/dashboard/overview)
> 2. Select your project
> 3. Go to **Wallets** and enable embedded wallets
> 4. Go to **Chains** and enable the networks you want to support (Ethereum, Solana, etc.)
>
> ## Environment Variables
>
> ```bash theme={"system"}
> # .env
> DYNAMIC_ENV_ID=your_environment_id_here
> DYNAMIC_API_TOKEN=your_api_token_here
> ```
>
> These names are a convention. The SDK does not auto-read any environment variables. You pass the values directly to the client constructor and `authenticate_api_token`.
>
> ## Hello, Wallet
>
> ```python theme={"system"}
> import asyncio
> import os
> from dynamic_wallet_sdk import DynamicEvmWalletClient
>
> async def main():
>     async with DynamicEvmWalletClient(os.environ["DYNAMIC_ENV_ID"]) as client:
>         await client.authenticate_api_token(os.environ["DYNAMIC_API_TOKEN"])
>         # ... wallet ops here
>
> asyncio.run(main())
> ```
>
> ## SDK Capabilities
>
> * **Embedded wallets**: Create and use MPC wallets from your server
> * **Chains**: Ethereum (EVM) and Solana (SVM)
> * **Async/await**: Fully async Python API with `asyncio`
> * **Key backup**: Password-encrypted key share backup and recovery
>
> ## Threshold Signature Schemes
>
> When you configure signing, you choose how key shares combine to authorize a signature:
>
> * **TWO\_OF\_TWO**: Default. Requires your server and Dynamic's infrastructure to sign together. Most thoroughly tested.
> * **TWO\_OF\_THREE**: Advanced. Requires two of three shares to sign. Tolerates one party being offline.
>
> ## Next Steps
>
> ### Ethereum (EVM)
>
> * [Create EVM Wallets](https://docs.dynamic.xyz/docs/python/evm/create-wallet.md)
> * [Sign EVM Messages](https://docs.dynamic.xyz/docs/python/evm/sign-messages.md)
> * [Sign EVM Transactions](https://docs.dynamic.xyz/docs/python/evm/sign-transactions.md)
> * [Sign Typed Data (EIP-712)](https://docs.dynamic.xyz/docs/python/evm/sign-typed-data.md)
> * [Delegated Access](https://docs.dynamic.xyz/docs/python/evm/delegated-access.md)
>
> ### Solana (SVM)
>
> * [Create SVM Wallets](https://docs.dynamic.xyz/docs/python/svm/create-wallet.md)
> * [Sign SVM Messages](https://docs.dynamic.xyz/docs/python/svm/sign-messages.md)
> * [Sign SVM Transactions](https://docs.dynamic.xyz/docs/python/svm/sign-transactions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.