Preface

前几天在sui生态中出现了一个创新性的铭文标准MRC20,其首个代币$Move在社区中引起了一定的热度。我在接收到消息之后,也是在第一时间点进官网:https://mrc20.fun/ 准备mint。

The official website is very simple. On the casting page, there are only the following basic information of the inscriptions and a blue Mint button. One sentence below the button summarizes the innovation of this inscription standard - "All casting costs will be stored in your inscription, and you can get back your casting costs by burning your inscription, after each round. Your inscription will be sent to your address".

Since I had never been exposed to the Move language before and this sentence made me very curious about its implementation principle, I carefully studied the author's Twitter, blog posts and github open source code and output this article.

Author background

jolestar (Twitter: @jolestar) is a technical expert who is good at programming and writing. As can be seen from his personal blog website (https://jolestar.com/), he has been outputting technical articles and articles since 2007. Insights on life. You can also see from his personal Github homepage that the three projects in the introduction are all related to the Move language.

Jolestar said he has been tinkering with Move since 19 years. In addition, he also launched a Move language education charity project - the Star Navigation Project (a tribute to the movie Star Trek). After completing the course and successfully graduating, you can also get a cash reward, aiming to contribute to the Move ecosystem. Bring in more developers.

Therefore, from the above information, we can know that jolestar is a developer who is very familiar with the Move ecosystem.

SFT

We all know that BRC20 embeds JSON text in the inscription to represent the name and quantity of the token, and uses NFT (Non-Fungible Token, non-fungible token) to implement FT (Fungible Token, homogeneous token). currency) function, it can essentially be classified as a SFT (Semi-Fungible Token, semi-fungible asset).

Of course, SFT is not the first of jolestar. As early as September 2022, our Chinese team @SolvProtocol led the design and officially passed it as Ethereum's new token standard ERC-3525.

Fungible tokens mean that each token is equal in function and value, without any difference, and can be replaced with each other. 1 BTC = 1 BTC. Non-fungible tokens means that each token is unique. cannot be replaced, 1 BAYC ≠ 1 BAYC, semi-fungible tokens combine the characteristics of homogeneous tokens and non-fungible tokens. The key is Slot. Simply put, Slot represents a classification. There will be multiple IDs (unique identifiers) under the same Slot. Although each ID can have a different Value (number of tokens), different IDs under the same Slot can be considered the same and can be exchanged, combined and split. entity.

Take membership card points as an example. Suppose there are two slots, namely KFC membership card and Starbucks membership card. Satoshi Nakamoto and Musk applied for membership cards at KFC and Starbucks respectively. Obviously, KFC points and Starbucks points cannot be used. Universal, this is non-fungible, but the points from Satoshi Card 1 under KFC can be transferred to Card 2 and Card 3. Similarly, the points from Musk Card 2 and Card 3 under Starbucks can be merged into Card 1. Points under different IDs in the same slot are homogeneous.

Replace the above points with the ordi and sats of brc20, as shown in the figure below. Each token type can be regarded as a slot. The different number of inscriptions recorded under each slot can be regarded as a semi-homogeneous token. Each inscription has a unique inscription id, and each inscription contains There is no difference in the ordi.

设计理念

Before talking about the design concept of Movescription, let’s first take a look at the days when “thousands of chains flew together” some time ago. Most evm chains refer to the eths model when designing inscriptions, that is, “send a transaction through rotation or to a black hole address.” transfer, and attach a set of text in JSON format similar to brc20 in the calldata, and then build an indexer to index the data on the chain to complete accounting." This method is to imitate brc20 from the way of storing data on the chain. , it can be said that it is "similar in appearance but not similar in spirit", and does not take advantage of the smart contract of the chain itself.

So the author put forward his design concept in the following tweet (the following text is a condensed summary, please click the link for the full text: https://x.com/jolestar/status/1737652966142959982?s=20 to view)

Since there is no smart contract on Bitcoin, it is necessary to use the method of inscribing JSON to issue FT. However, there is no need to use JSON in other smart contract chains, so I summarized several revelations of inscription: 1. It is a kind of semi-homogeneity As an asset, its liquidity is not as good as FT, but this is an advantage in the initial stage of the market. 2. Its threshold for issuing assets is lower than FT on each chain, and its cognitive cost is also low. Issuing assets on each chain generally requires the deployment of a smart contract, and identification is mainly through the contract address, which is difficult for novices. This wave of inscriptions has basically lowered this threshold to the lowest level. 3. Its fair issuance model, on Bitcoin, can be understood as the PoW issuance model of leasing miners through Gas.

In that case, why don't we use smart contracts to implement an inscription protocol that has the above characteristics? So I tried to use Move to implement the Movementscriptions protocol. First, it is a semi-fungible asset protocol expressed through Move. Move's data structure-based asset expression is ideal for expressing this protocol. 1. Use tick, a globally unique name, to express the type. Drawing lessons from BRC20, it conforms to the KISS principle and is simple and intuitive. 2. Value can be used to express the balance of FT or the key value in NFT. 3. Metadata can be appended with any type of data. Secondly, it supports the distribution of assets through PoW, ensuring that the distribution of assets is fairer and more decentralized. I call it smart inscription.

-jolestar

资产的表达方式

"Move's asset expression method based on data structure is very suitable for expressing this kind of agreement." How should we understand what jolestar said.

First of all, Move language introduces the concept of Resource, which is also the biggest difference between Solidity and Move. It weakens digital attributes and emphasizes asset attributes, making Move safe and powerful.

Assets under the Solidity language system are encoded in the EVM as a mapping of "address --> assets". Assets can only be transferred by adding or subtracting values ​​​​in different addresses. They cannot be passed as parameters, returned from functions or stored in another location. In an asset, this accounting method can easily be used by hackers to find loopholes for re-entrancy and double-spending attacks. As shown in the figure below, this is how a typical erc20 token works.

Under the Move language system, assets are defined as Fisrt-class Resource, literally translated as resources are first-class citizens, which means that resources need to be the primary programming object to be considered, and have two constraints, namely scarcity and access rights.

In real life, scarcity is an important attribute of physical assets. For example, gold will neither be issued out of thin air nor disappear suddenly, but there is no inherent physical scarcity in digital assets. So Move believes that digital assets must enforce this scarcity in some programmatic way, so Move abstracts four attributes for various types: copy (copyable), key (indexable), droppable (drop), and storable (store).

However, once the variable is declared as a Resource type, it can only use Key and Store attributes, and cannot be added with Copy and Drop attributes. This ensures the scarcity of the resource type from a grammatical structure.

A simple Resource is shown in the figure below, which explains what the author calls the way to express assets based on data structures.

Let's take a look at how resources are transferred under the Move system. First of all, all Resource data must be stored under the account, because only when the account is assigned, the corresponding Resource assets will exist. Secondly, as long as each Resource is taken out from the account, it must be "used", using the built-in move_to After the method takes the asset out of the account, it either passes it as a return value to the new account or destroys it. As shown below:

composability of assets

As mentioned earlier, Resource is a special structure. In Move, structures can be nested into each other. Take Movescription as an example. Balance<SUI> is embedded in Movescription. This is how you can combine your casting costs. Locked in the inscription. In the same way, MoveScription can also be nested in other resources, just like Lego blocks.

In this way, MoveScription breaks the curse that many inscriptions on Brc20 only have Meme narratives, and can build various ecological applications, such as as an asset in games, as collateral in Defi, etc.

Summarize

At this point, I believe you can already understand that the design concept of the inscription Movescription is similar to that of BRC20. In the wallet, each Movescription is an NFT (analogous to Inscription). Each Movescription has an Object id (analogous to Inscription id). The token balance of the account also requires indexing. But its advantage is that it makes good use of the Move language's advantage in expressing assets, and truly achieves "similarity in form and spirit".

References:

1. https://medium.com/@ThreeDAO/%E4%B8%87%E7%89%A9%E7%A0%94%E7%A9%B6%E9%99%A2-sui%E4%B8% BB%E7%BD%91%E4%B8%8A%E7%BA%BF%E5%9C%A8%E5%8D%B3-%E4%B8%80%E6%96%87%E4%BA%86 %E8%A7%A3%E5%85%B6%E8%83%8C%E6%99%AF-%E7%89%B9%E6%80%A7%E5%92%8C%E4%B8%8Eaptos% E7%9B%B8%E6%AF%94%E4%BC%98%E5%8A%A3%E5%8A%BF-c1c75c94c9b5

2.https://medium.com/huobi-research/move%E8%AF%AD%E8%A8%80%E7%9A%84%E5%88%9B%E6%96%B0%E5%92% 8C%E6%9C%BA%E9%81%87-409f01d4d51b

3.https://mirror.xyz/bocaibocai.eth/q3s_DhjFj6DETb5xX1NRirr7St1e2xha6uG9x3V2D-A

4.https://jolestar.com/why-move-1/