📒 How TON addresses work and why they have multiple forms
⚫️ At first glance, non-custodial wallet addresses in TON appear to be just random characters. However, there’s a logic behind them. You can use TON without knowing any of this, but if you’re curious, let’s dive into the #howtoton series.
⚫️ On websites ton.org/address and stels-cs.github.io/ton-tools, you can enter any TON address (e.g., UQBLiDaV9no7RRwDvQrYI1kLdGfbeUSO_gLHmUxyJ6EJ1Vse) and see it displayed in multiple formats—five, in the case of the first site. But why so many, and what makes them different?
⚫️ The first format, HEX, is a «technical» one. It’s primarily used in code and isn’t considered user-friendly, so most users never see it. The part before the colon represents the workchain number. Currently, everyone in TON uses the default workchain, but efforts are underway to introduce more workchains, making this parameter more relevant in the future.
⚫️ Next are the more familiar formats. You may have noticed that some TON addresses start with EQ, while others start with UQ. In reality, every address has both forms. The difference lies in the bounceable flag: If a transaction is sent to an EQ address but the recipient cannot process it, the funds are automatically returned to the sender.
⚫️ UQ addresses are more commonly used in wallets to ensure that transactions don’t bounce back when sent to an inactive wallet. Most users don’t need to worry about these distinctions — it’s something developers handle.
⚫️ Notice that besides the EQ/UQ prefix, the last characters in each format also differ. This means you can’t simply swap EQ prefix for UQ (or vice versa). If you try this in the input field at ton.org/address, you’ll get an error: «Not a valid TON address.» How does the system detect this error? The last characters represent a checksum, calculated based on the rest of the address. If any part of the address changes, the checksum must change too. This serves as a built-in error check—if a user mistypes a character, the system can identify the mistake and prevent them from sending funds to an invalid address.
⚫️ Finally, there are two more formats starting with kQ/0Q, which indicate testnet addresses. We covered testnet in a previous post.
💡 So now you understand the beginning and end of an address—but what about the main body? In simple terms, it’s derived from the wallet code and seed phrase. This means your address contains traces of your secret words, but the system is designed in a way that prevents attackers from reversing the process to extract your seed phrase.
@thedailyton
Post #871
5.41K

- 👍 19
- ❤ 6
- 🔥 5
- 💯 1