快速上手了解智能合約(NFT標準) | TON Blockchain, TEP62

Ton101 | 區塊鏈 TON Blockchain
20 Aug 202310:19

Summary

TLDR大家好,我是霍华德。在上周的工作坊后,一些人私信我询问关于NFT的问题。今天我们将快速录制一个视频,帮助大家理解Tact语言的结构以及如何理解这个NFT合约。首先,让我们回顾一下我们的报告,我会在视频底部发送链接,你可以直接用你的本地IDE打开数据。在开始之前,我想先介绍它的通信方式。首先,你需要有一个自己的TonKeeper钱包,或者任何一个你通用的钱包。它本身是一个合约,发生在其中的铸造交易将是你发送消息给NFT集合的合约,然后它会生成一条消息并发送给NFT项目,这意味着如果你以Azuki为例,你可能有10,000个Azuki,最终你将有10,001个智能合约地址,这与我们熟悉的以太坊非常不同。理解了基本概念后,我们可以回到上面查看代码。首先,我们汇聚了代码的几个范围,你可以清楚地看到关键字“合约”代表什么。第一个是集合合约,第二个合约将是项目合约。这与我们熟悉的以太坊NFT结构也不同。我们可以一步步解释。一个常见的整数,一个共同的常量,所以它被称为常量,对吧?然后我们可以标准化TON这个词,并说它是0.03。至于为什么我们选择存储这两个数据,因为TON合约有一个特殊的余额来支付这个合约的存储费用。成本就是这样,但我们可以在未来提到细节。在我们扩展了集合合约之后,你可以看到它非常基础。显然这是一个集合,有点像这个合约的数量。它是最基本的,从最大的合约开始,父合约,它存储一些常规参数。例如,它现在有几个铸造ID,所以它的ID和索引实际上是一个ID。它从0开始,增加到你设置的数量。上限,第二个是你的所有者是谁,第三个是你的版税费用参数。我们在这里设置了一个数据类型,这是数据的类型。我们可以稍后调用这个东西。事实上,Tact支持自定义数据结构。让我们继续。你需要使用一组URL链接,这些是一些字符串,它们是字符串。你需要将字符串压缩成单元。我们熟悉这种细胞核形式,以存储在合约中,所以你可以看到它非常标准,我们会先压缩它,然后将其存储在单元中,因为简单的字符字符串不能传递给合约,然后你会看到你知道的“函数”。你将文本铸造传递给合约,它将是铸造。一个成功的NFT。第一行相当特殊。它是一个上下文消息。什么是上下文消息?我们可以回到这个仓库,我这里有,一个以前的文档,这是一个Tact语言的文件。你可以输入它并看到上下文实际上有这些消息附加。也就是说,你可以使用这个文本作为一个对话框,它会有弹跳。消息将有谁是发送者等。所以你可以调用这个上下文,然后你可以使用这个“ctx.value”或“ctx.sender”来进行过滤操作,也就是说,这个消息意味着我传入了这个数据,这个值,是这个文本对话框窗口的发送者,即调用这个铸造交易的人。当你进入合约时,这很容易理解。然后你在这里打开铸造,你会看到有一些细节需要写在这里。我们可能有需要和其他东西。铸造成功后,它将有一笔转移行动的交易,所以你必须满足我们的铸造要求。它会在这里设置,然后帮助你发送,下一步的相应交易信息继续下去。值得一提的是,如果我们在这里写一个函数,你将有不同的初始代码。你需要知道的是,你输入这个关键字匹配。这个初始代码将生成合约地址,因为我们的合约地址是要给出参数“到”,所以为什么ID有区别?事实上,每个NFT项目都有一个不同的ID,所以你需要输入一个不同的参数。到集合合约,它将返回,你所说的项目是什么样的地址,等等。如果你可以看细节,我们这边实际上是一个自我获取的功能,仍然在底部。那么你怎么做到呢?什么样的索引ID是值?通过这个描述,我们将返回一个初始代码。正如我刚才解释的,你将生成不同的NFT项目地址。原因是,有不同的初始代码。在这里,你只能确定生成地址的区别,取决于你这边的索引ID。这应该很容易理解。接下来,我们可以,传递一些基本参数给它。“SendParameter”是标准的,你想要什么,当发送消息时需要什么参数?你需要准备到,价值,反弹和模式。你可以,在刚刚分享的Tact文件中看到这些东西的细节。值得一提的是,你需要,第一次调用一个。合约,带有你的初始代码,所以这就是为什么你需要放置,初始DOT代码,并且数据是附加的。此外,如果你是最初部署这个合约,你需要这两个值被传递到新合约,以帮助合约成功部署,因为每个合约都需要这两个参数。如果我们在下一行,那么我们必须,告诉这个集合的主合约这个ID。父合约知道这是可以的。现在ID被添加下来了。如果有人将来发送这个铸造消息,它的ID将继续被添加下来。通过类比,让我们继续。这个接收实际上是一个标准的,如果没有扩展,也就是说,可能有人想从这个版税中拿走一些引用,等等。这并不重要,但它以标准的方式编写,所以我相信,让我们继续,呃,正如我们在下面谈论的,我还将使用,我们的结构结构在这里。结构是,我们首先定义,数据结构看起来像什么,然后这里将有一个标准的。需要返回的参数,以帮助大家理解,为什么这些参数被定义?你可以看到你回到我们的仓库,将有一个TEP。TEP的真正名称是,(Ton)增强提案,实际上它有点像,我们熟悉的一些规范,如ERC20。我们需要这些规范来帮助我们理解,NFT将具有什么功能,以及你需要在NFT本身上发送什么信息,所以我们不会在这里。关于这个TEP有太多细节,所以让我们继续,所以你需要设置这些标准,获取函数,以帮助大家获取,一些关于这个合约的相关信息。值得一提的是,这个获取函数,属于离链的,它是一个从你的链上获取数据的函数。它不是用于调用其他智能合约的。例如,如果你在以太坊上,你实际上可以调用,一些其他智能合约的函数,以获取,以太坊上其他合约的数据,因为在TON上它是异步的,所以你不能简单地依赖一个获取函数来获取,其他智能合约的数据。至于如何获取它,我们稍后会提到,所以接下来的,实际上是标准的,以帮助我们计算,也就是说,帮助我们计算,一些当前需要的信息,还获取一些标准化的返回值,以帮助我们。例如,当我们的前端需要调用,然后继续下去,包括消息旁边的参数。它实际上是有点像一个函数ID,也帮助我们定义并获取,我们想要来回发送的,这个交易的消息簿的,接口,所以这也是在TEP上首先定义的,我们可以继续。这里的消息,值得一提的是。它的整数侧实际上可以广泛地定义你是什么类型的数据。与Solidity相比,它更严格。最明显的区别当然是,当然,燃气费是不同的。例如,未签名的Intefer 16和uint64消耗的存储空间是不同的,但这有点太详细了。事实上,如果你写涂鸦。结构是这里更重要的一点,但它也很容易理解。你可以自定义数据结构的类型,所以,你可以自由使用它,它的灵活性相对较大。接下来,让我们看看NFT项目。当我们谈论NFT项目时,我想提醒你让我们看看NFT转移其所有者许可的情况。例如,这里有两个钱包地址。原来,我们需要发送转移数据结构,这是,以0X5F开头的数据格式,到我们自己的。这个NFT项目的拥有者,NFD项目接收到这个消息,并确认这是真正的所有者,也就是说,这个项目的拥有者可以发送这个消息。通过后,他将同时发送这两个消息。其中一条消息是发送给新所有者的,告诉新所有者,你现在是这个NFT项目的持有者,第二条消息是发送回原始持有者,说你的转移许可已经被转移了。这与我们在以太坊上的概念不同,因为我们知道,这是一个异步合约在Tom上,所以它需要这样的设计,同时通知原始持有者和新持有者,你有一个新合约。到达通知类似于这个概念,这与以太坊非常不同。让我们看看NFT项目需要什么信息。例如,可能有这些参数。你需要通过哪个地址传递集合,因为这可以帮助我们知道,某些消息只能由集合传递和调用,这是一种权限限制的行动。接下来的部分与上述类似。这部分,将是我们刚刚提到的转移行动,所以你可以看到,这一边的这个消息意味着,这个条件只会在使用初始化是第一次铸造时使用。另一种情况是,我刚才说的转移,所以下面的范围将被使用,当我只是说转移时,所以下面的范围将触发这个,所有者分配和访问,刚刚提到的是,标准转移行动的一部分。接下来的段落,实际上是一个链接,用于计算和维护余额。至于为什么它被写成这样,我们可以在以后提到。嗯,它将是一样的。标准采取一些基本信息等。总的来说,大致就是这样。这是一个标准的NFT集合,带有Tect语言的NFT项目的解释。我不想这个视频太长。如果你有其他问题,请随时在下面留言。在这段解释视频的结尾,我想强调并推广一件事,我们现在正在准备将TON的相关资源本地化。虽然这是本地化志愿者的工作,但他将是一个有偿的,有偿的链接。所以如果你感兴趣,请尽快联系我们。好的,这是一个简单的概述,带你了解Tact语言的结构是什么样的,以及每一段意味着什么。这就是今天的视频。

Takeaways

  • 📚 了解NFT结构:视频旨在帮助理解Tact语言的结构以及NFT合约的构成。
  • 💡 TON钱包使用:需要拥有TonKeeper钱包或任何通用钱包,这些钱包本身是合约。
  • 🔗 Mint交易机制:在TON中,Mint交易会生成消息并发送给NFT集合,然后集合生成消息并发送给NFT项目。
  • 📈 智能合约地址:在TON中,每个Azuki NFT可能对应一个智能合约地址,与以太坊的NFT结构不同。
  • 🔑 合约关键词:代码中有两个关键位置使用“contract”关键词,分别代表集合合约和项目合约。
  • 🗃️ 数据存储:TON合约有特殊的余额要求,用于支付合约存储费用,这与存储的数据类型有关。
  • 📝 自定义数据结构:Tact支持自定义数据结构,允许开发者根据需要定义数据类型。
  • 🔑 函数和消息:合约中的Mint函数将处理NFT的铸造,并且会有一个特殊的上下文消息,用于交互。
  • 🔍 上下文消息:上下文消息允许过滤和识别消息的发送者,这对于理解交易的发起者很重要。
  • 🚀 初始代码和部署:每个NFT项目都有不同的初始代码,这决定了生成的合约地址的差异。
  • 💻 函数参数:发送消息时需要准备的参数包括To、Value、Bounce和Mode,这些参数在Tact文件中有详细说明。
  • 🔗 函数和数据获取:合约中的get函数用于从链上获取数据,不同于以太坊,TON的get函数不能用于调用其他智能合约。
  • 📝 TEP规范:TEP(Ton Enhancement Proposals)类似于ERC20,是TON网络上NFT功能和信息传递的规范。
  • 🛠️ 消息和数据类型:TON中的消息和数据类型定义比Solidity更严格,这影响了合约的存储和计算。
  • 🔄 NFT所有权转移:在TON中,NFT所有权转移涉及到发送给新旧所有者的消息,以确保双方同时得到通知。

Q & A

  • 什么是NFT的Tact语言结构?

    -Tact语言结构是用于编写和理解TON区块链上NFT智能合约的一种编程语言。它包括集合合约和物品合约,以及用于定义数据结构和函数的关键字。

  • 为什么要使用TonKeeper钱包或通用钱包?

    -TonKeeper钱包或通用钱包是TON区块链上用户与NFT智能合约交互的工具。它们允许用户发送交易,如铸造(Mint) NFT,并接收相关的反馈信息。

  • 在TON区块链上,NFT集合和NFT物品是如何通过智能合约区分的?

    -在TON区块链上,NFT集合和NFT物品通过两种不同的智能合约来区分。集合合约负责管理整个NFT系列,而物品合约则管理单个NFT的具体信息。

  • TON区块链上的NFT与以太坊上的NFT在结构上有什么不同?

    -TON区块链上的NFT结构与以太坊不同,主要在于TON上的NFT集合和NFT物品是通过两个不同的智能合约来管理的,而以太坊上的NFT通常使用单一的智能合约来管理整个系列。此外,TON上的NFT地址数量会随着NFT物品的增加而增加,这与以太坊也有所不同。

  • 什么是常量(constant)在TON合同中的作用?

    -在TON合同中,常量用于定义一些固定值,如TON的单位值,这些值在合同执行过程中不会改变,用于标准化操作和计算。

  • 为什么需要压缩字符串并将其存储在细胞(cell)中?

    -在TON区块链上,简单的字符字符串不能直接传递给智能合约。因此,需要将字符串压缩成细胞(cell)的形式存储在合约中,以便于管理和调用。

  • Mint函数在NFT合同中的作用是什么?

    -Mint函数是NFT合同中用于铸造新NFT的函数。当用户调用Mint函数并满足合约中的条件时,合约将生成一个新的NFT并记录相关的交易信息。

  • 上下文消息(context message)在TON智能合约中扮演什么角色?

    -上下文消息在TON智能合约中用于传递关于消息发送者和接收者的信息,如发送者的身份和消息内容。它允许合约根据消息的上下文进行相应的处理。

  • 为什么每个NFT项目都有一个不同的初始代码?

    -每个NFT项目都有一个不同的初始代码,这是因为初始代码与NFT项目的特定属性相关联,如索引ID。不同的初始代码会导致生成不同的NFT项目地址,增加了系统的灵活性和可定制性。

  • 如何通过TEP来理解NFT的功能和所需信息?

    -TEP(Ton Enhancement Proposals)类似于以太坊上的ERC20标准,它提供了一组规范,帮助开发者和用户理解NFT将具有哪些功能,以及在NFT本身上需要发送哪些信息。

  • TON区块链上的NFT转移与以太坊有何不同?

    -TON区块链上的NFT转移是异步的,需要同时通知原始持有者和新持有者关于NFT所有权转移的情况。这与以太坊上NFT转移的概念不同,因为以太坊上的转移通常是同步的。

  • 为什么在TON区块链上部署智能合约时需要初始代码和数据?

    -在TON区块链上部署智能合约时,需要初始代码和数据来帮助合约成功部署。这是因为每个合约都需要这两个参数来初始化其状态和功能。

Outlines

00:00

😀 NFT与Tact语言结构概览

Howard在视频中首先介绍了NFT和Tact语言的基础知识。他提到了在TON区块链上,NFT的实现方式与以太坊有所不同,包括使用TonKeeper钱包和智能合约的交互方式。Howard解释了如何通过发送消息来铸造NFT,并介绍了NFT集合合约和单个NFT项合约的区别。他还提到了TON合约的特殊存储费用和数据结构的自定义能力。最后,Howard强调了上下文消息的重要性,以及如何通过'ctx.value'和'ctx.sender'进行过滤操作。

05:00

📚 Tact语言的详细解析与NFT部署

在第二段中,Howard深入讲解了Tact语言的语法和NFT合约的部署过程。他说明了在部署新合约时需要传递的两个关键参数,以及如何通过父合约来管理NFT的ID。Howard还讨论了版税费用的参数设置,以及如何使用标准函数来获取合约信息。此外,他还提到了TEP(Ton Enhancement Proposals)的重要性,这是TON区块链上类似于ERC20的规范。最后,Howard强调了异步智能合约的特点,以及如何在NFT转移所有权时通知新旧所有者。

10:01

📢 Tact语言结构与NFT项目介绍

Howard在视频的最后部分提供了Tact语言结构和NFT项目的简单概述。他提到了如何通过不同的初始代码生成不同的NFT项目地址,并且解释了发送消息时需要的基本参数,如'To', 'Value', 'Bounce', 和 'Mode'。此外,Howard还提到了TON区块链上NFT的异步特性,以及如何通过TEP定义消息类型和数据结构。他还提到了Gas费用的不同,以及如何在TON上实现数据结构的自定义。最后,Howard鼓励观众如果对TON的资源汉化工作感兴趣,可以主动联系他们。

Mindmap

Keywords

💡NFT

NFT,即非同质化代币,是一种基于区块链技术的独特数字资产,每个NFT都拥有独一无二的标识符。在视频中,NFT是讨论的核心,主要围绕其在TON区块链上的特殊结构和交易方式进行讲解。例如,提到了如何通过TON区块链上的智能合约来铸造(Mint) NFT。

💡Tact语言

Tact语言是用于编写TON区块链智能合约的编程语言。视频中提到了Tact语言的结构,以及如何通过这种语言来理解和编写NFT的智能合约。Tact语言的特点是它支持自定义数据结构,并且对数据类型有严格的要求。

💡TON区块链

TON区块链是一个高性能的区块链平台,支持智能合约和去中心化应用。视频中提到TON区块链与以太坊(Ethereum)的不同之处,特别是在NFT的创建和交易方面。TON区块链的特点包括异步执行智能合约和较低的交易费用。

💡智能合约

智能合约是一种自动执行、控制或文档化法律事件和行动的计算机程序。视频中讨论了在TON区块链上创建NFT时,智能合约如何被用来定义NFT的属性和行为。智能合约在NFT的铸造、所有权转移等过程中扮演了关键角色。

💡TonKeeper钱包

TonKeeper钱包是用于管理TON区块链资产的数字钱包。视频中提到用户需要有一个TonKeeper钱包或任何其他兼容的钱包来与NFT智能合约进行交互。钱包本身也是一个智能合约,可以发送和接收交易。

💡Mint交易

Mint交易是指在区块链上创建新的代币或资产的过程。在视频中,Mint交易被用来说明如何在TON区块链上铸造一个新的NFT。这个过程涉及到发送特定的消息给NFT集合合约,然后生成并发送消息给NFT本身。

💡集合合约和物品合约

在TON区块链的NFT结构中,存在两种类型的合约:集合合约和物品合约。集合合约类似于以太坊中的ERC721合约,管理着整个NFT集合,而物品合约则管理单个NFT。视频中提到这两种合约的不同之处,并解释了它们在NFT生命周期中的作用。

💡常量(Constant)

在编程中,常量是一个固定值,一旦设置就不能被改变。视频中提到了在Tact语言中定义常量的概念,例如TON合约中的存储费用常量。这些常量有助于标准化和简化智能合约的编写。

💡数据结构(Data Structure)

数据结构是计算机科学中的一种组织和存储数据的方式,可以有效地表示数据并允许对数据进行各种操作。视频中讨论了Tact语言支持的自定义数据结构,以及如何在智能合约中定义和使用这些数据结构。数据结构对于NFT的属性和行为至关重要。

💡上下文消息(Context Message)

上下文消息是智能合约中用于传递信息的一种机制。在视频中,上下文消息被用来说明如何在Mint交易中传递关于发送者和交易数据的信息。通过上下文消息,智能合约可以获取有关交易的详细信息,如发送者身份和交易值。

💡转移(Transfer)

转移是指在区块链上将资产的所有权从一个地址转移到另一个地址的过程。视频中讨论了NFT的转移过程,包括如何通过智能合约来实现NFT的所有权转移,并确保新旧所有者都得到适当的通知。这个过程在TON区块链上与以太坊有所不同,因为它需要异步处理。

Highlights

霍华德在上周的研讨会后,通过私人信息回答了有关NFT的问题,并录制了一个视频来帮助理解Tact语言的结构以及如何理解NFT合约。

介绍了如何通过TonKeeper钱包或任何通用钱包与NFT合约进行通信。

解释了在TON中,每个NFT项目都有一个智能合约地址,与以太坊的结构不同。

强调了TON合约存储的特殊余额支付方式,以及如何选择存储数据。

展示了集合合约和项目合约的代码结构,并解释了它们在TON中的作用。

介绍了如何使用常量和数据类型来标准化TON合约。

讨论了如何使用URL链接和字符串压缩来存储在合约中。

解释了Mint函数的工作原理,以及如何通过上下文消息进行过滤操作。

强调了合约地址生成的重要性,以及如何通过不同的初始代码生成不同的NFT项目地址。

介绍了发送参数的标准过程,包括To、Value、Bounce和Mode。

讨论了初始代码和数据对合约部署成功的重要性。

解释了如何通过ID和索引来管理NFT集合的增长。

介绍了接收函数的标准形式,以及它在版税等场景中的应用。

讨论了TEP(Ton Enhancement Proposals)在定义NFT功能和所需信息方面的作用。

强调了get函数在获取链上数据而非调用其他智能合约数据中的作用。

讨论了TON中消息传递的严格数据类型定义,以及与Solidity的比较。

解释了NFT项目在转移所有权时的异步处理方式,以及与以太坊的不同。

介绍了NFT项目所需的参数,以及如何通过集合来限制权限。

讨论了转移操作的标准流程,包括所有者分配和访问。

强调了计算和维护余额的重要性,以及其在合约中的标准实现。

霍华德强调了正在准备将TON相关资源汉化的工作,并邀请对此感兴趣的人参与。

视频最后提供了对Tact语言结构和每个段落含义的简单概述。

Transcripts

play00:01

Hi everyone, I’m Howard.

play00:01

After our workshop last week,

play00:03

some people came to private message me

play00:04

with some questions about NFT

play00:06

. Today we will quickly record a video

play00:07

to help you understand the structure of the Tact language

play00:09

and how to understand the contract of this NFT.

play00:13

First of all, let's go back to our report,

play00:14

you can go to it

play00:15

, I will send the link to the bottom of the video

play00:17

, and then you can click

play00:18

to open the data

play00:19

directly with your local IDE.

play00:22

First, before we start,

play00:23

I would like to introduce

play00:24

its communication. How is the method?

play00:26

First, you will have your own TonKeeper wallet

play00:28

or a wallet created by any of

play00:30

your general Wallets

play00:31

. It is itself a contract

play00:32

, and the Mint

play00:34

transaction that occurs in it will be the contract that you send a message to

play00:36

the NFT collection

play00:37

and then It will generate a message and

play00:39

send it to the NFT item

play00:41

, which means that if you

play00:42

are Azuki, for example,

play00:43

you may have 10,000 Azuki,

play00:45

then you will have 10,001

play00:48

Smart Contract addresses in the end

play00:49

, which is very, very different from Ethereum In the same way,

play00:51

after you understand the basic concept,

play00:53

we can go back to the above

play00:55

to look at the code.

play00:56

First, we

play00:57

converge several scopes of the code

play00:59

, and you can clearly see what

play01:00

the keyword contract represents. There are two

play01:03

places. The first is the collection contract

play01:05

, and the second contract will be the item contract.

play01:07

This is also

play01:09

different from the NFT structure of Ethereum

play01:11

that we are familiar with. We can

play01:14

explain it step by step. A common

play01:16

integer, a common constant

play01:18

, so it’s called constant, right?

play01:20

Then we can standardize the word TON and

play01:21

say it’s 0.03.

play01:23

As for why we choose to store these two data

play01:25

, because

play01:26

the TON contract has a special

play01:30

balance to pay for this contract storage. The cost

play01:33

is simply like this,

play01:34

but we can mention the details in the future.

play01:36

After we expand the collection contract,

play01:38

you can see that it is very basic.

play01:39

It is obvious that this is a collection,

play01:41

which is a bit like the number of this contract.

play01:43

It’s a bit like

play01:45

the most basic Starting with the largest contract, the

play01:47

parent contract

play01:47

, it stores some normal arguments.

play01:50

For example, it has several IDs in Mint now,

play01:52

so its ID

play01:53

and index

play01:53

are actually an ID.

play01:54

It starts from 0

play01:55

and adds up to what you set. The upper limit

play01:58

, the second is who is your owner,

play01:59

and the third is

play02:01

the parameter of

play02:02

your Royalties fees

play02:03

. We have set a data type here, which is the type of the data

play02:06

. We can call

play02:07

this thing later.

play02:08

You can quickly understand it here. In

play02:10

fact, Tact supports

play02:11

customized data structures

play02:13

. Let’s continue.

play02:17

You need to use a set of URL

play02:19

links, which are some strings, which are strings.

play02:21

You need to compress the strings into cells

play02:23

. We are familiar with this form of cell nucleus

play02:25

to store in the contract

play02:26

, so you can see that it

play02:27

is very standard,

play02:28

we will compress it first and then store it in the cell

play02:30

, because

play02:31

simple character strings cannot be passed to the contract,

play02:33

then we will You will normally see

play02:38

the "Function" that you know

play02:40

. You pass the text Mint into the contract,

play02:42

and it will be Mint. A successful

play02:43

NFT

play02:44

. The first line is quite special.

play02:45

It is a context message.

play02:46

What is the context message?

play02:48

We can Going back to

play02:48

this repo, I have

play02:50

a previous document here

play02:51

, which is a file in the Tact language

play02:52

. You can enter it and see that the context

play02:53

will actually have these messages attached.

play02:55

That is

play02:56

to say, you can use this text as a dialogue box,

play02:58

and it will have a bounce. The message

play02:59

will have who the sender is, etc.

play03:00

So you can call this context and then

play03:03

you can use this "ctx.value"

play03:05

or "ctx.sender" to do a filtering action

play03:07

, that is, this message means that

play03:09

I pass in This data

play03:11

and this value

play03:11

are the Sender of this text dialogue window, that

play03:14

is, the person who calls

play03:15

this Mint Transaction. It is easy to understand

play03:18

when you enter the contract.

play03:19

Then you open Mint here

play03:21

and you will see that

play03:21

there are some details to be written here.

play03:23

We may have Require and other things

play03:25

. After your Mint is successful,

play03:26

it will have a transaction

play03:28

of the transfer action

play03:31

, so you must meet the requirements of our Mint. It

play03:32

will be set here

play03:33

and then help you to send

play03:34

the corresponding The transaction information

play03:36

of the next step

play03:38

continues down.

play03:39

Here it is worth mentioning that

play03:41

if we write a Function here,

play03:43

you will have a different initial code.

play03:45

What you need to know here is that

play03:46

you enter this keyword match. This initial code

play03:49

will generate the contract address

play03:50

because our

play03:50

contract address is to give the argument "To",

play03:53

so why is there a difference in the ID?

play03:57

In fact, each NFT item has a different ID

play04:00

, so you need to enter a different argument. To

play04:02

the collection contract,

play04:03

it will return

play04:05

what kind of address you said the item is,

play04:08

and so on.

play04:09

If you can look at the details,

play04:11

our side is actually

play04:13

a function of

play04:13

a get of a self , which is still at the bottom.

play04:15

So how do you do

play04:18

this ? What kind of index ID is the value?

play04:20

Through this description,

play04:21

we will return an initial code.

play04:24

As I just explained,

play04:26

you will generate different NFT item addresses.

play04:28

The reason is

play04:30

that there are different initial codes. Here

play04:32

you can only determine the difference in the generated address

play04:34

depends on the index ID on your side. It

play04:37

should be quite easy to understand.

play04:38

Next, we can

play04:39

pass some basic parameters to it

play04:41

. "SendParameter" is a standard

play04:43

you want

play04:44

What kind of arguments will be needed

play04:45

when sending a message ? You need to prepare To, Value, Bounce, and Mode.

play04:48

You can

play04:49

see the details

play04:50

of these things in the Tact file we just shared.

play04:51

It is worth mentioning that you need to

play04:54

call one for the first time. The contract

play04:56

comes with your initial code

play04:57

, so this is why you need to put

play04:59

Initial DOT Code

play05:00

and data are attached.

play05:02

In addition, if you are initially deploying this contract,

play05:05

you need these two values ​​​​to be passed to the new contract

play05:08

to help the contract deploy successfully

play05:10

, because each contract needs these two parameters

play05:13

. If we are in the next line,

play05:15

then we have to

play05:16

tell the main contract of this collection to this ID.

play05:18

The parent contract knows that it is OK.

play05:19

Now the ID is added down.

play05:20

If someone sends this Mint message

play05:21

in the future,

play05:23

its ID will continue to be

play05:24

added down . By analogy,

play05:25

let’s move on . This receive

play05:27

is actually a standard if it’s

play05:28

not expanded ,

play05:29

that is, maybe someone will want to take

play05:31

some quotations from this royalty, etc.

play05:33

It’s not really important

play05:34

, but it’s written in a standard way, so I believe

play05:35

that. Let's continue down,

play05:36

er, as we talked about below,

play05:39

I will also use

play05:41

our structure structure here. The

play05:42

structure is that

play05:42

we first define

play05:43

what the data structure looks like

play05:45

, and then there will be a standard one here

play05:47

. The parameters need to be returned

play05:48

to help everyone understand

play05:49

why

play05:51

these parameters are defined?

play05:52

You can see that you go back to our repo

play05:55

and there will be a TEP.

play05:57

The real name of TEP is

play06:00

(Ton) Enhancement Proposals

play06:01

In fact, it is a bit like

play06:03

some specifications such as ERC20 that we are familiar with

play06:05

. We need these specifications to help us understand

play06:07

what functions NFT will have

play06:09

and what information you need to send on the NFT

play06:11

itself

play06:12

, so we will not be here. There are too many details

play06:15

about this TEP

play06:16

, so let’s go on

play06:18

, so you need to set these standard

play06:19

get functions

play06:20

to help everyone get

play06:22

some relevant information about this contract

play06:23

. It is worth mentioning that

play06:24

this get function

play06:25

belongs to the off-chain It is a

play06:27

function for obtaining data from your chain.

play06:29

It is not for calling other Smart Contracts.

play06:32

For example, if you are on Ethereum,

play06:34

you can actually call

play06:35

some functions of other Smart Contracts

play06:37

to obtain

play06:38

data of other contracts on TON because it It is asynchronous

play06:41

, so you cannot simply rely on a get

play06:42

function to obtain

play06:44

other Smart Contract data

play06:46

. As for how to obtain it, we will mention it later,

play06:48

so the following

play06:49

are actually standard to help us calculate,

play06:51

that is, to help us calculate

play06:53

some of the current needs The information

play06:55

also obtains some standardized return values

play06:57

​​to help us.

play06:58

For example, when our front-end needs to call,

play07:00

then continue down and

play07:01

include the

play07:02

parameters next to the Messages below.

play07:04

It is actually a bit like a function ID

play07:05

, which also helps us to define And to get

play07:07

the

play07:08

interface that tells us which message we want to send

play07:11

back and forth to the

play07:12

message book of this Transaction,

play07:13

so this is also defined on the TEP first, and

play07:17

we can continue.

play07:18

The message here

play07:19

is worth mentioning. It will be that its integer

play07:21

side can actually broadly

play07:22

define what kind of data type you are.

play07:24

Compared with Solidity, it is stricter.

play07:27

The most obvious difference is

play07:28

of course that the Gas Fee is different.

play07:31

For example Say that

play07:32

the storage space consumed by unsighed Intefer 16 and uint64

play07:35

is different

play07:37

, but this is a bit too detailed.

play07:38

In fact,

play07:41

it

play07:41

doesn’t matter if you write scribbles. The structure is a more important point here

play07:43

, but it is

play07:45

also easy to understand

play07:45

. You can customize the type of a data structure,

play07:47

so

play07:49

you can use it freely,

play07:51

and its flexibility is relatively large.

play07:52

Next, let’s look at NFT items.

play07:55

When we talk about NFT items,

play07:56

I want to remind you Let’s take a

play07:57

look at the situation

play08:00

when an NFT transfers its owner’s permission.

play08:01

For example,

play08:02

there are two wallet addresses here.

play08:04

Originally, we

play08:05

will need to send the transfer data structure

play08:07

, which is

play08:08

the data format starting

play08:09

with 0X5F , to our own. The owner of

play08:11

this NFT item

play08:13

, the NFD Item receives this message

play08:14

and confirms that this is the real Owner, that

play08:16

is,

play08:16

the owner of this Item can send this message.

play08:18

After passing, he will

play08:20

send these two messages at the same time. One of the messages is sent

play08:22

to the new Owner, telling the new Owner that

play08:25

you are now the holder of this NFT Item,

play08:27

and the second message

play08:28

is to send back to the original holder to say that

play08:30

your transfer permission has been transferred

play08:33

. This is different

play08:35

from the concept on our Ethereum

play08:35

, because as we know,

play08:37

this is an asynchronous contract on Tom

play08:39

, so it needs such a design

play08:40

to inform the original holder

play08:42

and the new holder at the same time that

play08:44

you have a new contract. The

play08:45

arrival notification

play08:46

is similar to this concept,

play08:48

which is very different from Ethereum.

play08:50

Let's look down at

play08:52

what information NFT Item needs.

play08:53

For example, there may be these parameters. Which

play08:56

address you need to pass the collection

play08:58

Because this can help us know that

play08:59

certain messages

play09:01

can only be passed in and called by

play09:03

the collection , which is an action of permission restriction.

play09:06

The following are similar to the above.

play09:08

This part

play09:09

will be the transfer action we just mentioned,

play09:11

so you can Seeing

play09:12

this message on this side means that

play09:14

this condition will only be used

play09:15

when the initialization is the first Mint.

play09:16

Another situation

play09:17

is that the following range will be used

play09:19

when I just said the transfer,

play09:20

so the following range will trigger this

play09:21

. The owner assign and access

play09:23

mentioned just now are

play09:25

part of a standard transfer action.

play09:27

The following paragraph

play09:28

is actually a link to calculate and maintain the balance.

play09:30

As for why it is written like this,

play09:32

we can mention it in the future

play09:34

. Well, it will be the same below. The standard take some

play09:36

basic information and

play09:38

so on. Overall, it is roughly like this

play09:39

. It is a

play09:40

standard NFT collection with

play09:43

an explanation of the Tect language of NFT item

play09:45

. I don’t want this video to be too long.

play09:46

If you have other questions,

play09:47

please feel free to leave

play09:49

a message below . At the end of this explanatory video,

play09:52

I want to emphasize and promote one thing with you

play09:55

We are now preparing to Sinicize

play09:57

the relevant resources of TON

play09:58

. Although it is the work of a Sinicization volunteer

play10:01

, he will be a paid

play10:02

and paid link.

play10:04

So if you are interested, please contact us as soon as possible.

play10:08

OK Then this is a simple overview

play10:10

that takes you to understand

play10:11

what kind of structure the Tact language is like

play10:13

and helps you understand

play10:14

what each paragraph means.

play10:15

That's the video

play10:16

for today.

Rate This

5.0 / 5 (0 votes)

Related Tags
NFTTact语言TON区块链智能合约霍华德区块链技术数字资产加密货币技术讲解钱包安全Sinicization
Do you need a summary in English?