Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This guide shows you how to sign messages with your Solana wallet. The Python SDK signs messages using Ed25519 and returns a base58-encoded signature.

Prerequisites

Basic Message Signing

import asyncio
import os
from dynamic_wallet_sdk import DynamicSvmWalletClient

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

        signature = await client.sign_message(
            message="Hello from Solana!",
            address="YourBase58WalletAddress",
        )
        print(f"Signature: {signature}")  # base58-encoded, 64 bytes

asyncio.run(main())
The returned signature is a base58-encoded Ed25519 signature (64 bytes).

Signing with a Password-Protected Wallet

signature = await client.sign_message(
    message="Hello from Solana!",
    address="YourBase58WalletAddress",
    password="your-wallet-password",
)
Password handling:
  • If your wallet was created without a password, omit the password parameter.
  • If your wallet was created with a password, you must provide it for all signing operations.
Passing password= also enables auto-recovery of the local key share in fresh processes — pair it with client.load_wallet(address) after restart.

Verifying a Signature

Verify signatures off-chain using PyNaCl:
import base58
import nacl.signing
import nacl.exceptions

message = "Hello from Solana!"
signature = await client.sign_message(message=message, address=address)

pubkey_bytes = base58.b58decode(address)
sig_bytes = base58.b58decode(signature)

verify_key = nacl.signing.VerifyKey(pubkey_bytes)
try:
    verify_key.verify(message.encode("utf-8"), sig_bytes)
    print("Signature verified")
except nacl.exceptions.BadSignatureError:
    print("Invalid signature")

Common Use Cases

Authentication Nonce

import time

nonce = str(int(time.time()))
message = f"Sign to authenticate: {nonce}"

signature = await client.sign_message(message=message, address=address)

Next Steps