For now I think we already had some knowledge about Linera microchain, application, smart contract. But we still lack of knowledge about the Linera Token mechanism. What I would like to learn is not about the economics, or consensus, but more about the implementation. Because I still cannot imagine how will the Linera Native Token be implemented with the microchain architecture. Did anyone know about that ?
Every Linera system has a special āadminā chain already to manage the voting rights of validators. We are currently implementing the protocol for the admin chain to be āpublicā, that is, managed by the validators ā as opposed to being a āuser chainā in the current implementation.
For other aspects of Linera governance, such as managing the native token, we plan to use a similar setup with the same āadminā chain or another one. Governance will likely be programmed in native Rust rather than Rust/Wasm for efficiency reasons. They will be special logic for rewarding validators in function of their stakes, etc.
Understood.
As I know currently assets of each microchain(or application ?) will not be synced to other microchain (please correct me if Iām wrong, ). But I think in a production scenario we still have to keep some global state in different microchain.
For example, if I would like to query the native token balance of an address in one microchain, may be I would like to get its global balance but not only on this microchain.
Could you please also explain something about that ?
I imagine most users will keep their tokens on only one chain.
Maybe sometimes one or two other chains that they interact with. But there shouldnāt be a need to scan the whole system and check every microchain to look whether they have tokens there.
Thereās no concept of a āglobal balanceā in the system: Every token is on only one chain at any given time.
So for native token, per @ma2bd 's discussion, itāll be managed with āadminā chain ? If another chain need the native token balance, should it check with āadminā chain ?
And for the deposit scenario such as dex, when the native tokens are transferred to dex address, itāll be recorded in āadminā chain, and the dex application should record the deposit share of each address ? Do I understand right ?
No, itāll actually be called the native token on every chain.
In the dex scenario, the admin chain would not be involved:
- Say your chain has a (native token) balance 3.
- You submit a
Transfer
operation to your chain to send 2 tokens to the dex chain. That decreases your balance to 1 and sends a message to the dex chain containing the 2 tokens. - The dex chain includes the incoming message in a block and increases its balance by 2.
Thatās safe because all chains are managed by the same set of validators and they ensure that they all follow the same rules: no chain can double-spend or freely mint tokens, every received message has actually been sent, and can only be received once.
No, itāll actually be called the native token on every chain.
=> For example, we have ETH on ethereum which will be used as gas globally for ethereum chain. Will that be the same on Linera ?
Yes. Generally speaking, Linera microchains are used to structure computation and blockspace but are not sovereign in any way (same validators, same native token, same gas mechanisms).
Do you mean there wonāt have a native token in Linera like ETH for ethereum ? Any application which would like to deployed with Linera will need to create its own native token, right ?
nice work nice worknice worknice worknice work
The microchain is more likely to be like our backpack, I think, heās like a chain that will have two chains synchronized on it, one accessible to the public, and the other one is more like independent, theyāre synchronized in the display, one public, one for ourselves. Itās more like a big tree, you know, heāll extend a lot of branches and leaves, but his main body is unchanged, I think thatās my understanding.
No, there will be one native Linera token. Itās just not tied to any particular microchain. It can be freely sent from one chain to another.
Applications will be able to use it, too. (We might expose it via the same interface as the fungible
app, or something similar.)
yeah. thatās what i would like to be clear about. some questions i would like to understand:
1 will this token be used as gas in Linera chain ?
2 can i get account balance of this token on any microchain ?
3 if some amount of this token is sent to an account, will the application on microchain be notified ?
4 can this native token be sent to an application (like ethereum to be sent to smart contract address) ?
sorry so many questions,
- Yes (probably)
- Yes, but itās different on every chain. You should rather think of every chain as a different account, even if you can access them using the same key.
- I donāt think thatās decided in detail yet. I imagine we wonāt have an additional contract API function for handling incoming transfers. Maybe youāll be able to send along tokens with a message; or it might work via two separate messages, like with the fungible+crowd_funding examples (with the native token instead).
- Probably yes.
Weāll have more definite answers to those questions soon. But Iām pretty sure we will support all the use cases for applications using tokens. You should be able to do anything you can do on other blockchains in that respect.
There are several options but so far the most elegant one IMHO is that the native token has an application ID and a similar ABI as any user token (created by instantiating the fungible-token code in Wasm).
Great, great. Canāt wait for the native token implementation and try.
Looking forward to the arrival of the test network
We now have a native fungible token app in the examples on the main branch.
The next step would be to pre-deploy the app in testing network. (This is not strictly necessary but would make it easier on people.)
Read the code here linera-protocol/linera-sdk/src/abis/fungible.rs at main Ā· linera-io/linera-protocol Ā· GitHub and understood the token mode of Linera, . I note in the Operation::Transfer, Account is used as target_account. Itās contain chainId and AccountOwner.
Just has some curious: If someday we have some probability (or thatās nonsense ? , feel free to correct me) to use Linera browser node service as a data provider of exist wallet such as metamask, how to let metamask know about Linera account ?
Ok so that is a different question but we have some ideas to make Ethereum addresses usable for Linera accounts.
On top of that, if we want to make it really easy to transfer funds to a Linera account from another chain, it would be useful to have a notion of ādefault microchainā for each Linera account.