Web3新手系列:深入浅出了解TON及其应用

Odaily星球日报Опубліковано о 2024-08-11Востаннє оновлено о 2024-08-11

Анотація

最近TON生态大热,各种TON上的小游戏层出不穷,不知道大家有没有玩过,TON作为一个L1链,它相比于其他的链不同在哪,到底有什么优势,普通人在TON上能做什么。

最近 TON 生态大热,各种 TON 上的小游戏层出不穷,不知道大家有没有玩过。TON 作为一个 L1 链,它相比于其他的链不同在哪,到底有什么优势,普通人在 TON 上能做什么。

Web3新手系列:深入浅出了解TON及其应用

TON 的官方标语

TON 的介绍

TON(The Open Network)是一个去中心化的区块链网络,它诞生的目的是为了服务 Telegram 以亿为量级的用户,超高并发的交互需求的。大家熟知的链比如 BTC,十分钟出一个块,并且在一个块里面的交易数量是有上限的,显然是无法满足 Telegram 的要求,因此 TON 就应运而生。TON 目前可以处理每秒数百万笔交易

TON 背靠着 Telegram 海量的用户群体,配合上 Telegram 推出的小程序框架,让 TON 有巨大的想象空间,也吸引了无数淘金人前来淘金。相比于之前的通过 WEB3 来扩展 WEB2 的用户群体,通过 Telegram 为媒介,以 WEB2 的方式让用户接触 WEB3,TON 似乎是走在了另一条道路上。

TON 技术上的特点

TON 技术上最大的技术特点就是高并发、高效率、可扩展。当然这似乎是每一个新链的标配了,那 TON 到底是如何做到的。

我们以 ETH 为例,在出块节点完成打包区块对交易进行排序之后,输入到 EVM 中进行处理,整个过程是一个 串行 的过程。这么做的好处是,结果是确定的,在处理一笔交易的时候不会有其他交易对状态进行变更,可以保证一致性。但是坏处也显而易见,TPS 会比较低。

TON 抛弃了串行执行的过程,采用了完全并行的架构进行。这里就需要解决两个关键问题:如何并行以及如何如何保证状态一致。

基于 Actor 的并行环境

TON 中的基本单元是 Actor,你可以理解为是 ETH 中的智能合约。Actor 是 TON 可以执行完全并行的一个基础。TON 中没有区分账户和智能合约的概念,全部的对象都是 Actor,你的账户也是一个合约。Actor 有一定的逻辑执行能力以及数据存储能力,在一次交易的过程中,Actor 会执行以下几个步骤:

  • 事件触发(一般来说是收到了外部消息,如转账)

  • 执行合约的方法处理这个事件

  • 更新合约的状态

  • 发出消息(可选)

  • 进入静默状态,等待下一个事件发生

可以看到这样处理之后,每一次交易都是并行独立的处理,每一次处理完都可以异步地发出消息来和其他的 Actor 进行交互。每个 Actor 会独自维护自己的状态,所以你会发现你在 TON 上的 Jetton(Token)会有一个独立的地址,因为 Jetton 的数量这个状态不会和你的 TON 数量在同一个 Actor 中维护。

为了好理解并且符合大家以往的认知,Actor 可以理解为钱包或者合约,消息的传递可以为合约的交互,大家只需要知道原本的意思即可。

分片

分片(shard)是 TON 中的一个关键机制,它保证了 TON 上的可扩展性。分片机制简单来说就是「动态」地调整一个节点处理交易的量,比如某一时刻进来过多的交易,这些交易会被分成几个「子集」,分给不同节点并行处理,反之,则合并交易量较小的「子集」为一个分片。

引用来自官网的一张图,解释了分片的过程:

Web3新手系列:深入浅出了解TON及其应用

其中按照黑虚线划分了区块,其中 101、 102、以及 103 是在一个区块里的同一条分片链上, 80 是在另一个分片链上,他们都是从 100 这个节点进行「分片」得到的;在 30 这个区块里面, 63 和 105 这两个节点由于交易量较少,在 31 这个区块中被合并成一个,即 106 。

以上知识笼统得介绍了整体的流程,下面介绍一下图中各个元素的具体含义。

1、账户链(AccountChain)

在 TON 中,一个账户对应的一系列交易按照一定的顺序组成一条链被称为账户链。在区块链中,保持执行的逻辑不变、交易的顺序不变,那么最后得到的状态也是一致的。不同的账户链可以被并行处理。

账户链并没有在上图中体现。

2、分片链(ShardChain)

分片链对应的就是上图中的数字节点。分片链由多个账户链组成,选取哪些账户链进行组合没有特别的要求,一般是取账户的前几位一致的作为合并的标准。多个分片链在一个区块中,可以由不同的节点进行并行处理。分片链是 TON 分片机制的执行单元,分片的操作主要在分片链上执行。

总结一下就是:账户链组成分片链,分片链组合为一个区块。

3、工作链(WorkChain)

分片链需要工作在工作链上,也就是上图中的蓝色线。工作链是一组有自己规则的区块链,每个人都可以在工作链上部署一条自己设置规则的链,只需要有 2/3 的验证者同意。TON 允许创建多达「 2 ^ 32 」个工作链,每个工作链则可以细分为多达「 2 ^ 60 」个分片。

目前 TON 上只有两个链,「 Basechain 」 以及「 Masterchain 」。工作链有些像 L2 的概念,有消息称会有一条新的工作链,来支持 EVM,这也是 TON 可扩展的一个体现。

4、主链(MasterChain)

TON 上可以有多条工作链,但是只有一条主链,主链的主要功能就是同步不同工作链的信息,达成状态上的共识。达成共识的方式也还是通过消息传递的方式,但是主链和工作链的消息传递费用较高,因此只会同步区块的关键信息。

在上图中也就是黑线描述的部分

错误回滚

在串行的场景下,如果发生了错误,那么交易的状态会被回滚。在并行的场景下,回滚是通过内部消息回弹的方式进行的。TON 里的智能合约交互是通过消息传递的,因此需要对这类消息(内部消息)设置可以弹回。在发生错误的时候,原始的消息将弹回消息,携带剩余的 TON 信息并且设置标志位为「 bounced 」。Actor 接受到弹回消息之后,进行错误处理。

总结

TON 通过使用 Actor 模型,让每个状态可以独立地处理而不需要依赖其他的状态,从而实现完全并行。通过分片机制,使得 TON 可以动态调整以适应链的交易数量变化。TON 的这一套机制,复杂但是高效,其中还有一些技术细节比如逻辑时间、消息传递等,就不再消息介绍了。

体验 TON 时的一些细节

如果你在此之前,只体验过 BTC 或者 ETH 的话,在体验 TON 的时候,会有一些地方不同。

1、TON 的账户模型

在之前的内容中有介绍到,TON 既没有使用 BTC 的 UTXO 模型,也不是 ETH 里面的钱包模型,你的钱包也是一个「合约」。我们知道,部署合约是需要支付 Gas 费用的,但是我们新建钱包的时候,并没有资金在里面,那这个 Gas 如何支付?

其实在创建 TON 钱包的时候,你的钱包并没有完成创建,只有当你有交易(别人给你转 TON)的时候,你的钱包才会初始化,并扣除一部分的 TON 作为合约部署的费用,这也就是你会发现,明明转了 10 TON,但是只收到 9.99 TON 的原因。

2、TON 的 Jetton 交易

根据上面关于 Actor 的介绍,每一个 Actor 维护独立的状态,这个状态不依赖外部的状态。因此在 TON 上的 Jetton,并不是存储在你的 TON 钱包里面,而是一个独立的地址,链接到你的 TON 钱包里面。

比如下图中的 Jetton,它在 TON 上有自己的地址「 Jetton wallet 」,但是会和 TON 钱包「 Holder address 」链接起来。

Web3新手系列:深入浅出了解TON及其应用

3、TON 的 Gas 费计算

TON 和大部分其他的链一样,在交易、部署合约、合约交互的时候需要支付 Gas 费用。不过实践操作下来,TON 的交易费还是比较贵的,比如一次 Jetton 在 DEX 的交易可能需要 0.05 TON,这个相比于一些链来说并没有优势。

除此之外,TON 还需要支付存储费用,所以如果你的钱包长时间没有交易,那么可能你的下一笔交易的 Gas 费就会高出来不少。

具体的 Gas 费细节可以在 Transaction Fee 中查看。

4、TON 的钱包类别

TON 的钱包也有多个地址,这个和 BTC 有点像。TON 的不同地址代表了钱包的版本不同,不同版本的钱包实现的功能也会有所不同。目前使用最多的钱包是「 V4 R 2 」,最近也推出了「 W 5 」钱包,可以支持用其他代币支付 Gas 费用。

Web3新手系列:深入浅出了解TON及其应用

在 TON 上我们能做什么

目前在 TON 的热度很大一部分来自于 Telegram 上的机器人以及在机器人之上的小程序。尤其是最近一些游戏小程序的井喷式爆发,给一些 WEB3 项目带来了巨大的流量。

Telegram 上的小程序

依附于 Telegram 上可以做小程序了,让人仿佛回到了微信小程序井喷的时候。不过 TG 上的小程序主要是一些小游戏,并且质量参差不齐,大家去玩的唯一动力就是期待项目方最后可以发空投。项目方利用这种飘渺的期待,可以在短时间内吸引大量的用户。

除了通过在游戏中通过做任务拉用户来实现裂变,还有一些工具类的小程序可以提供拉用户的能力,比如 TG 上的一个红包应用,通过发红包的方式来打广告,实现拉用户。

创建一个 TON 上的网站

大家可能都听说过域名解析。在 ETH 中,你可以购买一个域名,来代替那一长串复杂的地址,这就是 WEB3 的域名解析。在 TON 中,你除了通过购买 TON 的域名来代替你的地址,你真的可以通过这个域名,搭建一个网站来让别人访问,实现域名最原本的功能。

域名其实是一个 NFT,你可以交易你的域名,就跟交易 NFT 一样。域名的价格跟域名的长度相关,最便宜的域名需要 1 个 TON。具体的信息可以在 TON 的官方域名 网站中查看。

机器人

机器人和 TON 的关系不大,但是跟 Telegram 关系比较密切,所以也在这里提一下。TG 上有大量的机器人,用于交易的查看、监控、快速交易等功能,每次的交互会收取手续费,大概在 1% 左右。每天在 TG 上发起的交易巨大,并且各种链的机器人都有,包括 SOL、ETH 以及 TON 等等。

不过现在这块的竞争也是比较激烈,并且将私钥交给一个代码不公开的机器人管理,总让人有点不放心。

本文由 ZAN Team(X 账号 @zan_team) 的 Yeezo(X 账号 @GaoYeezo 75065 )撰写。

Пов'язані матеріали

The "Impossible Triad" Is Fundamentally a Pseudo-Problem

The article argues that blockchain's fundamental limitation is not the scalability trilemma (decentralization, scalability, security), which has been largely solved, but the lack of **privacy** and, until recently, clear **legitimacy**. Blockchain is described as a slow, expensive, globally shared computer whose core value is censorship resistance and verifiability. While ideal for native digital assets like money (e.g., stablecoins), its default transparency acts as a **tax**, exposing all transactions and enabling MEV extraction, which deters serious institutional capital. Simultaneously, its permissionless nature created regulatory ambiguity. The piece contends that **privacy** is the missing critical feature. It rejects the false choice between total transparency and complete anonymity. Modern cryptography (like zero-knowledge proofs) enables **compliant privacy**: users can prove facts (solvency, KYC status, compliance) without revealing the underlying sensitive data (specific holdings, identities). This preserves auditability for regulators and eliminates the leak of financial information. With recent regulatory progress (e.g., the GENIUS Act) addressing legitimacy, adding default, provably compliant privacy becomes a pure upgrade. It transforms blockchain from a costly, public ledger into a confidential settlement layer, finally bridging the gap to mainstream institutional and individual adoption of on-chain finance.

链捕手7 год тому

The "Impossible Triad" Is Fundamentally a Pseudo-Problem

链捕手7 год тому

Optical Chips: Collective Capacity Expansion

The global optical chip industry is experiencing a massive wave of expansion driven by surging AI data center demand. Major players across the US, Japan, Europe, and China are aggressively investing to ramp up production capacity. In the US, Coherent is expanding its 6-inch Indium Phosphide (InP) semiconductor fab in Texas, supported by CHIPS Act funding and a $2 billion strategic investment from NVIDIA. Lumentum is building a new factory for InP optical devices, and Nokia is scaling its advanced photonic chip packaging and testing capabilities. NVIDIA's investments aim to secure future supply of critical lasers and optical interconnect products for AI infrastructure. Japan's JX Advanced Metals, a leading InP substrate supplier, plans a multi-billion yen investment to increase its capacity 7-10 times, strengthening its grip on the crucial upstream materials market. In Europe, IQE and Tower Semiconductor settled a patent dispute and signed a multi-year InP epitaxial wafer supply agreement, highlighting that next-generation silicon photonics platforms will integrate high-performance InP components. STMicroelectronics and Sivers Semiconductors are also expanding silicon photonics production and partnerships. China is rapidly building out its domestic supply chain. Dongshan Precision's subsidiary, Source Photonics, announced a $12 billion project to expand optical chip and module production. Companies like Sanan Optoelectronics and Yunnan Germanium are scaling up InP chip manufacturing and substrate production, moving towards vertical integration from materials to modules. While debate continues around the exact future architecture—whether CPO (Co-Packaged Optics), NPO, or pluggables will dominate—analysts like Morgan Stanley argue the underlying driver is unchangeable: the explosive growth in bandwidth demand. This will inevitably increase the volume of optical engines, lasers, and related content per GPU, regardless of the final technical path. The competition for "more light" in the AI era has intensified into a global, full-chain capacity race.

marsbit10 год тому

Optical Chips: Collective Capacity Expansion

marsbit10 год тому

Stablecoins Finally Find Real Yield: An In-Depth Look at On-Chain Reinsurance Re | A Conversation with Re Founder Karan Saroya

Stablecoin Real Yield Found: A Deep Dive into On-Chain Reinsurance with Re's Karan Saroya As stablecoin supply exceeds $170 billion, the search for sustainable, non-speculative yield intensifies. Re, an on-chain reinsurance platform, provides an answer: connecting stablecoin capital to the trillion-dollar traditional reinsurance market. Re operates as a regulated reinsurer, accepting stablecoin deposits as collateral to back US insurance companies. These insurers pay premiums, generating yield that flows back to on-chain depositors. Currently supporting 35 insurers and underwriting $500 million, Re projects scaling to over $1 billion soon. Key insights from a Bankless podcast with founder Karan Saroya and investor Avichal of Electric Capital: 1. **Uncorrelated, Real-World Yield:** Re offers stablecoin holders access to reinsurance returns (targeting 12-14%+), an asset class entirely separate from crypto or equity markets. 2. **Operational Efficiency via Smart Contracts:** Re replaces traditional, labor-intensive capital fundraising with smart contracts, allowing a ~12-person team to compete with industry giants. 3. **Regulatory Leverage:** For every $1 of collateral, regulations allow backing $5-7 in written premiums. This leverage amplifies returns from the underlying risk-free rate. 4. **DeFi Integration:** Depositors receive receipt tokens, which can be used in protocols like Morpho for "looping," potentially pushing yields to 18-20%+. 5. **The "DeFi Mullet" Model:** A compliant front-end (regulated reinsurer) paired with a decentralized back-end (smart contracts, DeFi capital markets). 6. **RE Governance Token:** Modeled on Lloyd's of London, the token governs the central capital pool's allocation, counterparty acceptance, and parameters. 7. **Real Economic Impact:** Capital funds real-world productivity (factories, clinics, businesses) via insurance, moving beyond crypto's internal loops. The discussion highlights a pivotal moment: DeFi's supply-side infrastructure is now met by real demand for productive yield, potentially kickstarting a flywheel where vast on-chain stablecoin capital seeks these real-world returns.

链捕手11 год тому

Stablecoins Finally Find Real Yield: An In-Depth Look at On-Chain Reinsurance Re | A Conversation with Re Founder Karan Saroya

链捕手11 год тому

1996 or 1999? Walsh's First Test is 'How to View AI'

"1996 or 1999? Wall's First Big Test Is 'How to View AI'" Federal Reserve Chairman Wall's initial challenge is not whether to raise or cut rates, but a more fundamental judgment: what kind of boom is the current AI boom? This will determine the Fed's policy path and define his legacy. Economics is split between two opposing views, according to reporter Nick Timiraos. One sees imminent productivity gains that will increase supply and cool inflation, allowing the Fed to hold steady. The other argues that while productivity benefits are distant, demand shocks are here now, and waiting for data confirmation risks missing the intervention window, forcing sharper rate hikes later. Wall has signaled a leaning toward the first view, echoing 1996-era Alan Greenspan, who embraced strong, productivity-driven growth without fear of inflation. However, Wall faces a different macro environment than Greenspan did, with tariff pressures, expanding fiscal deficits, and diminishing globalization benefits, which could force more significant inflation pressures even if AI benefits materialize. Wall's logic, expressed before taking office, is that AI-driven productivity gains won't show in official data for years. If the Fed waits for confirmation, it might mistakenly tighten policy and choke off the very growth that could suppress inflation. This argues for using forward-looking narratives over lagging data. Chicago Fed President Austan Goolsbee presents a key counter-argument. He distinguishes between expected and unexpected productivity booms. A widely anticipated boom, like the current AI wave, can cause people to spend future wealth gains in advance, overheating the economy before productivity actually rises, thus requiring preemptive rate hikes. He cites rising costs for AI data centers as evidence of such overheating. Fed Governor Christopher Waller offers a rebuttal to Goolsbee, noting the "expected spending" mechanism only works if people can borrow against future income, which many households cannot do due to borrowing constraints. Wall also faces a paradox related to his desire to reduce the Fed's use of "forward guidance" (pre-announcing policy moves). This practice was established in 1999 when Greenspan began signaling hikes to avoid market shocks. If the economy follows a less optimistic path, Wall may be forced to choose between using the guidance he wants to abolish or risking market volatility by staying silent. The ultimate question defining Wall's first major test remains: Is this 1996 or 1999?

marsbit12 год тому

1996 or 1999? Walsh's First Test is 'How to View AI'

marsbit12 год тому

Торгівля

Спот
Ф'ючерси
活动图片