MixinNetwork / mips

Messenger Improvement Proposals
https://mixin.one/mm
Apache License 2.0
2 stars 0 forks source link

Possibilities of NFT #26

Open cedricfung opened 3 years ago

cedricfung commented 3 years ago

Is it possible to support NFT in Mixin Messenger?

cedricfung commented 3 years ago

It's possible to make ERC721 or even ERC1155 work on Mixin Messenger without changes on the Kernel.

Every NFT of ERC721 has a distinct uint256 ID, we can make the ERC721 contract as a normal Kernel asset. The messenger API will only allow a whole and single NFT transfer, the transfer will make a transaction on the Kernel with a single UTXO, and the uint256 ID is included in the extra.

The ERC721 account API is the same as a normal fungible asset account. Let's say the ERC721 account has a balance of 7, then it must own 7 UTXO with 7 distinct uint256 ID extra. Beside the basic account API, list an account of ERC721 can return all the UTXOs. And to make a transfer for this kind of account, the UTXO ID must be included.

ERC1155 is no different either, just allow an account has multiple UTXOs with the same uint256 ID extra.

So this NFT feature is carefully enabled by Mixin Messenger and other wallets, if they have bad implementations, they may destroy their NFT tokens. It's the consensus of wallets, without any Mixin Kernel changes.

cedricfung commented 3 years ago
  1. https://eips.ethereum.org/EIPS/eip-721
  2. https://www.bondly.finance/
  3. https://opensea.io/
cedricfung commented 3 years ago

For some popular NFT operations: e.g. mint a new unit, burn a unit, it's easy to make it free on Mixin Messenger.

event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);

We could make an ERC721 contract:

  1. it creates a huge amount of units, e.g. 1000, then deposit them all to the MTG through a single contract calls.
  2. that deposits emits 1000 Transfer events on Mixin Domain and create 1000 UTXOs.
  3. then the MTG can mint new unit to its users free and fast on Mixin Network without Ethereum calls.
  4. when running out of those 1000, the MTG can request and mint new to the Mixin Domains.

The IMPORTANT thing is Mixin Messenger API should never allow these special UTXOs being seperated, and always retain the UTXO extra data.

cedricfung commented 3 years ago

How do we handle those expirable tokens, e.g. ENS?

cedricfung commented 3 years ago

How do we handle those expirable tokens, e.g. ENS?

A NFT UTXO should include both the token ID and deposit address in the extra. Thus every NFT is bind to the address. Whenever the NFT on an address expires, it doesn't affect others to deposit again.

And we also must ensure that a NFT token ID can't have more than 1 copy for 1 address. e.g. a domain cedric.eth on address A and B are different, and on address A, you can only have on domain cedric.eth.

And we should never mark an NFT dead or inactive or frozen, because the expired one can be reactivated at any time without change the amount.