Original Author: Kiwi, Blockchain Association of Peking University
Keytakeaways
TON has a technology logic core focused on high-speed applications: TON was born on Telegram, and transactions are based on message directly on-chain, supporting peer-to-peer;
Asynchronous message delivery: Due to the use of FunC as a function development language, communication between nodes in TON is done through "message" transmission. However, TON is an asynchronous chain, so in order to correctly synchronize inter-chain messages, the concept of logical time (It) is introduced. This ensures that messages are executed strictly in order of occurrence to guarantee the correct execution of information;
Hypercube message routing mechanism: TON adopts a combination of ordinary routing and fast routing. Ordinary routing transmits messages between shards through a hypercube structure and adjacent nodes, while fast routing adds Merkle proofs that can relay messages along the edges of the hypercube to improve speed;
PoS + BFT consensus facilitates ecological development: POS avoids a large amount of computation during the block generation process, resulting in higher efficiency, lower costs, and better network performance, which is beneficial for the landing of DAPP applications. Although DPOS is faster, trust speed is slower than the BFT system, so TON chooses BFT.
TON's dynamic multi-shard architecture facilitates application scalability: TON improves speed through parallel queries, enhances query accuracy through dynamic sharding, and enhances scalability through a bag of cells;
Dynamic multi-shard architecture: TON has three layers, a single masterchain + multiple Workchains + shardchains that can be dynamically added, removed, and split. Each shard chain is a collection of various account chains, and DAPPs can independently activate a certain shard chain;
Quickly updatable global state: The global state is updated through a "bag of cells" structure similar to a DAG, by combining new and old sets of cells and deleting the old root to update quickly. At the same time, vertical block repair is used to update blocks.
TON will continue to optimize the technical framework in the future: By parallel expansion, introducing chain sharding tools, and strengthening node checks, TON's speed and scalability advantages will continue to be promoted.
Blockchain Scalability Challenges
Blockchain scalability is an important technical challenge and a key driver of blockchain technology development: With the continuous growth of blockchain applications and the increase in the number of users, existing blockchain networks often face problems of 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 fees, and low efficiency;
The challenge of blockchain scalability mainly stems from the distributed architecture and consensus mechanism: Firstly, the consensus mechanism and distributed nature of blockchain require every node in the network to verify and record all transactions, limiting the network's throughput. Secondly, the security and decentralization characteristics of blockchain require all nodes to maintain complete copies of the blockchain, increasing the burden of storage and transmission;
To address the challenge of blockchain scalability, researchers have proposed various scalability solutions: such as sharding, sidechains, layer 2 solutions, etc. These solutions attempt to improve the network's throughput and performance by dividing 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 inter-shard communication, cross-chain asset transfer, and consensus mechanism design, etc.
Sharding: The basic idea is to divide the entire blockchain network into smaller segments (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's throughput and performance. However, it still faces security and consistency issues in inter-shard communication and cross-shard transactions. In addition, the sharding mechanism also needs to address the design and implementation of the consensus mechanism to ensure the overall network's consistency and security;
Sidechains: Sidechain technology is a method of creating and running independent blockchains connected to the main chain (main blockchain) within a blockchain network. Sidechains can transfer assets bidirectionally with the main chain while having their own independent rules and functions. The basic principle of sidechain technology is to offload some transactions from the main chain to the sidechain for processing, thereby reducing the burden on the main chain and providing higher scalability and flexibility. However, sidechains require bidirectional asset transfer with the main chain, which requires security mechanisms and protocols to ensure the safety and consistency of assets. In addition, the design and implementation of sidechains need to consider compatibility and interoperability with the main chain;
Rollup: The basic principle is to store a large amount of transaction data in a sidechain off the main chain, and then 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 in 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;
New consensus mechanisms: Such as Solana's POH, which associates a timestamp with each transaction, providing a verifiable time sequence for the blockchain. This time sequence can be used to verify the order and time of transactions, reducing communication costs and delays in the consensus process. Although Solana claims its TPS can reach 65,000, in reality, most TPS is for communication between nodes, and the actual data limit is only 6-8k (daily 4-5k).
TON's blockchain originates from Telegram, and its initial concept is to serve a large number of users: Telegram is one of the most popular social platforms globally, with over 800 million monthly active users and hundreds of billions of messages transmitted within the software every day. TON, as Telegram's web3 transformation, has been designed from the beginning to serve billions of users rather than just a few.
TON's Technical Architecture
Adaptive Infinite Sharding Multi-Chain Design
TON's sharding is bottom-up: Traditional blockchain sharding schemes generally adopt a top-down approach, first establishing a single blockchain and then breaking it down into several interactive blockchains to improve performance. However, TON's sharding scheme takes a bottom-up approach: organizing these account chains into shardchains, making account chains (Workchains) exist purely in a virtual or logical form within the shardchains. TON achieves parallel transaction processing on multiple chains, known as "blockchain of blockchains." This effectively improves system performance;
TON's sharding is dynamic: It is divided into masterchain, workchain, and shardchain. The masterchain is responsible for coordination, while the workchains and shardchains handle actual transaction processing. Additionally, TON's sharding is dynamic, with each account serving as a shardchain, which can adaptively combine into larger shardchains based on the interaction between accounts to meet dynamic expansion needs.
- Masterchain: There is only one, containing protocol parameters, a set of validators, and corresponding shares, recording the current working Workchains and their subordinate Shardchains. Lower-level chains submit the latest block hash to the Masterchain to ensure the latest state can be determined when cross-chain message reading is needed.
If the shards have reached their limit, then each shard chain will only store an account or smart contract. This will lead to a large number of "account chains" that describe the state and state transitions of a single account, and these account chains will transmit information to each other, forming a Workchain composed of Shardchains.
Workchain: It is a virtual concept that exists as a collection of Shardchains, and the system can accommodate up to 2^32 Workchains. Each Workchain can flexibly customize its rules, such as transaction types, token types, smart contracts, address formats, etc., as long as they meet interoperability standards. However, Workchains must have the same message queue format to facilitate message exchange, which also means that all Workchains must have roughly the same security guarantees;
Shardchain: To improve processing efficiency, Shardchains can automatically split when the load increases and merge when the load decreases. Each Workchain will be further divided into shard Shardchains (up to 2^60). Shardchains distribute work across all Shardchains, with each Shardchain serving only a portion of the account collection.
Message Delivery Mechanism
Message: Since TON uses FunC's sendrawmessage function development language, the messages passed between TON nodes are called "messages." In TON, transactions consist of inbound messages that initially trigger them and a set of outbound messages sent to other contracts;
Hypercube Routing: A three-dimensional structure for message delivery that allows messages created in a block of a Shardchain to be quickly transmitted and processed to the next block of the target Shardchain.
Asynchronous Message Delivery
Asynchronous Calls Have Synchronization Issues: In synchronous blockchains, transactions can include multiple smart contract calls. In an asynchronous system, users cannot immediately receive a response from the target smart contract in the same transaction because the contract call may take several blocks to process. The routing length between the source block and the destination block will affect 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 communicates between smart contracts through messages. This introduces the concept of logical time in an asynchronous chain to achieve inter-chain message synchronization, where each message has its logical time or Lamport time (referred to as lt). This time is used to track the relationship between events and the events that validators need to process first;
Message lt is strictly executed in order to ensure operational logic: Messages sent from an account and transactions occurring in an account are strictly ordered, with the lt of the resulting transaction being greater than the lt of the message. The lt of a message sent in a transaction is strictly greater than the lt of the transaction that triggered it. Additionally, if there are multiple messages, the message with the lower lt will be processed earlier.
Message Hypercube Routing Mechanism:
TON uses fast routing + slow routing in parallel:
Slow Routing: This is a more stable and traditional method for processing cross-chain information. Information is packed into a block on the source chain and then relayed from one Shardchain to another through a relayer, or it can be transmitted through multiple intermediate Shardchains. All Shardchains form a "hypercube" graph, and messages propagate along the edges of this hypercube. After being verified by validators, the information is packed 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 hypercube network of Shardchains with a scale of N, the number of routing hops = log16(N). Therefore, only 4 routing nodes are needed to support millions of Shardchains.
Fast Routing: In slow routing, messages propagate along the edges of the hypercube. To speed up the process, fast routing allows the validators of the destination Shardchain to process the message 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 can prevent double transmission, but it cannot replace slow routing because validators will not be penalized for losing receipts, thus posing a certain security risk.
Global State of Shardchains
"Bag of Cells": A set of cells updated in a form similar to a DAG. This involves representing the new state as another "bag of cells" with its own root, then combining the new and old sets of cells and deleting the old root;
Vertical Block Repair: Each block in a TON Shardchain is not just a single block, but a chain. When it is necessary to repair a block of an erroneous Shardchain, a new block will be submitted to the "vertical blockchain" and the block will be replaced.
Consensus Mechanism
In a POS network, there are 3 roles:
- Validators: They can participate in maintaining network security by staking 300,000 TON coins after meeting hardware requirements;
All blocks are created by 100 to 1000 selected nodes, which are elected monthly and need to stake TON coins when elected. The selected nodes during their term will be divided into multiple working groups to create new blocks. A new block is considered successfully created if it receives signatures from over 2/3 of the staked nodes in the working group. If malicious behavior is detected, the nodes will be slashed and disqualified;
Fisherman: They act as supervisors by sending invalid proof to check if validators have diligently completed their verification tasks;
Collator: It suggests new candidate blocks for the validators of a Shardchain. If the block is elected, the collator profits. It is responsible for checking the state of the Shardchain and the data of adjacent Shardchains and sending them to the validators.
BFT: After weighing the options, TON found that although DPOS is faster, its level of trust and speed are slower than the BFT system, so it ultimately chose BFT (Byzantine fault tolerance).
TON's New Framework Can Support TG's High-Speed Message Delivery
TON achieves high transaction speed and finality through dynamic multi-shard architecture: TON can create a chain for each user wallet, parallel computation of shards, support for instant cross-shard communication, and TVM support for asynchronous computation form the theoretical basis for its high TPS;
TON brings higher scalability through the message delivery mechanism: In the TON blockchain, calls between smart contracts are asynchronous rather than atomic. This means that when one smart contract calls another, the call is not executed immediately but is processed in a future block after the transaction ends. This design allows for higher scalability because it does not require all transaction processing to be completed in a single block.
TON will continue to optimize the technical framework in the future…
TON's roadmap will continue to advance TON's speed and scalability advantages in the technical section:
Separation of sorters and validators;
Scalability and speed improvements: Enabling TON to achieve parallel expansion in handling a large number of transactions;
Chain sharding guides and tools: Organizing guides and code examples for high-load TON work in exchanges, payment systems, and TON services;
Strengthening coordination between validator nodes: Enhancing and improving the detection and punishment of underperforming validators.
This represents personal opinions and does not constitute any investment advice. DYOR.
免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。