A One-Stop Guide to Understanding TON Technology With High-Speed Applications as the Core

An All-Inclusive Guide to Comprehending TON Technology with High-Speed Applications as its Foundation

TON roadmap The technical part will continue to advance TON’s speed and scalability advantages.

Written by: Peking University Blockchain Association Kiwi

TON has a technology logic centered around high-speed applications: TON was born on telegram, transactions are directly chained based on messages, and support peer-to-peer;

  1. Asynchronous message delivery: Since FunC is selected as the development language, communication between nodes in TON is done by passing “message”. However, TON is an asynchronous chain, so in order to synchronize messages between chains correctly, the concept of logical time (It) is introduced, which ensures that messages are executed in strict order to guarantee the correct execution of information;

  2. Supercube message routing mechanism: TON adopts regular routing + fast routing. Regular routing passes messages between adjacent nodes using a cube structure, and fast routing adds Merkle proofs that can be relayed along the edges of the supercube to improve speed;

  3. PoS + BFT consensus facilitates ecological development: POS avoids a lot of computation during the block production process, resulting in higher efficiency, lower cost, and better network performance, which is conducive to the implementation of DAPP applications. Although DPOS is faster, its trust speed is slower than that of the BFT system, so TON chooses BFT.

TON’s dynamic multi-sharding architecture facilitates application scalability: TON improves speed through parallel queries, accuracy of queries through dynamic sharding, and expandability through the bag of cells;

  1. Dynamic multi-sharding architecture: TON has three layers, single masterchain + multiple workchains + shardchains that can be dynamically added, reduced, and split. Each shardchain is a collection of various account chains, and DAPPs can autonomously activate a certain shardchain;

  2. Rapidly updatable global state: Update the global state through a “bag of cells” structure similar to DAG, and update quickly by concurrently linking new and old sets of cells and deleting the old root. At the same time, adopt vertical block repair to update blocks.

TON will continue to optimize the technical framework in the future: Through parallel expansion, launching chain sharding tools, and strengthening node inspection and other mechanisms, TON’s speed and scalability advantages will continue to advance.

The problem of blockchain scaling

Blockchain scaling is an important technical challenge and one of the key drivers of blockchain technology development: With the continuous growth of blockchain applications and the increasing number of users, existing blockchain networks often face insufficient throughput and long transaction confirmation times. The traditional design of blockchain limits its ability to handle large-scale transactions and user demands, leading to network congestion, high transaction costs, and inefficiency;

The main challenges of blockchain scaling come from distributed architecture and consensus mechanisms: Firstly, the consensus mechanism and distributed nature of blockchain require each node in the network to verify and record all transactions, which limits the throughput of the network. Secondly, the security and decentralization features of blockchain require all nodes to maintain complete copies of the blockchain, which increases the burden of storage and transmission;

To solve the problem of blockchain scalability, researchers have proposed various scaling solutions: such as Sharding, Sidechains, Layer 2 solutions, etc. These solutions aim to improve the throughput and performance of the network by partitioning the network into smaller parts, introducing independent blockchains, or building additional structures on the main chain. However, these solutions also bring new technical challenges and security issues, such as sharding communication, cross-chain asset transfer, and consensus mechanism design.

1. Sharding: The basic idea is to divide the entire blockchain network into smaller fragments (or shards), each of which can independently process a portion of transactions and data. By dispersing transactions and data into different shards, the sharding mechanism can improve the overall network throughput and performance. However, it still faces security and consistency issues in sharding communication and cross-shard transactions. Additionally, the sharding mechanism needs to address the design and implementation of consensus mechanisms to ensure the overall network’s consistency and security.

2. Sidechains: Sidechain technology is a method of creating and running independent blockchains that are interconnected with the main chain (the primary blockchain) in a blockchain network. Sidechains can facilitate two-way asset transfers with the main chain while having their own independent rules and functionalities. The basic principle of sidechain technology is to alleviate the burden on the main chain by moving some transactions to the sidechain for processing, providing higher scalability and flexibility. However, sidechains require secure mechanisms and protocols for two-way asset transfers with the main chain to ensure asset security and consistency. Additionally, the design and implementation of sidechains need to consider compatibility and interoperability with the main chain.

3. Rollup: The basic principle is to store a large amount of transaction data in an off-chain sidechain and submit the summary information of these transactions to the main chain for verification. Its advantage lies in significantly improving the scalability and performance of the blockchain network. By storing transaction data on the sidechain and using the main chain for verification, Rollup technology can greatly reduce the storage and computational burden on the main chain. However, there are concerns about centralization and security.

4. New consensus mechanism: For example, Solana’s Proof of History (POH) associates a timestamp with each transaction, providing a verifiable time sequence for the blockchain. This time sequence can be used to validate the order and timing of transactions, reducing communication costs and delays in the consensus process. Although Solana claims its TPS can reach 65,000, the majority of TPS is actually communication between nodes, and the actual data throughput limit is only 6-8k (daily 4-5k).

TON blockchain originated from Telegram, with the initial concept of serving a large number of users: Telegram is one of the most popular social platforms globally, with over 800 million monthly active users and billions of messages transmitted within the software every day. TON, as Telegram’s web3 transformation, has designed its concept from the beginning based on serving billions of users, not just a small number of users.

TON’s Technical Architecture Adaptive Infinite Sharding Multi-Chain Design

TON’s Sharding is Bottom-Up: Traditional blockchain sharding schemes adopt a top-down approach, where a single blockchain is first established and then broken down into multiple interactive blockchains to improve performance. However, TON’s sharding scheme takes a bottom-up approach: organizing these account chains into shardchains, where the account chains (workchains) exist purely in virtual or logical form within the shardchains. TON achieves parallel processing of transactions across multiple chains, known as a “blockchain of blockchains.” This effectively improves system performance;

TON’s Dynamic Sharding Architecture: It consists of masterchain, workchain, and shardchain. The masterchain coordinates the actual transaction processing among workchains and shardchains. Additionally, TON’s sharding is dynamic, with each account acting as a shardchain. They can dynamically combine into larger shardchains based on the interaction among accounts to meet the requirements of dynamic scalability.

  1. Masterchain: There is only one and it contains the protocol parameters, validators set, and corresponding shares. It records the current working workchains and their subordinate shardchains. The lower-level chains submit the latest block hash to the masterchain to ensure the determination of the latest state when cross-chain message reading is required.

  2. If a shard has reached its limit, then each shardchain will only store one account or smart contract. This will result in a large number of “account chains” that describe the state and state transitions of individual accounts. These account chains exchange information with each other, forming a workchain composed of shardchains.

  3. Workchain: It is a virtual concept that exists as a collection of shardchains. The system can accommodate a maximum of 2^32 workchains. Each workchain can flexibly define rules such as transaction type, token type, smart contracts, address format, etc., while meeting interoperability standards. However, workchains must have the same message queue format for message exchange, which also means that all workchains must have roughly the same security guarantees;

  4. Shardchain: To improve processing efficiency, shardchains can automatically split when the load increases and merge when the load decreases. Each workchain is further divided into shardchain shards (up to 2^60). Shardchains distribute the workload among all shardchains, with each shardchain serving only a portion of the account set.

image.png

Message Delivery Mechanism

Message: Since TON uses the FunC’s send_raw_message function development language, the messages transmitted by TON nodes are called “messages.” In TON, a transaction consists of the inbound message that initially triggers it and a set of outbound messages sent to other contracts;

Hypercube Routing: It is a three-dimensional information delivery mechanism that allows messages created in a shardchain block to be quickly transmitted and processed in the next block of the target shardchain.

Asynchronous Message Passing

Sync Issues with Asynchronous Calls: In a synchronous blockchain, transactions can include multiple smart contract calls. However, in an asynchronous system, users cannot immediately receive responses from the target smart contract in the same transaction because contract calls may take several blocks to process. The routing length between the source block and the destination block will impact this process;

To achieve infinite sharding, message parallelization must be ensured, leading to the concept of logical time: In TON, each transaction is executed on a single smart contract and communication between smart contracts is done through messages. This introduces the concept of logical time in the asynchronous chain to achieve inter-chain message synchronization, where each message has its logical time or Lamport time (referred to as lt below). This time is used to track the relationship between events and the events that validators need to process first;

Message lt execution strictly follows the order to ensure operational logic: Messages sent from an account and transactions that occur on an account are strictly ordered, with the lt of the resulting transaction greater than the lt of the message. Additionally, if multiple messages exist, those with a lower lt will be processed earlier.

Message Hypercube Routing Mechanism

TON adopts fast routing + slow routing in parallel:

Slow Routing: A more stable and traditional method for cross-chain information processing, where information is packaged into a block on the source chain and then transferred from one shard chain to another through a relayer, which can also involve multiple intermediate shard chains for transmission. All shard chains form a “hypercube” graph, and messages propagate along the edges of this hypercube, with information being validated by validators and packaged into another block;

The advantage of slow routing lies in higher security and decentralization, as all information needs to go through a complete block confirmation process. For a shard chain hypercube network with a scale of N, the number of hops required is hop = log16(N). Therefore, with only 4 routing nodes, a shard chain with a million levels can be supported.

Fast Routing: In slow routing, messages propagate along the edges of the hypercube. To speed up the process, fast routing allows the validators belonging to the destination shard chain of the message to process it in advance, provide a Merkle proof, and send a receipt to destroy the message being transmitted;

Fast routing is faster (nodes can find the optimal path) and prevents double delivery, but it cannot replace slow routing because validators are not penalized for losing receipts, thus posing a certain security risk.

Global State of Shard Chains

“Bag of Cells”: A set of cells that are updated in a manner similar to a DAG. By representing the new state as another “bag of cells” with its own root and then combining the new and old sets of cells while deleting the old root;

Vertical Block Repair: Each block in the TON shard chain is not just a single block, but a chain. When it is necessary to repair a block in an erroneous shard chain, a new block will be submitted to the “vertical blockchain” and replace it.

Consensus Mechanism

In the POS network, there are 3 roles:

  1. Validator Node: After meeting the hardware requirements, staking 300,000 TON allows participation in maintaining network security;

  2. All blocks are created by 100 to 1000 selected nodes, which are elected once a month and need to stake TON Coin during the election. The elected nodes are divided into multiple workgroups to create new blocks. Each new block is considered successfully created if it receives the signatures of more than 2/3 of the staked nodes in the workgroup. If malicious behavior is detected, the node will be slashed and lose eligibility;

  3. Fisherman: Plays the role of a supervisor by sending proofs of invalidity to check if the validator nodes have diligently completed the verification tasks;

  4. Curator: It suggests new shard chain candidate blocks to the validators. If the block is selected, the curator profits. It is responsible for verifying the state of the shard chain and the data of neighboring shard chains and sending them to the validator nodes.

BFT: TON opted for BFT (Byzantine fault tolerance) after weighing the options. Although DPOS is faster, its level of trust and speed are slower than the BFT system.

TON’s new framework can support TG’s high-speed information transmission

TON achieves high transaction speeds and finality through a dynamic multi-shard architecture: TON can create a separate chain for each user’s wallet. The parallel computation of shards, support for instant cross-shard communication, and TVM’s support for asynchronous computing form the theoretical basis for its high TPS;

TON brings higher scalability through its information transmission mechanism: In the TON blockchain, calls between smart contracts are asynchronous, not atomic. This means that when one smart contract calls another smart contract, the call is not executed immediately but is processed in some future block after the transaction concludes. This design allows for greater scalability as it does not require all transaction processing to be completed in a single block.

TON will continue to optimize its technical framework in the future…

The TON roadmap’s technical section will continue to advance TON’s speed and scalability advantages

  1. Separation of Sorters and Validators;

  2. Improvement in scalability and speed: Allowing TON to achieve parallel scalability when dealing with a large number of transactions;

  3. Shard Chain Guidelines and Tools: Guidelines and code examples for organizing high-load TON work in exchanges, payment systems, and TON services;

  4. Strengthening the coordination among validator nodes: Strengthening and improving the detection and punishment of poorly performing validators.

Reference

Website: https://ton.org/

Official Twitter: https://twitter.com/ton_blockchain

TON Dev Group: https://t.me/tondev_eng/ https://t.me/tactlang

WhiteLianGuaiper: https://ton.org/whiteLianGuaiper.pdf

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Behind the Internet of Things Security: Application and Exploration of Blockchain Technology

With the arrival of 5G, the Internet of Things era will usher in a new outbreak. The cooperation between things and t...

Blockchain

Guangming Daily Review: New technologies such as blockchain build a "firewall" for copyright protection

Knowledge payment continues to be at the forefront. Some consulting agencies expect that by 2020, the domestic knowle...

Blockchain

Opinion: The financial industry explores the blockchain, and integrating resources is the key

On April 20th, Zinc Link held the third phase of “Zinc Huoyuan·Industry Blockchain Ecological Salonȁ...

Blockchain

Observation | In the blockchain era, can Shanghai create "BAT"?

Writer Italo Calvino wrote in The Invisible City, “The city is a whole of many things: the whole of memory, th...

Blockchain

Blockchain empowers justice, illustrating the first case of financial disputes in Zhejiang Province that successfully used blockchain mediation

Source: Jiaxing Intermediate People's Court The original title "Jiaxing Haining Court uses blockchain techn...

News

The growth mode of capitalism destroys the ecological environment? Talking about the circular economy under the blockchain

Author: IPFS Force area Taosheng Shi Source: IPFS Force Zone Things that already exist will come later; What has been...