BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Learn more about Kusama asset hub "Statemine"

PolkaWorld
特邀专栏作者
This article is about 7874 words, reading the full article takes about 12 minutes
Statemint/Statemine is a public interest parachain of the Polkadot/Kusama ecosystem, used to create and manage assets, including homogenized assets and NFT.
AI Summary
Expand
Statemint/Statemine is a public interest parachain of the Polkadot/Kusama ecosystem, used to create and manage assets, including homogenized assets and NFT.

Join the PolkaWorld community and build Web 3.0 together!

Join the PolkaWorld community and build Web 3.0 together!

Statemint/Statemine is a public interest parachain of the Polkadot/Kusama ecosystem, used to create and manage assets, including homogenized assets and NFT.

In the "Relay Chain" podcast updated on August 5, Jorrin Bruns, the host Parity Support engineer, and Joe Petrowski, the head of technical integration at the Web3 Foundation and a contributor to the Statemint project, took everyone to analyze Statemint in depth.

  • PolkaWorld has organized some of the highlights of this podcast into a text version. The main contents of this article are:

  • What is Statemint/Statemine?

  • Take the transaction off the relay chain

  • Statemine as the first public interest parachain

  • Transfer assets between multiple chains

  • Implement Statemint governance

  • Who is developing public interest parachains?

  • How to incentivize validators

What the future holds for Statemint and Statemine

Jorrin: Welcome everyone to listen to the Relay Chain podcast. It is a great honor to invite Joe Petrowski again this time. This time we'll talk about "Statemint," one of the projects Joe has been involved in in recent months. As many of you should have heard, it is the first parachain to go live on Kusama. In fact, it is called "Statemine" on Kusama, but we will use "Statemint" to refer to it in the following podcasts, because the name of Polkadot's mainnet is Statemint. So the names "Statemine" and "Statemint" are actually interchangeable.

Let's get started. Let's look at it from a higher perspective, what is Statemint?

Joe: Statemint is actually a very simple chain without too many fancy things. It is not as complicated as the relay chain or the smart contract chain, it is just a chain for creating and managing assets, including both homogeneous assets and non-homogeneous assets (NFT).

Statemint is actually mainly composed of two modules, one is the Assets module that deals with homogeneous tokens, and the other is the Unique module that manages non-homogeneous tokens NFT. The rest are run-of-the-mill stuff like accounts and balances. Accounts can store assets, and there are also some practical functions that you often see in Substrate chains, such as cross-chain messages, proxy, and multi-signature.

But in general, the main function of Statemint is to create and manage assets on the chain.

Jorrin: We just talked about tokens and NFTs. To help people familiar with the Ethereum ecosystem understand, is Statemint a token standard, or a parallel chain for token standards, similar to ERC20 or ERC 721?

Joe: Yes, that's right. These two modules (pallets) are actually very similar to the interfaces of ERC20 and ERC721. The biggest difference is that when we talk about ERC20 and ERC721 (for convenience, I will directly talk about ERC20 later), it is an interface, and it just means that you must have these functions in your contract. But in fact, each Ethereum ERC20 uses a different interface, so you can have certain functions, such as transfer. A certain contract can use much more gas than another contract, and we found that using different ERC20 tokens to do the same operation, there will be a very large gas fee gap.

In Statemint, these are written directly in the Runtime. There is a function called Transfer on this chain, and another function called Create, which is used to create assets. All of these logics are on-chain, and the advantage is that we have benchmarked them. This is through our standard Substrate benchmarking process, using some known hardware, to estimate the execution time of different functions.

Instead of calculating gas during the transaction, we can charge for pre-dispatch, that is to say, we can charge a transaction fee before executing the Transfer function, which is not only cheaper, but also faster. Because if you think about it, how does gas billing work? It's a bit like saying "what's the next step in this contract? It's addition. So how much will it cost? 5 units. How much gas is left after paying ? 1 million. Okay, so what's 1 million minus 5? That's 999995. Okay, now we can do the addition." So you actually have the overhead of tracking and measuring gas costs all the time.

But if you think about what the word "measure" means in reality, it's actually measuring something that you don't know the value of. In Ethereum, a specific contract may have millions of ERC20 token transfers. Then everyone can't help asking, if you have already measured something and know its complexity, why do you need to measure it? You know it doesn't contain any loops. In fact, it seems that the gas measurement system is just a kind of psychological comfort, so that everyone can deploy untrusted code. But if you've audited the code, reviewed it, and know it doesn't contain a forever loop, and know its complexity, presumably you'll need to do two database reads, and three database writes, and several computation. Then we can directly figure out how much the transaction will cost without measuring it every time.

This allows us to process things faster, because we know what the transfer implementation process looks like, so we can directly figure out how many transactions to put in a block, instead of doing gas measurement.

Jorrin: Great, you did a very comprehensive summary. Now it is clear to us that Statemint is done for efficiency reasons. But is there any other reason why we should create a separate parachain to do this? Why not put it directly on the relay chain?

Joe: In the long run, we actually want to offload almost everything from the relay chain, we don't want anything to appear on the relay chain. Some of you may have heard of the term "stealth relay chain", where nothing happens on the relay chain and everything is transferred to the parachain. So, instead of just talking about assets alone, we might as well expand the scope to talk about it.

So, if you look at how parachain validation works, all the validators are put into some subgroups, our original idea was to have 10 validators per parachain, and now we think it can even go as low as Parachain 5 validators. That is, if you have 1000 validators in your network, you can have 200 parachains, at least in terms of subgroups.

So there are some other issues like networking and other issues that can be bottlenecks. But for theoretical proof stuff, let's assume 5 validators of parachains, and these 5 validators execute the state transition function of each parachain, and then they distribute these things on the network, and some other validators will do some Double check, so roughly 20 total validators per parachain execute state transition functions. In the relay chain, each validator has to execute the state transition function of the relay chain.

To sum up, if you put something on the parachain, you only need 20 validators to execute it; if you put it on the relay chain, 100% of the validators need to execute it.

So the problem with this is that if we put something on the relay chain, it actually freezes the validator resource. Because if we have 1000 validators and only 20 of them need to perform some parachain transactions, that means 980 of them can do other things, we want them to validate other parachains. So we don't want to clog validators with things like asset transactions, we want them to be able to validate other things.

So our idea is to put everything on the parachain. We are still planning to govern the parachain and Staking parachain so that these things don’t happen on the relay chain.

Jorrin: OK. So we not only improve efficiency in terms of token standards, but also improve efficiency in terms of transactions and validator computing resources.

So, if we move all calculations to parachains, will this have any impact on people using Polkadot? Will this make transactions cheaper and faster for everyday users?

Joe: Yes. The actual transaction fee is about 1/10 of the relay chain fee, which also includes deposits and various things. If you have used proxy or multisig before, you may find that you need to deposit, for example, 0.3 KSM as a deposit to use multisig, but on Statemine, 0.03 KSM may be enough. Probably everything (all kinds of fees) is about 1/10 of the relay chain, so it saves a considerable amount of money.

But it won't actually be any faster. It can only finalize its blocks as fast as the relay chain can finalize, so it won't be any faster, though it's certainly much cheaper in terms of transaction fees.

And to be honest, 1/10 is actually a value that we set on our heads, because we don't know how much it is used, so we set it to 10%, but we actually feel that after a while, as time goes by, When we have more parachains, we can actually reduce this number to about 1/50. So there is room for five times reduction in fees and deposits, etc., because it is much more efficient to put these things on the parachain than on the relay chain.

Jorrin: Great. I'm always happy to hear about cheaper transaction fees, that would be great. You mentioned the concept of a common good parachain earlier. Statemint is the first public interest parachain, can you expand on that? Talk about what it really means.

Joe: OK. So roughly speaking, the public interest parachain is added through the governance of the relay chain. So, as everyone knows, the governance of Polkadot and Kusama actually have strong governance functions. There is something called Root Origin, which is like a super user in the system. Only governance has access to this superuser power, and access to privileged functions, one of which is registering parachains.

Many people are actually confused about whether a chain becomes a parachain through auction or is directly registered as a public interest parachain, that is, who can call the function of "registering a parachain"? In fact, only governance can call. So in fact, the same function is called in both cases, but one way is directly through governance, and the other is as a result of the auction logic itself, and the auction is initiated through governance.

So in fact, I can't really control the behavior of governance. Governance may register some chains that they think are public interest parachains, but I don't think they are. So here I can only talk about my personal thoughts on public interest parachains. I think it can be divided into two categories. The first type is system-level parachains; the other type is public goods (public good) parachains, and Statemint is this type.

System-level parachains, such as DOT or KSM balances, staking or governance, just take these things from the relay chain and put them in the parachain. Doing so can free up more space for the parachain, which is what we said before to release the computing resources of the relay chain. Our original white paper said that Polkadot can support about 100 parallel chains, but in fact this is only an estimate, and some researchers even think that it can support 1,000.

The other type is public goods parachains, which are new functions and slightly different from system-level parachains. They are mainly chains that do not need a token model, or that are necessary but can directly use DOT or KSM as tokens. And they are chains that many people want to use, but may not want to build themselves. For example, use DOT or KSM as the gas fee, and use Statemine to manage the smart contract chain of assets. There are even bridges. For example, if everyone agrees that the bridge from Polkadot to Ethereum is very useful, then a slot can be used to make this bridge.

Jorrin: You just mentioned that there is a type of public interest parachain that may not have its own tokens. Statemint is actually like this, it does not have its own token, but uses the token of the relay chain, the Statemine chain uses KSM, and the Statemint chain uses DOT. So how exactly does this approach work?

Joe: We have a special type of cross-chain message called Teleport. So on the Statemine side, it trusts its own relay chain (Kusama). It should be said that many parachains are the same. They should trust the relay chain because the relay chain provides them with final confirmation. Basically, if the relay chain sends a message to our Statemine that contains some KSM, instead of minting an asset in the Asset module, we mint it in an account in the Balances module.

Other chains may do things differently. For example, some community chains are some kind of smart contract platform. If you send KSM to the relay chain, they already have their own native token in the Balances module, so they may mint KSM into other types of tokens, even ERC20 tokens.

Correspondingly, the process from Statemine back to Kusama chain will be more complicated. Because the Kusama relay chain does not actually trust all parachains, because parachains have their own governance. Although Statemine is a special case, its governance is the same as that of Kusama, but some other parachains may have Sudo (note: similar to super-supervisor authority in governance).

So the Kusama relay chain does not necessarily trust the KSM from the parachain, it may keep recording "OK, I sent 1000 KSM to the parachain A and 2000 to the parachain B", the relay The chain will not allow parachains to send back more amounts, because these parachains, such as those using sudo, will mint more KSM of other types and then send back, and the relay chain does not really want to receive more than it The amount of KSM sent. So the relay chain will actually record how many KSMs exist and where they are distributed.

As for Statemine, because it is the same governance body and the same group of stakeholders as the relay chain, the Kusama relay chain actually trusts Statemine. The relay chain will say, I trust all the KSMs from Statemine. So this is called a trusted teleporter (Trusted Teleporter). In Runtime, certain parachain IDs will be set as trusted teleporters, and KSMs from these chains will be accepted. So in a way, the KSM on the relay chain is the same as the KSM on Statemine.

Jorrin: Cool, so KSM is used as a transaction fee for operations on Statemine?

Joe: That's how it is now. But in the future, you can actually use some other asset to pay transaction fees without even needing to have any KSM.

Jorrin: That's too strong. Does this take a long time to achieve? Or will it happen soon?

Joe: Soon, this will actually be realized soon.

Jorrin: At that time we may have to ask you to come back and talk about how it was implemented. We talked before that Statemint's governance is proxied by the relay chain governance. So, how is the Runtime upgrade on Statemint implemented? Is it a governance proposal initiated on the relay chain, voted by DOT/KSM holders, and then implemented on Statemint?

Joe: Doing Statemint is actually a big improvement in development technology, because we have a conceptual idea that Statemint should accept messages from the relay chain at a literal denomination. We want the source of governance on Statemint to be consistent with that of the relay chain. And we hope that the council (of the relay chain) has some powers, such as the collector selection module, the asset module, and some functions to force the creation of assets. We hope to have a majority of the Kusama Council able to create assets on Statemine. Or in order to upgrade the Runtime of Statemine, we need the root origin of Kusama.

These seem to be quite simple for a chain, but the Statemint chain runtime is very simple, it only has Accounts, Balances, Assets and Unique modules. It does not have a Collective module to represent the council or technical committee, it does not have a Democracy origin, and it does not have these primitives around governance at all.

So we need to find a way, like Statemine expresses that the root origin of Statemine is the root origin of Kusama, or that the Assets Privileged Origin of the Kusama Council exceeds 50%. This sounds like a simple idea in theory. But you're essentially saying to Statemine "hey, there's another chain called Kusama, it's your parent chain, and it has something called a council, and if more than 50% of the council sends you a message , then you have to listen to it and accept the news as Assets Privileged Origin."

Statemine doesn't even know what the Collective module is, it can't reason it out, so these Origins are actually created to make the things mentioned above come true. This requires adding some new functions in the cross-chain message and council logic in Kusama's runtime upgrade to achieve these things. After that, the whole process actually went through. Now that we have these Origins, when the governance entities of some other chains send messages to Statemine, they can do it similarly.

Back to the upgrade of Statemine runtime, a referendum is indeed required, which is generally accelerated by the council, but it still needs to be voted by general holders or the entire community, and then a message will be sent to Statemine, which contains a clear instruct.

Jorrin: Statemint is mainly jointly developed by the Web3 Foundation and Parity. Are most of the public interest parachains jointly developed in this way? Or will there be a third party, that is, the project party, who will also develop public interest parachains?

Joe: I think it might be both.

Parity and the Web3 Foundation may work together to make some system-level chains. Parity implements the runtimes currently used on Polkadot and Kusama. In fact, to do system-level parachains in the future, you only need to divide them into more modular parts, such as staking runtime and governance runtime, so it is very reasonable for Parity to do these.

As for the public goods chain or the public facilities chain, there will be many community teams wanting to contribute. For example, several teams are working on bridges, Snowflake is working on Ethereum bridges, Interlay is working on Bitcoin bridges, and there are other proposals such as making Encointer a public interest parachain of Kusama. Whether the chain should become a public interest parallel chain discussion.

Jorrin: For parachain collators and validators, are there any incentives for them to participate and support these public interest parachains?

Joe: That's a good question, and it's about incentives. We mentioned before that the public parallel chain uses DOT or KSM as tokens, but we didn’t talk about Staking and governance.

Staking is actually the source of inflation. As we said before, the transaction fee of Statemint is about 1/10 of that of the relay chain. So we have no inflation, no staking rewards, no staking at all, and very low transaction fees. This brings up the question, who would want to run a collator to collect these transaction fees?

Because things like staking and governance are actually an indispensable core part of the network, those who develop applications on Polkadot will actually be collectors, for example, if you deploy some assets on Statemint, or you are running verification People node, you want to make sure that everyone can nominate you, and the transactions you nominate are on the nomination chain, then you may want to run some collector nodes to ensure that this chain can be used normally, so that users can use yours normally Services provided by the application.

Jorrin: This is actually a game theory model. People actually tend to do things that are beneficial to themselves. If your application depends on the smooth operation of Polkadot, then you have an incentive to support these public interest parachains.

As Kusama is a more experimental network, all new things are uploaded to Kusama first and then Polkadot, so will Statemine completely part ways with Statemint? As time goes by, the route of the Statemine chain will be determined by Kusama governance. Will they make some changes to Statemine that are different from Statemint?

Joe: Yes, it's entirely possible. But because its logic is very simple, I should be quite surprised if there is a big divergence in the routes of the two chains. In fact, it only has two modules, Assets and Unique. If you are talking about adding new modules, or just modifying parameters, there may indeed be differences. But from the perspective of the professional division of labor of the chain, it is just a chain that focuses on assets, so there may not be much difference between the two.

But anything can happen, because I am not the Kusama council, so just listen to my opinion. But I guess the two chains should be very similar.

Jorrin: Anything can happen in a DAO (Decentralized Autonomous Organization), right?

Joe: Yes.

Jorrin: By the time you hear this episode, Statemine should have enabled permissionless asset registration, so you can create your own coins on it, and I might make a Jorrin coin, haha.

That's it for today's show, thanks Joe, do you have any last words?

Joe: Nothing. You can take a look at Statemine.

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama-statemine-rpc.paritytech.net#/assets

Original audio: https://relaychain.fm/a-deep-dive-into-kusamas-asset-hub-with-joe-petrowski

Translation: PolkaWorld


Polkadot
Welcome to Join Odaily Official Community