Original author:Peking University Blockchain Association Kiwi
Keytakeaways
TON has technical logic with high-speed application as the core: TON was born on telegram, transactions are directly uploaded to the chain based on messages, and support point-to-point;
Asynchronous message delivery: Since FunC is selected as the function development language, each node in TON communicates by passing message. However, TON is an asynchronous chain, so in order to correctly synchronize messages between chains, the concept of logical time (It) is introduced. By ensuring the message lt is executed strictly in sequence to ensure the correct execution of information;
Hypercubes message routing mechanism: TON adopts the method of normal routing + fast routing. Normal routing transmits inter-shard messages through adjacent nodes through the cube structure. Fast routing adds Merkle proofs that can be transmitted along the edge of the hypercube to relay message improvements. speed;
PoS + BFT consensus facilitates ecological development: POS avoids a lot of calculations in the block generation process, is more efficient and cost-effective, and has better network performance, which is conducive to the implementation of DAPP applications; at the same time, although DPOS is faster, the trust speed is slower than the BFT system. Therefore, TON chooses BFT.
TONs dynamic multi-sharding architecture facilitates application Scalability: TON improves speed through parallel queries, improves query accuracy through dynamic sharding, and improves scalability through bag of cells;
Dynamic multi-shard architecture: TON has three layers, a single masterchain + multiple Workchains + shardchains that can be dynamically increased, decreased and split. Each shard chain is a collection of various account chains, and DAPP can independently activate a certain shard chain;
Global state that can be quickly updated: The global state is updated through a bag of cells structure similar to DAG, and the global state is quickly updated by combining the old and new cells and deleting the old root. At the same time, vertical block repair and update blocks are used.
TON will continue to optimize the technical framework in the future:TONs speed and scalability advantages will continue to be promoted through mechanisms such as parallel expansion, the launch of chain sharding tools, and enhanced node inspection.
Blockchain expansion problems
Blockchain expansion is an important technical problem and one of the keys to promoting the development of blockchain technology:As blockchain applications continue to grow and the number of users increases, existing blockchain networks often face problems of insufficient throughput and long transaction confirmation times. Traditional blockchain designs limit their ability to handle large-scale transactions and user needs, which leads to network congestion, high transaction fees, and inefficiencies;
The challenges of blockchain expansion mainly stem from the distributed architecture and consensus mechanism:First of all, the consensus mechanism and distributed nature of the blockchain require each node in the network to verify and record all transactions, which results in limited network throughput. Secondly, the security and decentralization characteristics of the blockchain require all nodes to maintain a complete copy of the blockchain, which increases the burden of storage and transmission;
In order to solve the problem of blockchain expansion, researchers have proposed various expansion solutions:Such as Sharding, Sidechains, Layer 2 solutions, etc. These solutions try to divide the network into multiple smaller parts, introduce independent blockchains, or build on the main chain. Additional structures to improve network throughput and performance. However, these solutions also bring new technical challenges and security issues, such as inter-shard communication, cross-chain asset transfer and consensus mechanism design.
Sharding: The basic idea is to split the entire blockchain network into multiple smaller fragments (or shards), each of which can independently process a portion of transactions and data. By spreading transactions and data across different shards, the sharding mechanism improves the throughput and performance of the entire network. However, it still faces the security and consistency issues of inter-shard communication and cross-shard transactions. In addition, the sharding mechanism also needs to solve the design and implementation of the consensus mechanism to ensure the consistency and security of the entire network;
Sidechain: Sidechain technology is a method of creating and running independent blockchains in a blockchain network that are interconnected with the main chain (the main blockchain). The side chain can perform two-way asset transfer with the main chain and has its own independent rules and functions. The basic principle of side chain technology is to reduce the burden on the main chain and provide higher scalability and flexibility by transferring some transactions from the main chain to the side chain for processing. However, the side chain requires two-way asset transfer with the main chain, which requires certain security mechanisms and protocols to ensure the security and consistency of assets. In addition, the design and implementation of side chains need to consider compatibility and interoperability with the main chain;
Rollup: The basic principle is to store a large amount of transaction data in off-chain side chains, and then submit the summary information of these transactions to the main chain for verification. Its advantage is that it can significantly improve the scalability and performance of the blockchain network. By storing transaction data on the side chain and using the main chain for verification, Rollup technology can greatly reduce the storage and computing burden on the main chain. But there are also concerns about centralization and security;
New consensus mechanisms: such as Solana’s POH, provide a verifiable time series for the blockchain by associating timestamps with each transaction. This time series can be used to verify the order and timing of transactions, thereby reducing communication costs and delays in the consensus process. Although Solana claims that its TPS can reach 65,000, in fact most TPS is used as communication between nodes, and the real data limit is only 6-8 k (daily 4-5 k).
The TON blockchain originated from Telegram, and its initial establishment concept was to serve a large number of users:Telegram is one of the most popular social platforms in the world, with more than 800 million monthly active users and tens of billions of messages transmitted within the software every day. As the web3 transformation of telegram, TONs design concept has been based on serving billions of users from the beginning rather than just satisfying a small number of users.
TON’s technical architecture
Adaptive infinite sharding multi-chain design
TON’s sharding is bottom-up:Blockchain sharding solutions generally adopt a top-down approach, that is, first establishing a single blockchain and then decomposing it into several interactive blockchains to improve performance. However, the TON sharding solution adopts a bottom-up approach: organizing these account chains into shard chains (Shardchain), so that the account chain (Workchain) only exists in a purely virtual or logical form in the shard chain. TON implements multiple chains to process transactions in parallel, which is called the blockchain of blockchains. In this way, system performance can be effectively improved;
TONs dynamic sharding architecture:Divided into masterchain, workchain and shardchain. The masterchain is responsible for coordination, and each workchain and shardchain perform actual transaction processing. In addition, TONs sharding is dynamic. Each account acts as a Shardchain and can be adaptively combined into a larger Shardchain based on the interactive relationship between accounts to meet the needs of dynamic expansion.
Masterchain: There is only one, including the parameters of the protocol, the set of Validators and the corresponding shares, recording the current working Workchains and subordinate Shardchains. The lower chain submits the latest block hash to the Masterchain to ensure that the latest status can be determined when cross-chain message reading needs to occur.
If sharding reaches its limit, eventually each shard chain will only hold one account or smart contract. This will lead to a large number of account-chains that describe the status and status transition of a single account. These account chains transmit information to each other, that is, the Shardchain constitutes the Workchain.
Workchain: It is a virtual concept that exists as a collection of Shardchains. The system can accommodate up to 2^32 Workchains. Each Workchain can flexibly customize rules, such as transaction type, token type, smart contract, address form, etc., on the premise of meeting interoperability standards. But the Workchain must have the same message queue format to facilitate the exchange of messages. Of course, this also means that all Workchains must have roughly the same security guarantee;
Shardchain: In order to improve processing efficiency, it can automatically split when the load becomes high and merge the chains when the load decreases. Each Workchain will be further divided into shard Shardchains (up to 2^60). Shardchain distributes the work among all Shardchains, and each Shardchain only serves a part of the account set.
information transfer mechanism
Message:Since TON uses FunCsend_raw_messageFunction development language, so what each node of TON passes is called message. A transaction in TON consists of the inbound message that initially triggered it and a set of outbound messages sent to other contracts;
Hypercube Routing:The three-dimensional structure of the information transfer mechanism enables messages created in one shard chain block to be quickly transferred and processed to the next block of the target shard chain.
Asynchronous message delivery
Asynchronous calls have synchronization issues:In a synchronous blockchain, a transaction can contain multiple smart contract calls. In an asynchronous system, users cannot immediately obtain the response of the target smart contract in the same transaction, because the contract call may take several blocks to process, and the length of the route between the source block and the destination block will affect this process;
In order to achieve infinite sharding, it is necessary to ensure that the message is fully parallelized, which leads to logical time:In TON, each transaction is only executed on a single smart contract and communicates between smart contracts through messages. Therefore, the concept of logical time used in asynchronous chains is introduced to achieve inter-chain message synchronization, that is, each message has its logical time or Lamport time (hereinafter referred to as lt). This time is used to track the relationship between events and which event the validator needs to handle first;
message lt will be executed strictly in order to ensure the operation logic:Messages sent from an account and transactions occurring on an account are strictly ordered such that the lt of the resulting transaction is greater than the lt of the message, and the lt of a message sent within a transaction is strictly greater than the lt of the transaction that caused the message. Additionally, if multiple messages exist, messages with lower lt will be processed earlier.
Message hypercube routing mechanism:
TON uses fast routing + slow routing to run in parallel:
Slow routing:A more stable and traditional cross-chain information processing method. Information is packaged into a block on the source chain, and then passed from one shard chain to another shard chain through a relayer. Multiple blocks can also be used. Intermediate shard chain for transmission. Let all shard chains form a hypercube graph, and messages will propagate along the edges of this hypercube. The information will be packaged into another block after being verified by the validator;
The advantage of slow routing is higher security and decentralization, because all information needs to go through a complete block confirmation process. For a sharded chain hypercube network with a size of N, the number of routes that need to be traversed is hop = log 16(N). Therefore, only 4 routing nodes are needed to support millions of shard chains.
Fast routing:In slow routing, messages propagate along the edge of the hypercube. In order to speed up, fast routing can let the validator of the destination shard chain of the message process the message in advance, then provide a Merkel proof, and send a receipt to destroy the message. Messages being transmitted;
Fast routing is faster (nodes can find the optimal path) and can prevent double delivery, but it cannot replace slow routing because the validator will not be punished for losing the receipt, so there is a certain security risk.
Global state of the shard chain
“bag of cells” : A group of cells updated in a DAG-like form. By representing the new state as another bag of cells with its own root, and then concatenating the old and new sets of cells while deleting the old root;
Vertical block repair: Each block in the TON shard chain actually has not only one block, but a chain. When the block of the wrong shard chain needs to be repaired, a new block will be submitted to the vertical blockchain And perform block replacement on it.
consensus mechanism
There are 3 roles in the POS network:
Verification node: After meeting the hardware conditions, you can participate in maintaining network security by pledging 300,000 TON;
All blocks are created by 100 ~ 1000 selected nodes. The nodes are elected once a month and the pledged TON Coin needs to be sealed during the election. The nodes selected during the tenure will be divided into multiple working groups to create new blocks. Each new block will be deemed successful if it gets the signatures of more than 2/3 of the pledged nodes in the working group. If it does evil, it will be slashed and disqualified;
Fisherman: By sending invalid certificates to detect whether the verification node has completed the verification task with due diligence, it can be regarded as the role of a supervisor;
Proofreader: It recommends new shard chain candidate blocks to the validators. If the block is elected, the proofreader will make a profit. It is responsible for verifying the status of the shard chain and the data of adjacent shard chains and sending them to the verification node.
BFT:After weighing, TON found that although DPOS was faster, its trust level and speed were slower than the BFT system, so it finally chose BFT (Byzantine fault tolerance).
TON’s new framework can support TG’s high-speed information transmission
TON achieves high transaction speed and finality through a dynamic multi-shard architecture:TON can create a chain for each user wallet. Parallel computing of shards, support for instant cross-shard communication and TVM support for asynchronous computing form the theoretical basis of its high TPS;
TON brings higher scalability through information passing 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 on some future block after the transaction ends. This design allows for higher scalability because it All transaction processing does not need to be completed in one block.
TON will continue to optimize the technical framework in the future...
The TON roadmap technology part will continue to promote TON’s speed and scalability advantages
Separation of sequencer and verifier;
Scalability and speed improvement: Allow TON to achieve parallel expansion while processing a large number of transactions;
Chain Sharding Guides and Tools: Guides and code examples for organizing high-load TON work in exchanges, payment systems, and TON services;
Strengthen coordination among validator nodes: strengthen and improve detection and punishment of poorly performing validators;
They represent only personal opinions and do not represent any investment advice. DYOR.