{"id":22470,"library":"tonsdk","title":"TON SDK","description":"Python SDK for interacting with The Open Network (TON) blockchain. Current version 1.0.15 supports wallet operations, message serialization, and contract interactions. Release cadence is irregular.","status":"active","version":"1.0.15","language":"python","source_language":"en","source_url":"https://github.com/tonfactory/tonsdk","tags":["ton","blockchain","sdk","cryptocurrency"],"install":[{"cmd":"pip install tonsdk","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"TonClient is in the client submodule","wrong":"from tonsdk import TonClient","symbol":"TonClient","correct":"from tonsdk.client import TonClient"},{"note":"Wallet class is in the wallet submodule","wrong":"from tonsdk import Wallet","symbol":"Wallet","correct":"from tonsdk.wallet import Wallet"},{"note":"","wrong":"","symbol":"Address","correct":"from tonsdk.utils import Address"},{"note":"","wrong":"","symbol":"TransferMessage","correct":"from tonsdk.boc import TransferMessage"}],"quickstart":{"code":"from tonsdk.client import TonClient\nfrom tonsdk.wallet import Wallet\nfrom tonsdk.utils import to_nano\n\n# Create a custom client (mainnet by default)\nclient = TonClient(config={'endpoints': ['https://toncenter.com/api/v2/jsonRPC']})\n\n# Generate a new wallet (mnemonic is printed)\nwallet, mnemonic, private_key, public_key, wallet_type = Wallet.create(mnemonics=24, randomgen=True)\nprint('Mnemonic:', mnemonic)\nprint('Wallet address:', wallet.address.to_string())\n\n# Check balance\nbalance = client.get_balance(wallet.address.to_string())\nprint('Balance:', balance)\n\n# Create a transfer message\n# message = wallet.create_transfer_message(destination='EQD...', amount=to_nano(0.1))\n# result = client.send_boc(message['message'].to_boc())\n# print('Transfer sent:', result)","lang":"python","description":"Initialize client, create wallet, check balance"},"warnings":[{"fix":"Use Wallet.from_mnemonic(mnemonic=your_list, version='v3r2') to restore wallet.","message":"Wallet.create() prints mnemonic to stdout. In production, never log mnemonic; consider using Wallet.from_mnemonic() with a securely stored phrase.","severity":"gotcha","affected_versions":"all"},{"fix":"Update imports to use submodule paths: from tonsdk.client import TonClient, etc.","message":"Version 0.9.x had different import paths; code using `from tonsdk import ...` will fail with 1.0.x.","severity":"breaking","affected_versions":"0.9.x to 1.0.x"},{"fix":"Use int(balance) if needed for math.","message":"TonClient.get_balance() returns string (nanoton), not integer. Arithmetic without conversion to int may cause unexpected behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Set config={'endpoints': ['https://toncenter.com/api/v2/jsonRPC']} when creating client.","message":"TonClient default endpoint 'https://ton.org/...' may be deprecated; use TonCenter endpoint explicitly.","severity":"deprecated","affected_versions":"1.0.x"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from tonsdk.client import TonClient'","cause":"Importing from top-level module instead of submodule.","error":"AttributeError: module 'tonsdk' has no attribute 'TonClient'"},{"fix":"Specify a custom endpoint when creating TonClient, e.g., config={'endpoints': ['https://toncenter.com/api/v2/jsonRPC']}","cause":"Default endpoint may be unreachable or deprecated.","error":"requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ton.org', port=443): Max retries exceeded"},{"fix":"Ensure address is a raw string in base64 format (e.g., 'EQD...'). Use Address(address_string).to_string() to validate.","cause":"Address string does not start with 'EQ' or 'UQ' or missing proper format.","error":"ValueError: Invalid address format"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}