NFT module on the Hub #9065
Replies: 21 comments 111 replies
-
Thanks for writing this up! Your simple proposal is basically what I've had in mind for a while and is what is currently on our roadmap for the next SDK release (0.44). We should align on how the permissions logic works to make sure it meets the needs you're describing. |
Beta Was this translation helpful? Give feedback.
-
Thank you Deepanshu!
|
Beta Was this translation helpful? Give feedback.
-
I started working on an NFT module (based on IRIS's stargate module) as part of Sommelier that we needed to handle custom NFLP tokens from uniswap relayed through the Gravity bridge. The main issue with it was that it didn't support custom NFTs because it doesn't support proto.Any. If I were to redesign the module I'd maybe just have a basic NFT module that only supports minting burning and transferring NFTs. Collections, DIDs and marketplaces can be built on external modules that import this NFT module. Ref NFT with proto.Any: PeggyJV/sommelier#37 |
Beta Was this translation helpful? Give feedback.
-
@ig-shaun just added a new discussion topic with the framing that came out of our work in the Interchain NFT and Metadata working group over the last half year. #9110 We've separated it out so the community can discuss, as separate options, what we do in the immediate term and what we do long term. Our basic premise is that the immediate term option can, and should, be aligned with a longer roadmap that ultimately results in a distinct advantage for building NFTs in Cosmos. In short, we like starting with the BaseNFT module, in particular with the Stargate port developed by IrisNet. Out of the box, that's a compelling first option, from which we can add new features. We've outlined how we see that roadmap evolving, including how to provide composability and DID functionality early--because there are fairly straightforward options for doing this with minimal changes to the IrisNet implementation. FWIW, we are actively working with other chains to apply this same IID approach as an iterative development for NFTs. Here's the abbreviated roadmap for any blockchain:
This allows existing token infrastructure to leverage DID approaches without adjusting other token functionality: current getters and setters work as normal. The DID Document simply standardizes a particular view of that functionality.
This enables literally any kind of derivative to be defined and implemented, rather than attempting to pre-define a subset of derivatives that are hard-coded into the module, such as "splittable"
Just like DIDs, IIDs are blockchain agnostic, providing a mechanism for existing systems to represent their control mechanisms in a standardized way. Any NFT system that adopts IIDs and uses IID Documents to present the interface for tokens, will be compatible with both emerging DID systems (authentication, authorization, and wallets) as well IID systems on on other chains. Anything else either recreates that mechanism as a new standard, or is using bespoke, custom approaches that will not be compatible across chain and possibly not with similar NFT approaches even on the same chain. We make that case in more detail in the discussion at #9110. Our short take on the proposal here is that we find the IrisNet iteration on Base NFT to be a particularly compelling immediate term solution with sufficient long-term alignment with the IID vision. |
Beta Was this translation helpful? Give feedback.
-
My preference is have a very simple NFT custody module on the HUB that could integrate with some kind of trading functionality and a NFT IBC spec. All you could do with NFTs in the Hub is hold and transfers them. There might be some opaque structured data that hub would route but not operate over. The Hub would just a custodian and trading house for NFTs. Functionality for NFTs and minting/burning would happen on Zones. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm Tendermint's new Director of NFTs, so Tendermint's approach to this is largely going to be my responsibility. There's a lot here, and a lot of it is great, so I don't want to dismiss any of it but there's too much to just respond to all of it. But here's my current thinking so you can start yelling at me :)
My lens for this is Pylons, which is an NFT lifecycle zone I've been working on for a few years, and supporting a community of zones adjacent to Pylons, to do marketplaces, lending, whatever. So it's about IBC between these zones, and what kind of envelopes are needed to make that IBC really work. Finally my core question about modules on the Hub is why should it be on the Hub? What does the Hub care? This isn't a dismissal, it's a real question that we need total clarity about when we're adding modules, IMO. |
Beta Was this translation helpful? Give feedback.
-
Here is my concrete plan of action that I shared with @charleenfei and @hulatown privately:
Imo only 1. should live on the SDK, while the other modules (2. and 3) should live on other app-specific blockchains. NFT interoperability should be spec'ed considering only 1. |
Beta Was this translation helpful? Give feedback.
-
This discussion seems to be centered around the hub. Should this be the first module that lives in gaia? If not, this module may be a good candidate for having its own go.mod (cc @aaronc) I would like to hear from maintainers of the sdk about this. |
Beta Was this translation helpful? Give feedback.
-
A quick update on this topic for everyone who has participated so far, there will be an ADR open next week for review. Appreciation for all the thought and consideration so far 🙏 , and looking forward to formalising and finalising this topic. |
Beta Was this translation helpful? Give feedback.
-
NFT to use x/bank for IBC and asset registry / balance bookFollowing the discussion and review of ADR-43 I want to discuss an alternative approach extending @aaronc comment above . Design goals:
ProposalWe don't define x/nft module. Instead we define a minimal interface and behavior using x/bank and DID. In this proposal we will utilize x/bank to become de facto a balance sheet of Cosmos assets and have a minimum interfaces for NFT Msg Server. That interface can be extended by various implementations. Each NFT will be stored as a new token (denom) in x/bank with total supply = 1 and unique ID. ID should be defined using DID standard (which is very easy to begin with - an app will need to decide about the method name). service Msg {
rpc MintMonster(MsgMintMonster) returns (MsgEmptyResponse);
rpc Burn(MsgBurn) returns (MsgEmptyResponse);
// cease
rpc Clawback(MsgClawback) return (MsgEmptyResponse);
}
message MsgMintMonster {
string did = 1;
string owner = 2;
// fields for bank.Metadata, we can pack them in bank.Metadata here.
string name = 4;
string symbol = 5;
// URI, Description and Dispalay is optional because the NFT is represented as DID.
string uri = 6;
string description = 7;
string display = 8;
// other NFT specific attributes
string age = 9;
int power = 10;
// probably we don't need Any - we can have concrete attributes for each NFT category which are
// linked to the rpc method.
// google.protobuf.Any data = 3;
// NOTE: minter is not needed - current transaction signer is the minter.
// string minter = 4;
}
message MsgClawback {
string from = 1;
string to = 2;
string did = 3;
}
message EmptyResponse {} The NFT Msg service will depend on x/bank keeper or Msg service. Hence it should be able to create new tokens (denoms) as well as burning. The pseudo code for the Mint method is following: func (m Msg) MintMonster(ctx context.Context, msg *types.MsgMintMonster) {
m.keeper.AssertDoesNotExist(msg.DID)
// mint coins for the current module
coin = skd.Coins{{Denom: msg.DID, Amount: sdk.One}}
// we are extending the bank Mint to add the minter information with related event.
m.bank.Mint(ModuleName, GetSigner(ctx), coin)
m.bank.SetDenomMetadata(bank.Metadata{Base: msg.DID, msg.Name, msg.Symbol, msg.URI, msg.Description, msg.Display})
// send coin to the owner
m.bank.SendCoinsFromModuleToAccount(ModuleName, ModuleName, msg.Owner, coin)
m.keeper.SaveMonster(msg.did, Monster{msg.Age, msg.Power})
}
// Cease token from one account and move it to another.
func (m Msg) Clawback(ctx context.Context, msg *types.MsgMintMonster) {
// service can set admin addresses to manage who can cease NFTs
assertIsAdmin(ctx);
assertDenomRegistered(msg.DID);
coins = skd.Coins{{Denom: msg.DID, Amount: sdk.One}}
m.bank.SendCoins(ctx, msg.From, msg.To, coins);
} NFTs can be derived using a custom logic, which will create a new token (denom) in x/bank and either burn the "parent" NFT or keep both as active. Furthermore we will require that the Derived tokens will link themselves using DID document. The interoperability is assured by:
Identifying NFTs using DIDNFTs SHOULD be identified using DID. Implementing DID standard is an iterative process, easy to begin with, which brings lot of benefits. Not using DID may lead to re-engineering or adding adaptors and lessons learned effect. Here I would like to copy the excellent comment by Shaun:
Adding DID fragments allows for multiple fungible tokens to be associated with a base NFT. For instance Tying a supply of (one or more) fungible token sets with a DID Denom in Bank to the same non-fungible token Denom in baseNFT would enable fractional shares of an NFT to be issued in a way that the non-fungible asset is directly linked to its fungible derivatives. This seems to be a core requirement for many NFT use-cases. Services for functions such as The bank module now allows long strings for Denom, so this should not limit using a DID for denom. However, there could be an implementation restriction with this approach as standard Regex does not allow colons as used in DID uri's From what I understand, this can be over-ridden. But is the Regex over-write on one chain likely to break on another chain when a DID Denom gets IBC transferred (may relate to #7027)? The benefits of x/bank
By using x/bank to be a common module for keeping the balance we unify the way how tools interact with SDK to transfer assets. This approach makes x/bank a balance sheet for all SDK assets, essentially to:
Finally, it will make different NFT implementation interoperable by using the common x/bank interface. Neutral consequences
Cons of using x/bank
We could gain extra functionality by creating a NFT specific common layer similar to x/bank. However that will duplicate lot of work and complicate interoperability. TODO
|
Beta Was this translation helpful? Give feedback.
-
I just created a proof-of-concept more of the irismod nft module which uses This is just to demonstrate that this approach does not require a bank refactor other than adding If we want a master "read-only" |
Beta Was this translation helpful? Give feedback.
-
@zmanian wrote:
As diplomatically as possible, this is rubbish. DIDs are not yet even a formal published standard (they are in the Candidate Recommendation stage at the W3C). To assert they are failed is at best erroneous. If you don't believe in DIDs as a forward-looking opportunity, that's a fine judgment. It's not mine, but it's valid. Asserting DIDs are a failure before they've even finished becoming a standard is just FUD. The proposal to use DIDs for NFTs came out of work paid for by ICF and led by @ig-shaun and myself. We spent ~6 months hosting weekly calls, gathering requirements, and proposing a solution that applied the best DID thinking to the best NFT thinking in the Cosmos context. The result was an understanding of a large number of use cases that could not be met with arbitrarily simplistic notions of what an NFT or FT is. The momentum in the community is clearly going towards a base/NFT module that is not forward-looking and that by design has extremely constrained functionality. That's fine, I, at least did not take on the task of convincing the Cosmos community of the quality of our proposals. Rather, we did the work, shared the work, and its up to the community to decide how, if at all, we advance that work. However, mischaracterizing our proposal as
|
Beta Was this translation helpful? Give feedback.
-
at the module architecture structuring call on Friday of last week, we discussed finalising the ADR spec (as @chengwenxi) has done this morning to an implementation which exposes an ERC721 compliant API to end users and using the bank module (no refactor of the current bank module necessary) as the underlying metadata and token storage mechanism. DIDs as a token URI would be incorporated in a later implementation, as to not conceptually introduce what should be two large concepts and interrelated but not necessarily interdependent concepts (NFTs and DIDs) in one ADR. @zmanian @fedekunze you had a preference against using the bank module, but would those concerns block this version of the NFT ADR? 0092c53 @ig-shaun @jandrieu you have expressed in favour of pulling DIDs into this ADR, but would this concern be a blocker consideration for a go ahead of the basic NFT module (with a forward looking perspective that the token URI string can be a DID if the sdk application developers choose) in your opinion? looking forward to getting consensus here and landing an NFT module on the Hub and into the SDK which is usable out of the box and serves the widest swathe of potential users! |
Beta Was this translation helpful? Give feedback.
-
Minting needs to be possible on the keeper of whatever module is storing the NFTs. It should not be executed by the handling of any Msg. It should be able to be imported into custom modules that handle the logic of minting on custom chains, or on the Hub, it should only be imported by the NFT-IBC module. Users should not be minting on the hub, just the IBC module. I don't understand why any of this benefits from being imported into the bank module. When you run a command like Permissions around controlling the keeper of the NFT module should be custom built by each blockchain for their own purposes. This includes updating the URI, minting, burning, transferring etc. The whole point of not blocking this work on DID and IID was that it's too complicated to try building that now. The purpose of this discussion is to ship a simple NFT module ASAP and that means the simplest version that satisfies IBC and users can take as starting points for their own purposes. |
Beta Was this translation helpful? Give feedback.
-
Using x/bank for mintingFollowing above discussion about updating x/bank for doing more convenient minting. #9065 (comment), #9065 (reply in thread), It's very easy and IMHO we could enable that API at the keeper level and later design for service level if needed. It's been shown that it's easy: #9537 Aaron, shall we PR that into bank? Does anyone is against it? |
Beta Was this translation helpful? Give feedback.
-
Use or not use x/bankIt seams we don't have clear buy out to use x/bank for NFT book keeping. @okwme is proposing to move back to the standalone nft module. #9329 (comment) In a post above, I've outlined the motivation and advantages of using x/bank for being a balance book. I want to repeat that we don't need any change in x/bank to use it with other modules as a balance book, which has been shown in this NFT implementation: #9603. That being said it's good motivation to make the bank keeper more friendly. Using x/bank doesn't mean that we can't have customization. Even opposite! An NFT module should be able to build on the x/bank and provide more functionality. The key here is to reuse the x/bank rather then copying and reinventing a wheel. Moreover we all talk about hooks, and that would be again another perfect use-case to use hooks. I haven't seen any valid technical case where x/bank would be a blocker or an obstacle. So let's rise them here - this will be useful for all future asset related modules. @ig-shaun , @haifengxi, @iramiller - you were reviewing the ADR proposal and were implementing nft module. Would you like to share your feedback on x/bank approach? |
Beta Was this translation helpful? Give feedback.
-
As a completely separate thread I want to point out that this extensive discussion, the deep thought, and overall effort that many people are putting into this design process is an exceptional example of the high standards of quality that the Cosmos SDK community strives for. I personally want to thank everyone involved for their efforts. Regardless of which way this initiative goes I am confident that the approach taken will be well reasoned and of high quality. |
Beta Was this translation helpful? Give feedback.
-
has there been any movement on this since July? |
Beta Was this translation helpful? Give feedback.
-
@gotjoshua yep! Most of the work is being tracked on Zenhub in this issue as an epic: #9826 |
Beta Was this translation helpful? Give feedback.
-
Is there a final update or decisions being made in the background by the Cosmos team here? I'd love to be able to release an NFT market for my Tendermint SDK / Starport chain, and get a little instruction / tutorial video on NFTs for Cosmos chains. Once we get an interchain NFT marketplace, it could be a huge competitor to OpenSea. |
Beta Was this translation helpful? Give feedback.
-
NFT module on the Hub
Motivation
The Hub in its current state serves as a transport and safe storage layer for tokens generated by the IBC enabled chains connecting to it. Given the current explosion of interest and use cases in the NFT space, the Hub should also enable a unified mechanism for storing and sending the ownership representative of NFTs generated through the IBC enabled interchain ecosystem. This discussion presents the current implementations as options to be implemented on the Hub to enable NFT transfers through it.
Current Implementaions
modules/incubator/nft
The module available at the repo https://github.com/cosmos/modules/tree/master/incubator/nft is probably the oldest implementation of an NFT module in the cosmos repository, with reasonable amounts of contributions from the community. It defines NFTs as self-contained objects identified by an id string; ownership is represented through the owner accAddress field and has a URI string for metadata. The NFTs are classified through a denom string identifier and grouped in a collection(array of NFT ids). The ownership of NFTs is also represented through an Owner object that acts like an account/wallet mapping NFT collections to an address.
Pros
Cons
CW721
The smart contract available at https://github.com/CosmWasm/cosmwasm-plus/tree/master/packages/cw721 is probably the easiest migration path for migrating ERC721 NFT use-cases to cosmos hub. CW721 is an implementation of the ERC721 NFT interface in Rust for cosmwasm. The repository also implements rust contracts for other NFT interfaces.
Pros
Cons
DID NFTs
The RFCs available at https://github.com/interNFT/nft-rfc defines a way of creating NFTs as a family of DIDs called IIDs. IIDs are DIDs with an additional field called linked resources which point to service endpoints to get NFT metadata.
Pros
Cons
interNFT
The modules are available at https://github.com/persistenceOne/persistenceSDK defines an NFT standard called interNFT with identity-based NFT wallets and an NFT DEX.
Pros
Cons
Simple proposal(not finalized, needs discussion)
All the approaches defined above require some significant Hub changes with a difficult and stretched out upgrade path. This method aims to enable NFT transfers over the Hub with the smallest delta:
Basic Requirements
Wallet
Transactions
Beta Was this translation helpful? Give feedback.
All reactions