Detailed Ton’s technical characteristics and smart contract development paradigm

Source: Mario watch web3

Introduction: With the largest wealth effect caused by Binance to launch Ton’s largest game NOTCOIN and the huge amount of wealth effects caused by the full -circulating Token economic model, TON has made great attention in a short time.I talked to my friends that I learned that TON’s technical threshold is relatively high, and the DAPP development paradigm is very different from the mainstream public chain agreement. Therefore, it took some time to study the relevant topics. Some experiences and experiences were shared with the monarchs.In short, TON’s core design concept is to reconstruct the traditional blockchain protocol in a “bottom -up” way, and at the expense of discarding interoperability, realize the high -combined and high scalabilityExtreme pursuit.

TON’s core design ideas -high -combined and high scalability

It can be said that the purpose of all complex technical selection in TON comes from the pursuit of high concurrency and high scalability. Of course, it is not difficult to understand this from the background of its birth.TON, that is, The Open Network, is a decentralized computing network with a L1 blockchain and multiple components.Ton was initially developed by Nikolai Durov, the founder of Telegram, and its team, and developed to the community of the global independent contributor to support and maintain.The birth of its birth dates back to 2017, and the Telegram team began to explore the blockchain solution for itself.Since there was no existing L1 blockchain at that time, they could support the nine -digit user base of Telegram, they decided to design their own blockchain, which was called Telegram Open Network.Time came in 2018. In order to obtain the resources required by TON, Telegram launched a sales of GRAM tokens (later renamed Toncoin) in the first quarter of 2018.Due to regulatory problems in 2020, the Telegram team withdrew from the TON project.Subsequently, a small part of the open source developer and Telegram winner took over Ton’s code library, renamed the project name the Open Network, and continued to actively develop the blockchain to this day, and follow the principles of the original Ton white paper.

So since it is based on the decentralized execution environment as Telegram as the design goal, naturally you must face two problems. High and merging requests and massive data. We know that with the development of technology to the present, the highest TPS measured TPS, which is known as the highest TPS, is only TPS.65,000, which is obviously not enough to support the Telegram ecosystem that requires one million TPS requirements.At the same time, with the large -scale application of Telegram, the amount of data generated by it has already exceeded the sky, and the blockchain is a extremely redundant distributed system. If each node in the network is required to save a complete data, this isIt is also unrealistic.

Therefore, in order to solve the above two problems, TON has made two aspects of the mainstream blockchain protocol:

  • By using the “Infinite Sharding ParadigM” design system, the problem of data redundancy can be solved, so that it can carry big data and relieve performance bottlenecks;

  • By introducing a complete parallel execution environment based on the ACTOR model, it greatly improves the network TPS;

Make a blockchain chain -to make each account have an exclusive account chain through the ability of unlimited sharding

At the moment we know that Sharding has become the mainstream solution for most blockchain protocols to improve performance and reduce costs, and TON has made this to the extreme and proposes unlimited shard parades.It refers to allowing blockchain to increase or reduce the number of shards according to the network load.This paradigm enables TON to deal with large -scale transactions and smart contract operations while maintaining high performance. Theoretically TON can establish an exclusive account chain for each account, and ensure that these chains are guaranteed through certain rules to ensure that these chains are between these chains.consistency,

Abstract understanding, there are a total of four layers of chain structures in TON:

  • AccountChain: This layer chain represents a series of chains related to a certain account.The results obtained after receiving the same order are consistent, so all blockchain distributed systems need to be sorted in chain in all blockchain distributed systems, and TON is no exception.The account chain is the most basic component unit in the TON network. Generally, the account chain is a virtual concept. It is unlikely that there is a independent account chain.

  • Shardchain: In most contexts, the chip chain is the actual component unit in TON. The so -called chip chain is the collection of a set of account chains.

  • WorkChain: It can also be called a set of fragments with custom rules, such as creating an EVM -based working chain, running a solidity smart contract on it.In theory, everyone in the community can create their own working chain.In fact, building it is a very complicated task. Before that, it had to pay for the creation of its (expensive) cost and obtained 2/3 votes of the verification to approve your work chain.

  • MasterChain: Finally, a special chain in TON is called the main chain. The chain is responsible for bringing the ultimateness to all chip chains.Once the hash value of the section chain is merged into the block of the main chain, the section chain block and all their parent blocks are considered to have the end, which means that they can be considered fixed and cannot beChange content, and reference by the follow -up blocks of all section chains.

By adopting such a paradigm, the Ton network has the following three characteristics:

  • Dynamic shards: TON can automatically split and merge the chip chain to adapt to changes in the load.This means that the new block is always generated quickly, and the transaction will not have a long wait time.

  • Height scalability: Through the unlimited fragment paradigm, TON can support a almost infinite number of shards, which can theoretically reach the 60 -level work chain of 2.

  • Adaptability: When a part of the network in the network increases, this part can be subdivided into more shards to handle the increased transaction volume.Instead, when the load is reduced, shards can be merged to improve efficiency.

So such a multi -chain system first needs to face cross -chain communication issues, especially because of the ability of unlimited sharding. When the number of shards in the network reaches a certain level, the information route between the chain and the chain will become a routing will become the chain.One difficult thing.Imagine that there are 4 nodes on the Internet of the Communist Party of China. Each node is responsible for maintaining 1 independent working chain. The link relationship indicates that in addition to being responsible for the sorting of transactions in its own work chain, the node also needs to monitor and deal with state changes in the target chain.In TON, the message implementation of the output queue is realized,

>

Assume that account A in Working Chain 1 hopes to send a message to the account C in the Working Chain 3.You need to design the problem of message routing. In this example, there are two route paths, the working chain 1 -& gt; working chain 2 -& gt; working chain 3, working chain 1 -& gt; working chain 4 -gt; working chain 3.

When facing more complicated cases, a efficient and low -cost routing algorithm is needed to quickly complete the message communication. TON chose the so -called “Super Cube Routing Algorithm” to achieve cross -chain message communication routing discovery.The so -called ultra -cube structure refers to a special network topology structure. A N -dimensional super cube is composed of 2^n vertices. Each vertex can be uniquely identified by a N -bit binary number.In this structure, if there is only one of any two vertices in the binary representation, they are adjacent.For example, in a 3 -dimensional super cube, vertices 000 and vertices 001 are adjacent because they are only different in the last one.The above example is a 2 -dimensional super cube.

>

In the supercourse routing protocol, the route from the source working chain to the target working chain is performed by the binary representation of the comparative source working chain and the target work chain address.The routing algorithm will find the minimum distance between these two addresses (that is, the number of different bits in the binary representation), and gradually forward the information through the adjacent working chain until it reaches the target working chain.This method can ensure that the data packet is transmitted along the shortest path, thereby improving the communication efficiency of the network.

Of course, in order to simplify this process, TON also proposed an optimistic technical solution. When the user can provide an effective proof of a route path, this is usually a Merkle Trie ROOT.Sex, which is also known as the real -time ultra -cubic route.

Therefore, we can see that the address in TON is obviously different from other blockchain protocols. Most of the other mainstream blockchain protocols use the hash corresponding to the public key generated by the public and private key generated by the public and private key of ellipse and encryption as the address, because the address is only the only one to do the only one.Sexual distinction does not require the function of the route address, and the address in TON is composed of two parts.

There is also a point that is easy to have questions. You may have found that the main chain and each work chain have a link relationship. So, isn’t it enough for all cross -chain information to make a relay through the main chain, just like COSMOS.In TON’s design concept, the main chain is only used to handle the most critical task, that is, to maintain the ultimate nature of many working chains, it is not impossible to make messages through the main chain, but the cost of the procedures generated will be very expensive.

Finally, simply mention its consensus algorithm. TON uses the method of BFT+POS, that is, arbitrary Stake has the opportunity to participate in block packaging. Ton’s election governance contract will randomly select a packaging verified by all stakers every time.The cluster, the nodes selected as the verified person will be packaged through the BFT algorithm. If the error information or evil is packaged, the token of its Stake will be punished, otherwise it will be rewarded.This is basically a relatively common choice, so it is not introduced here.

Smart contract and complete parallel execution environment based on the Actor model

Another point that is different from the mainstream blockchain protocol in TON is its smart contract execution environment.In order to break through the limitations of the mainstream blockchain protocol TPS, TON uses the bottom -up design idea, and uses the ACTOR model to reconstruct the smart contract and its execution method, so that it has the ability to fully execute.

We know that most of the mainstream blockchain protocols use a single -threaded serial execution environment. Taking Ethereum as an example, the execution environment EVM is a state machine that uses transactions as input.After the sorting, the transaction will be executed through the EVM in this order. The entire process will be completely serial and single -threaded, that is, only one is executed at a certain moment.There is consistency in a wide range of distributed clusters. At the same time, only one transaction is executed serially at the same time, which means that in the process of execution, it is impossibleRealize the interoperability between smart contracts.For example, we use USDT to buy ETH through UNISWAP. When the transaction is executed, the transaction is a certain value for the distribution of LP, so that the corresponding results can be obtained through certain mathematical models, but assuming the situation is not like this.When performing the calculation of a Bonding Curve, there are other LP adding new liquidity, so the calculation result will be an outdated result, which is obviously unacceptable.

But this architecture also has obvious limitations, that is, the bottleneck of TPS, and this bottleneck looks very old under the current multi -core processor, just like you use a PC to play some old computer games, such as the Red Police, such as the Red Police, such as the Red Police,When the combat unit is as many as a certain number, the card will still be found. This is the problem of the software architecture.

You may hear that some agreements are already paying attention to this issue and put forward your own parallel plan. Take Solana, which is currently known as TPS as an example, also has the ability to perform parallel execution.However, its design ideas are different from TON. In Solana, its core idea is to divide all transactions into several groups according to the execution dependencies, and no state data is shared between different groups.That is, there is no same dependencies, so that transactions in different groups can be executed parallel without worrying about conflict, and for transactions in the same group, it still uses traditional serial methods.

In TON, it completely abandons the archeological structure of the serial execution, and instead adopts a development paradigm specifically for parallel, and the ACTOR model is used to reconstruct the execution environment.The so -called ACTOR model was first proposed by Carl Hewitt in 1973. The purpose is to solve the complexity problem of the traditional concurrent program through message transmission.Each Actor has its own private state and behavior, and does not share any state information with other ACTOR.The ACTOR model is a computing model of concurrent calculation, which implements parallel computing through message transmission.In this model, “ACTOR” is the basic working unit. It can handle the receiving messages, create new ACTOR, send more messages, and decide how to respond to the next message.The ACTOR model needs to have the following features:

  • Packaging and independence: Each Actor is completely independent when processing messages, and can handle messages in parallel without interfering with each other.

  • Message transmission: Actor interacts only by sending and receiving messages, and message transmission is asynchronous.

  • Dynamic structure: ACTOR can create more ACTOR during runtime, which makes the ACTOR model expand the system as needed.

Ton uses this architecture to design the smart contract model, which means that in TON, each smart contract is an Actor model, which has a completely independent storage space.Because it does not rely on any external data.In addition, the call of the same smart contract is performed according to the sorting of messages in the receiving queue. Therefore, transactions in TON will be executed efficiently without worrying about conflict issues.

However, such a design solution has also brought some new influence. For DAPP developers, its habitual development paradigm will be broken, as follows:

1. Asynchronous calls between smart contracts: Inside TON’s intelligent contract is an atomic call for external contracts or accessing external contract data. We know that in Solidity, the contract B of the contract A is called for contract B in the FUNCTION1 of contract A, or it passes through throughContract C only reads Function3 to access a certain state data. The entire process is atomic and is executed in a transaction. This is a very easy thing. However, in TONThe interaction of the contract will be performed asynchronously through the packaging of new transactions. This transaction initiated by smart contracts is also called internal news.During the execution, it cannot be blocked to obtain the execution results.

For example, if we develop a DEX, if a common paradigm is used in EVM, there will usually be a unified Router contract to manage the route of the transaction, and each pool manages a certain transaction to related LP data.The pool USDT-DAI and DAI-ETH.When the user wants to buy ETH directly through USDT, he can request these two pools in order in a transaction through the Router contract to complete atomic transactions.However, it is not so easy to implement in TON. You need to think about the new development paradigm. If the paradigm is still reused, the information flow may be like this. This request will accompany a user initiated by the user.MESSAGES is done (note that this is used to explain differences, and even the paradigm of ERC20 in real development should be redesigned).

>

2. You need to carefully consider the processing process of executing error during cross -contract calls, and call the corresponding bounter back to each contract.We know that in the mainstream EVM, when the transaction is executed, the entire transaction will be rolled back, that is, it is reset to the initial state of execution.This is easy to understand in the serial single -threaded model.However, in TON, because the call between the contract uses asynchronous execution, even if an error occurs in a subsequent link, because the previous transaction that has been successfully executed has been executed and confirmed, this may cause problems.Therefore, a special message type is set in TON, called the bomb back message, that is, when the follow -up execution process of a certain internal message is incorrect, the triggering contract can trigger the reserved bomb back function reserved by the contract to trigger some of the contract in the contract.Reset some states.

>

3. Under certain complicated cases, the first transaction that is received may not be executed first, so this time -sequential relationship cannot be preset.In such an asynchronous and parallel smart contract call, the definition processing order may be difficult.That’s why each message in TON has its logic time Lamport Time (later referred to as LT).It is used to understand which incident has triggered another and what the verifications need to deal with.For a simple model, the transaction that is received first must be completed first.

>

In this model, A and B represent two smart contracts respectively, and if there is a time order of TX1_LT & LT; TX2_LT if MSG1_LT & LT; msg2_lt.

However, in more complicated cases, this rule will be broken.There are such examples in the official document, assuming we have three contracts A, B, and C.In one transaction, A sends two internal messages MSG1 and MSG2: one is to B, and the other to C.Although they are created in accordance with exact order (MSG1 first and then MSG2), we cannot determine that MSG1 will be processed before MSG2.This is because the routing from A to B and from A to C may be different from the length of the length and the verification.If these contracts are located in different shard chains, one message may require several blocks to reach the target contract.That is, we have two possible trading paths, as shown in the figure.

>

4. In TON, the persistence storage of its smart contract uses a ringless diagram based on Cell as the data structure. The data will be compressed to a cell in accordance with the coding rules.The method extends downward. This is different from the structured tissue based on HashMap in the EVM. Due to the data request algorithm, Ton sets different GAS prices for different depth data processing.The higher the higher, so there is a paradigm of DOS attacks in TON, that is, some malicious users take up a lot of spam messages to occupy all shallow Cell in a smart contract, which means that the storage cost of honest users will become more and morehigh.In EVM, because the complexity of HashMap’s query is O (1), there is the same GAS, and there will be no similar problems.Therefore, Ton Dapp developers should try to avoid unbounded data types in smart contracts.When unbounded data types appear, it should be scattered through a piece.

>

5. There are also some features that are not so special. For example, smart contracts need to pay for rent for storage. In the TON TON, smart contracts are naturally upgraded, and their native abstract account functions, that is, all wallet addresses in TON are smart contracts in smart contracts., But not initialized, these need developers should be careful.

The above is some of the experiences of learning TON related technologies during this time. I shared it with the monarchs. I hope that everyone is correct. At the same time, I think that with the flow resources of the number of TelegramBring some new applications, friends who are interested in Ton Dapp’s development can also contact me and discuss with us.

  • Related Posts

    A pre-provocative death: The money and human nature behind Jeffy’s fake death

    Jessy, bitchain vision Meme in the currency circle has released a new narrative: the death track. On May 6, an obituary of the death of Zerebro Jeffy Yu was released.…

    Binance removed from the shelves but soared. Alpaca dealer’s extreme trading

    Jessy, bitchain vision According to common sense, a token is removed from the exchange, which is a major negative news. However, this rule has not been perfectly reproduced on May…

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    Wall Street Journal: Why did Buffett retire?Who is the next successor?

    • By jakiro
    • May 15, 2025
    • 2 views
    Wall Street Journal: Why did Buffett retire?Who is the next successor?

    Fartcoin’s farts resounded through Wall Street

    • By jakiro
    • May 14, 2025
    • 7 views
    Fartcoin’s farts resounded through Wall Street

    Eight narrative directions and related projects worth paying attention to

    • By jakiro
    • May 14, 2025
    • 9 views
    Eight narrative directions and related projects worth paying attention to

    Bitcoin and cryptocurrencies are occupying Wall Street

    • By jakiro
    • May 14, 2025
    • 11 views
    Bitcoin and cryptocurrencies are occupying Wall Street

    What is the real driving force behind Ethereum’s rise in this round?

    • By jakiro
    • May 14, 2025
    • 11 views
    What is the real driving force behind Ethereum’s rise in this round?

    The inevitability of MEV: On-chain game you can’t see

    • By jakiro
    • May 14, 2025
    • 6 views
    The inevitability of MEV: On-chain game you can’t see
    Home
    News
    School
    Search