PKU BLOCKCHAIN:一文读懂TON技术方案

币圈资讯 阅读:39 2024-04-22 11:48:14 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

作者:北大区块链协会 Kiwi 来源:X,@KiwiCryptoBig

Keytakeaways

TON 拥有以高速应用为核心的技术逻辑:TON 诞生于 telegram,交易基于 message 直接上链,支持点对点;

  • 异步 message 传递:由于选用 FunC 作为函数开发语言,TON 中各节点传递通过传递“message”通讯,但 TON 是异步链,因此为了正确同步链间 message 引入了逻辑时间(It)的概念,通过保证 message lt 严格按照先后顺序执行来保障信息的正确执行;

  • 超立方体的 message 路由机制:TON 采用普通路由+快路由的方式,普通路由通过立方体结构通过相邻节点传递分片间 message,快路由加入了可以沿超立方体边缘传递的 Merkle 证明来中继 message 提升速度;

  • PoS +BFT 共识便于生态发展:POS 避免了出块过程中的大量计算,效率更高成本更低,网络性能更好,利于 DAPP 应用落地;同时虽然 DPOS 更快,但是信任速度比 BFT 系统慢,因此 TON 选用 BFT。

TON 的动态多分片架构便于应用的 Scalability:TON 通过并行查询提升速度,通过动态分片提升查询准确度,通过 bag of cells 提升拓展性;

  • 动态多分片架构:TON 有三层,单条 masterchain+ 多个 Workchain+可动态增减和拆分的 shardchain,每个分片链是各种账户链的集合,DAPP 可以自主激活某条分片链;

  • 可快速更新的全局状态:通过类似 DAG 的“bag of cells”结构更新全局状态,通过联立新旧两组 cells 并删除旧 root 快速更新。同时采用垂直区块修复更新区块。

TON 未来将继续优化技术框架:通过并行拓展、推出链分片工具、加强节点检查等机制持续推进 TON 的速度和可拓展性优势。

区块链扩容难题

区块链扩容是重要的技术难题,是推动区块链技术发展的关键之一:随着区块链应用的不断增长和用户数量的增加,现有的区块链网络往往面临着吞吐量不足和交易确认时间长的问题。传统的区块链设计限制了其在处理大规模交易和用户需求方面的能力,这导致了网络拥堵、高交易费用和低效率的情况;

区块链扩容的挑战主要源于分布式架构和共识机制:首先区块链的共识机制和分布式性质使得在网络中的每个节点都需要对所有交易进行验证和记录,这导致了网络的吞吐量受限。其次区块链的安全性和去中心化特性要求所有节点都要保持完整的区块链副本,这增加了存储和传输的负担;

为了解决区块链扩容难题,研究者们提出了各种扩容方案:如分片(Sharding)、侧链(Sidechains)、二层方案(Layer 2 solutions)等,这些方案试图通过将网络分割成多个较小的部分、引入独立的区块链或在主链上构建额外的结构来提高网络的吞吐量和性能。然而,这些方案也带来了新的技术挑战和安全性问题,如分片间通信、跨链资产转移和共识机制设计等。

  • 分片:基本思想是将整个区块链网络分割成多个较小的片段(或称为分片),每个分片可以独立地处理一部分交易和数据。通过将交易和数据分散到不同的分片中,分片机制可以提高整个网络的吞吐量和性能。但仍面临着分片间通信和跨分片交易的安全性和一致性问题,此外,分片机制还需要解决共识机制的设计和实现,以确保整个网络的一致性和安全性;

  • 侧链:侧链技术是一种在区块链网络中创建并运行与主链(主要区块链)相互连接的独立区块链的方法。侧链可以与主链进行双向的资产转移,同时具有自己的独立规则和功能。侧链技术的基本原理是通过将一些交易从主链转移到侧链上进行处理,从而减轻主链的负担,并提供更高的扩展性和灵活性。但侧链需要与主链进行双向的资产转移,这需要一定的安全机制和协议来确保资产的安全性和一致性。此外,侧链的设计和实现需要考虑与主链的兼容性和互操作性;

  • Rollup:基本原理是将大量的交易数据存储在链下的侧链中,然后将这些交易的摘要信息提交到主链上进行验证。其优势在于它可以显著提高区块链网络的扩展性和性能,通过将交易数据存储在侧链上,并使用主链进行验证,Rollup 技术可以大大减少主链上的存储和计算负担。但也有中心化和安全性的顾虑;

  • 新共识机制:如 Solana 的 POH,通过将时间戳与每个交易相关联,为区块链提供了一种可验证的时间序列。这种时间序列可以用来验证交易的顺序和时间,从而减少了共识过程中的通信成本和延迟。虽然 Solana 称其 TPS 可以达到 65, 000 ,但实际上大部分 TPS 是作为节点间的通信,真正数据上限只有 6-8 k(日常 4-5 k)。

TON 区块链源于 Telegram,初始设立理念就是服务大量用户:Telegram 是全球最受欢迎的社交平台之一,月活用户超过 8 亿,每天软件内传输数百亿条消息。TON 作为 telegram 的 web3 转型,其设计理念从一开始就基于服务数十亿用户而不仅仅只满足于少量用户。

TON 的技术架构

自适应无限分片多链设计

TON 的分片是自下而上的:区块链分片方案普遍采用自上而下的方式,即先建立单一的区块链,然后将其分解为若干交互式的区块链,以提升性能。然而,TON 分片方案采取了一种自下而上的方式:将这些账户链组织成碎片链(Shardchain),使得账户链(Workchain)在分片链中仅存在纯粹的虚拟或逻辑形式。TON 实现了多条链并行处理交易,被称为“blockchain of blockchains”。通过这种方式,可以有效提高系统性能;

TON 的是动态分片架构:分为 masterchain、workchain 和 shardchain。masterchain 负责协调,各个 workchain 和 shardchain 进行实际的交易处理。此外,TON 的分片是动态的,每个账户作为一条 Shardchain,可根据账户间的交互关系自适应组合成更大的 Shardchain 来应对动态扩展的需求。

  • Masterchain:仅有唯一一条,包含协议的参数、Validators 集合以及对应的 share,记录当前工作的 Workchains 及下属 Shardchains。下层链将最新区块哈希提交至 Masterchain,以确保在需要发生跨链消息读取时能确定最新状态。

如果分片已达到极限,那么最后每个分片链会仅保存一个账户或智能合约。这将导致大量描述单一账户状态和状态转换的“账户链(account-chains)”,这些账户链相互进行信息传输,即由 Shardchain 构成 Workchain。

  • Workchain:是作为 Shardchains 集合存在的一个虚拟概念,系统最高可容纳 2 ^ 32 条 Workchains。每条 Workchain 在满足互操作性标准的前提下,可灵活自定义规则,如交易类型、代币类型、智能合约、地址形式等。但 Workchain 必须有相同的消息队列格式,便于其交换消息,当然这也意味着所有 Workchain 必须具有大致相同的安全保证;

  • Shardchain:为提升处理效率,能在负载变高时自动分裂、在负载下降时合并链,每个 Workchain 会进一步分割为分片 Shardchains(最高 2 ^ 60)。Shardchain 将工作分摊到所有的 Shardchains 中,每条 Shardchain 仅服务部分账户集合。

PKU BLOCKCHAIN:一文读懂TON技术方案

信息传递机制

Message:由于 TON 使用 FunC 的 send_raw_message函数开发语言,因此 TON 各节点传递的称为“message”。在 TON 中的交易由最初触发它的入站消息和一组发送到其他合约的出站消息组成;

Hypercube Routing:立体结构的信息传递机制,能使一个分片链区块中创建的消息迅速传递和处理至目标分片链的下一个区块中。

异步的 message 传递

异步调用有同步问题:在同步区块链中,交易可包含多个智能合约调用。而在异步系统中,用户无法在同一交易中即时获取目标智能合约的响应,因为合约调用可能需要数个块的时间来处理,源块和目的块之间的路由长度将会影响这一进程;

为了实现无限分片,必须确保 message 完全并行化,进而引出逻辑时间:在 TON 中,每笔交易仅在单个智能合约上执行并通过 message 进行智能合约间通信。因此引出在异步链中使用的逻辑时间概念,以实现链间消息同步,即每条消息都有其逻辑时间或 Lamport 时间(以下简称为 lt)。此时间用于追踪事件之间的关系,以及验证器需要首先处理的事件;

message lt 将严格按照先后顺序执行来确保操作逻辑:从一个帐户发送的消息和在一个帐户上发生的交易会被严格排序,产生的事务的 lt 大于消息的 lt,在某个事务中发送的消息的 lt 严格大于引发该消息的事务的 lt。此外,如果存在多条消息,那么将会更早处理 lt 较低的消息。

Message 超立方体路由机制:

TON 采用快路由 + 慢路由并行运行:

慢路由:更稳定且传统的跨链信息处理方法,信息在源链上被打包到一个区块中,再通过中继器(relayer)从一个分片链传递到另一个分片链,也可使用多个中间分片链进行传输。让所有的分片链构成一个 “hypercube” 图形,消息将沿着这个超立方体的边缘传播,信息经过验证者验证后打包到另一个区块中;

慢速路由优势在于更高的安全性和去中心化程度,因为所有信息需要经过完整的区块确认过程。对于一个规模为 N 的分片链超立方体网络,需要经过的路由条数 hop = log 16(N)。因此,只需要 4 个路由节点,就能支持百万级的分片链。

快路由:慢路由中消息沿着超立方体的边缘传播,为了提速,快路由可以让消息的目的分片链所属的的验证器提前处理这条消息,再提供一个 merkel 证明,并发送回执来销毁掉这条正在传输的消息;

快路由速度更快(节点可找到最优路径),也能防止双重传递,但并不能取代慢速路由,因为验证人不会因为丢失 receipt 受到惩罚,因此有一定安全性风险

分片链的全局状态

“bag of cells” :通过类似 DAG 的形式更新的一组 cells。通过将新状态表示为具有其自身根的另一个 “bag of cells”,然后联立新旧两组 cells,同时删除旧的根;

垂直区块修复:TON 分片链中的每个区块实际不只有一个区块,而是一条链,当需要修复错误分片链的区块时,一个新的区块将会提交到“垂直区块链”并对它进行区块的替换。

共识机制

POS 网络中存在 3 个角色:

  • 验证节点:满足硬件条件后质押 300 000 TON 即可参与维护网络安全;

所有区块由 100 ~ 1000 个选定的节点创建,节点每月选举一次,并需要在选举时封存质押的 TON Coin。任职期间选定的节点将被划分成多个工作组来创建新区块,每个新区块拿到工作组超过 2/3 的质押节点的签名即算创建成功,若作恶则会 slash 并剥夺资格;

  • Fisherman:通过发送无效证明检测验证节点是否尽职完成验证任务,可看作是监督者的角色;

  • 校对人:它向验证人建议新的分片链候选区块,若区块当选则校对人获利。它负责校对该分片链的状态和邻近分片链的数据并发送给验证节点。

BFT:TON 经过权衡,发现虽然 DPOS 更快,但是它的信任级别和速度都比 BFT 系统慢,因此最终选择 BFT(Byzantine fault tolerance)。

TON 的新框架可以支撑起 TG 的高速信息传递

TON 通过动态多分片架构实现高速交易速度和  finality:TON 可以为每个用户钱包创建一条链,分片的并行计算、支持瞬间跨分片交流和 TVM 支持异步计算构成了其高 TPS 的理论基础;

TON 通过信息传递机制带来更高的可扩展性:在 TON 区块链中,智能合约之间的调用是异步的,而不是原子的。这意味着当一个智能合约调用另一个智能合约时,该调用不会立即执行,而是在交易结束后的某个未来区块上被处理,这种设计允许更高的可扩展性,因为它不需要在一个区块中完成所有的交易处理。

TON 未来将继续优化技术框架...

TON roadmap 技术部分将持续推进 TON 的速度和可拓展性优势

  • 排序器和验证者分离;

  • 可拓展性和速度提升:让 TON 在处理大量事务的情况下实现并行扩展;

  • 链分片指南和工具:在交易所、支付系统和 TON 服务中组织高负载 TON 工作的指南和代码示例;

  • 加强验证者节点间的协调性:加强并改进对表现不佳的验证者的检测和惩罚;

只代表个人意见,不代表任何投资建议。DYOR。


The author of Peking University Blockchain Association has the technical logic with high-speed application as the core, which was born in the transaction. It supports point-to-point asynchronous transmission based on direct winding. Because it is selected as the function development language, each node passes through the communication, but the asynchronous chain introduces the concept of logical time to correctly synchronize the chains, and ensures the correct execution of information by ensuring strict execution in sequence. The routing mechanism of hypercube adopts the way of ordinary routing and fast routing, and ordinary routing passes through the cube structure. The fast route between fragments is transmitted by neighboring nodes, and the proof that it can be transmitted along the edge of hypercube is added to relay the consensus of speed improvement, which is convenient for ecological development, and avoids a lot of calculation in the process of blocking. The efficiency is higher, the cost is lower, the network performance is better, and the application landing is better. At the same time, although it is faster, the trust speed is slower than the system. Therefore, the selected dynamic multi-fragment architecture is convenient for application, and the speed is improved by parallel query, and the query accuracy is improved by dynamic fragmentation. There are three dynamic multi-fragment architectures. Each fragmentation chain that can be dynamically increased, decreased and split is a collection of various account chains. A fragmentation chain can be activated independently, and the global status can be quickly updated through a similar structure. The global status can be updated through the simultaneous establishment of old and new groups and the deletion of old rapid updates, while the vertical blocks are used to repair and update the blocks. In the future, the technical framework will continue to be optimized, and the mechanism such as node checking will be strengthened through parallel expansion. The speed and scalability advantages of blockchain expansion are difficult. It is an important technical problem and one of the keys to promote the development of blockchain technology. With the continuous growth of blockchain application and the increase of the number of users, the existing blockchain network often faces the problems of insufficient throughput and long transaction confirmation time. The traditional blockchain design limits its ability to handle large-scale transactions and user needs, which leads to network congestion, high transaction costs and inefficiency. The challenge of blockchain expansion mainly comes from the distributed architecture and consensus mechanism. First of all, the blockchain is common. The cognitive mechanism and distributed nature make every node in the network need to verify and record all transactions, which leads to the limited throughput of the network. Secondly, the security and decentralization of blockchain require all nodes to keep complete copies of blockchain, which increases the burden of storage and transmission. In order to solve the problem of blockchain expansion, researchers have put forward various expansion schemes, such as the two-tier scheme of segmented side chains, which try to introduce independence by dividing the network into multiple smaller parts. Establish blockchain or build additional structures on the main chain to improve the throughput and performance of the network. However, these schemes also bring new technical challenges and security issues, such as inter-fragmentation communication, cross-chain asset transfer and consensus mechanism design. The basic idea of fragmentation is to divide the whole blockchain network into several smaller fragments or called fragmentation, and each fragment can handle a part of transactions and data independently. By dispersing transactions and data into different fragments, fragmentation mechanism can improve the whole network's swallowing. Throughput and performance, but it still faces the security and consistency of inter-fragmentation communication and cross-fragmentation transaction. In addition, fragmentation mechanism also needs to solve the design and implementation of consensus mechanism to ensure the consistency and security of the whole network. Side chain Side chain technology is a method to create and run independent blockchains interconnected with the main blockchain in blockchain network. Side chains can transfer assets with the main chain in both directions and have their own independent rules and functions. The basic principle of side chain technology is through Transfer some transactions from the main chain to the side chain for processing, so as to reduce the burden of the main chain and provide higher expansibility and flexibility. However, the side chain needs to transfer assets with the main chain in two directions, which requires certain security mechanisms and protocols to ensure the security and consistency of assets. The design and implementation of the outer chain need to consider the compatibility and interoperability with the main chain. The basic principle is to store a large amount of transaction data in the side chain under the chain and then submit the summary information of these transactions to the main chain for processing. The advantage of verification 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 technology, the storage and calculation burden on the main chain can be greatly reduced, but there are also concerns about centralization and security. The new consensus mechanism, for example, provides a verifiable time series for the blockchain by associating time stamps with each transaction, which can be used to verify the order and time of transactions, thus reducing the communication in the consensus process. Although the cost and delay can be achieved, in fact, most of them are the real data upper limit of communication between nodes. Only the daily blockchain originated from the initial establishment concept, which is to serve a large number of users. It is one of the most popular social platforms in the world, with more than 100 million monthly users and tens of billions of messages transmitted in the software every day. Its design concept is based on the technical architecture of serving billions of users from the beginning, and it is not only satisfied with a small number of users. The fragmentation of the multi-chain design is from the bottom up. Blockchain fragmentation schemes on the Internet generally adopt a top-down approach, that is, first establish a single blockchain and then decompose it into several interactive blockchains to improve performance. However, the fragmentation scheme adopts a bottom-up approach to organize these account chains into fragmentation chains, so that account chains only exist in a purely virtual or logical form in the fragmentation chain, realizing the parallel processing of transactions by multiple chains. It is said that this way can effectively improve the system performance. The dynamic fragmentation architecture is divided into and responsible for coordinating various. In addition, the fragmentation is dynamic, and each account can be adaptively combined into a larger one according to the interaction between accounts to meet the needs of dynamic expansion. Only one piece contains the parameter set of the protocol and the corresponding lower-level chain that records the current work, and submits the latest block hash to to ensure that the latest state can be determined when cross-chain message reading is needed. If the fragmentation has reached the limit, only one account or intelligence will be saved in each fragmentation chain in the end. This will lead to a large number of account chains that describe the state and state transition of a single account. These account chains transmit information to each other, that is, they are composed of a virtual concept system that exists as a set. Each one can flexibly define rules such as transaction type, token type, smart contract address form, etc. on the premise of meeting interoperability standards, but it must have the same message queue format to facilitate the exchange of messages. Of course, this also means that all of them must have roughly the same security guarantee. In order to improve processing efficiency, they can be automatically split when the load becomes high, and each merge chain will be further divided into the highest slices when the load decreases. 比特币今日价格行情网_okx交易所app_永续合约_比特币怎么买卖交易_虚拟币交易所平台

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=62456

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友