Overview
This guide walks you through creating TON wallets using Dynamic’s Node SDK. You’ll learn how to set up different threshold signature schemes and understand the security implications for TON blockchain operations.Prerequisites
Before you begin, make sure you have:Step 1: Choose Your Security Model
Dynamic supports three threshold signature schemes for TON wallets:TWO_OF_TWO (Recommended for most use cases)
- Security: Highest - requires both your server and Dynamic’s infrastructure
- Availability: Lower - both parties must be online
- Use case: High-value transactions, maximum security
TWO_OF_THREE
- Security: High - requires 2 out of 3 shares
- Availability: Medium - can tolerate one party being offline
- Use case: Balanced security and availability
THREE_OF_FIVE
- Security: High - requires 3 out of 5 shares
- Availability: Highest - can tolerate two parties being offline
- Use case: Maximum fault tolerance and availability
Step 2: Create Your First TON Wallet
Here’s a complete example of creating a TON wallet:Step 3: Handle Errors Gracefully
Always implement proper error handling for TON wallet creation:Step 4: Store Wallet Information Securely
After creating a TON wallet, you’ll receive important information that should be stored securely:Step 5: Derive the TON Address
You can also derive the TON address from a public key usingderiveTonAddress(). This is a synchronous method:
Best Practices
- Password Security: Use strong, unique passwords for each TON wallet
- Error Handling: Always handle potential errors during wallet creation with the
onErrorcallback - Monitoring: Log wallet creation events for audit purposes
- Backup Strategy: Implement secure backup strategies for key shares with
backUpToClientShareService: true
TON-Specific Considerations
Workchain
TON organizes accounts into workchains. Most user wallets live on workchain0 (basechain). The masterchain (-1) is used for system contracts.
Address Format
TON wallet addresses are user-friendly base64url strings (e.g.,EQD... for non-bounceable). The SDK derives these using WalletContractV5R1.
Nanotons
TON uses nanotons as the smallest unit:1 TON = 1,000,000,000 nanotons.