Overview
Dynamic embedded wallets give you cryptographic key material for two curves:- secp256k1 via the EVM wallet — used by Bitcoin, Ethereum, Tron, Cosmos, XRP, Starknet, and many others
- Ed25519 via the Solana wallet — used by Solana, NEAR, Cardano, Aptos, Mavryk, Algorand, and others
Decision: which root wallet to use?
| Your chain uses | Root wallet | Signing method |
|---|---|---|
| secp256k1 | EVM wallet | DynamicSDK.instance.wallets.signRawMessage(...) |
| Ed25519 | Solana wallet | DynamicSDK.instance.solana.createSigner(wallet: ...).signMessage(...) |
Step 1: Add Dart crypto dependencies
Choose the packages you need based on the chain’s address encoding and hash functions:flutter pub get after updating pubspec.yaml.
Step 2: Derive the address
secp256k1 chains
secp256k1 chains need the compressed 33-byte public key. You recover it once per session by signing a deterministic message and running ecrecover:Ed25519 chains
Ed25519 chains use the Solana wallet’s public key directly. The Solana address is base58 encoding of the 32-byte Ed25519 public key:Step 3: Sign payloads
The signing flow is the same for all chains on the same curve — only the hash/serialization before calling the SDK differs.secp256k1 signing
Ed25519 signing
decodeSig helper handles all three encodings:
Step 4: Query balances and broadcast transactions
Usepackage:http to call the chain’s RPC or REST API. The signing flow is chain-agnostic; only the serialization and endpoint differ.
Shared byte utilities
Add these tolib/utils/bytes.dart:
Checklist for a new chain
- Identify the curve (secp256k1 or Ed25519) and the root wallet to use
- Look up the address encoding (bech32, base58check, hex, etc.) in the chain’s spec
- Implement
deriveAddress(String rootWalletAddress) → String - Implement
digestForSigning(String message) → String(hex of hash) - Call
signWithEvmWalletorsignWithSolanaWalletwith the digest - Post-process the signature if needed (low-S normalization, DER encoding, etc.)
- Serialize and broadcast the transaction via the chain’s RPC
- tron.dart — secp256k1, base58check
- cosmos.dart — secp256k1, bech32, Protobuf
- near.dart — Ed25519, Borsh
- cardano.dart — Ed25519, CBOR
- aptos.dart — Ed25519, REST API signing