Overview
Delegated access allows your server to perform wallet operations on behalf of users with their permission. Dynamic sends delegation credentials to your webhook, and your server uses them to sign without the user being online. This guide covers the server-side implementation using the Python SDK. For conceptual background on the delegation workflow, see Delegated Access Overview.Prerequisites
- A Dynamic environment with embedded wallets (MPC) enabled
- Server API key from the Dynamic Dashboard
- Delegated access configured
How Delegation Works
- User approves delegation in your application (client-side)
- Dynamic sends delegation credentials to your webhook:
walletId— the user’s wallet IDencryptedWalletApiKey— temporary API key, encrypted with your RSA public keyencryptedDelegatedShare— the server key share, encrypted with your RSA public key
- Your server decrypts the credentials and stores them securely
- Your server uses the credentials to sign on the user’s behalf
Step 1: Decrypt the Webhook Payload
Dynamic encrypts delegation credentials with your RSA public key. Decrypt them before use:wallet_api_key and key_share encrypted in your database alongside the walletId.
Step 2: Create a Delegated Client
create_delegated_evm_client returns a fully authenticated DynamicEvmWalletClient — no follow-up authenticate_api_token call is needed.
Step 3: Sign a Message
delegated_sign_message for EVM returns a signature object exposing r, s, and v byte components. Most EVM tooling expects the standard 0x-prefixed 132-character r || s || v hex string, so convert it before passing the signature downstream.
is_formatted:
True—messageis already the 32-byte keccak256 hash (hex)False—messageis plain text; the SDK applies EIP-191 prefixing and hashing for you
Complete Webhook Handler Example
Security Considerations
- Never log delegation credentials (wallet API key, key share)
- Store credentials encrypted at rest — treat them like passwords
- Use secure environment variables for your RSA private key and server API key
- The RSA private key used for decryption should never leave your server