Overview
Dynamic’s Node SDK provides comprehensive support for TON blockchain operations, including wallet creation, transaction signing, message signing, and key management. The SDK implements Multi-Party Computation (MPC) for enhanced security.Key Features
- MPC Wallet Creation: Create secure TON wallets with threshold signature schemes
- Transaction Signing: Sign TON transactions (BOC format) without exposing private keys
- Message Signing: Sign messages using Ed25519, returned as base64 strings
- Key Import/Export: Import existing private keys and export wallet data
- Multiple Security Models: Choose between different threshold signature schemes
Available Threshold Signature Schemes
TWO_OF_TWO: Maximum security - requires both server and Dynamic infrastructureTWO_OF_THREE: Balanced security and availability - requires 2 out of 3 sharesTHREE_OF_FIVE: High availability - requires 3 out of 5 shares
Quick Start
Core Functions
Wallet Management
createWalletAccount()- Create new TON walletimportPrivateKey()- Import existing private keygetWallet()- Get specific wallet detailsgetTonWallets()- Get all TON walletsderiveTonAddress()- Derive TON address from a public key (synchronous)
Signing Operations
signMessage()- Sign messages (Ed25519, base64 output)signTransaction()- Sign TON transactions (BOC format)
Key Management
exportKey()- Export wallet key dataofflineExportPrivateKey()- Export private key from key shares offlineencryptKeyShare()- Encrypt key sharesdecryptKeyShare()- Decrypt key shares
Backup and Recovery
storeEncryptedBackupByWallet()- Store encrypted backuprecoverEncryptedBackupByWallet()- Recover encrypted backuprefreshWalletAccountShares()- Refresh wallet shares
Guides
- Create TON Wallet - Step-by-step wallet creation
- Import Private Keys - Import existing TON keys
- Sign Transactions - Sign TON transactions
- Sign Messages - Sign messages with your wallet
- Use Imported Wallets - Work with imported wallets
- Complete Example - Full working example
Prerequisites
Before using the TON SDK, ensure you have:- Dynamic Project Setup: Set up your Dynamic project
- Environment Configuration: Configure your environment ID and auth token
- TON Chain Enabled: Enable TON chain in your Dynamic dashboard
- Dependencies Installed: Install required packages
Installation
Environment Variables
TON-Specific Concepts
Address Format
TON addresses are user-friendly strings (e.g.,EQD...), derived from the wallet contract. The SDK uses WalletContractV5R1 by default. You can also derive an address from a public key using deriveTonAddress().
Native Unit
TON uses nanotons as its smallest unit:1 TON = 1,000,000,000 nanotons.
Transaction Format
TON transactions use BOC (Bag of Cells) serialization. ThesignTransaction() method accepts a Cell object built with @ton/ton helpers and returns a signed BOC.
Jettons
TON’s fungible token standard is called Jettons. Transferring Jettons requires interacting with Jetton wallet contracts on-chain.Security Considerations
- MPC Architecture: Private keys are never stored in plain text
- Threshold Signing: Multiple parties must collaborate to sign transactions
- Key Share Backup: Use
backUpToClientShareService: truefor secure storage - Password Protection: Implement strong passwords for additional security layers