CIPs icon indicating copy to clipboard operation
CIPs copied to clipboard

NFT DID Method specification

Open oed opened this issue 3 years ago • 19 comments

Discussion for CIP-94

oed avatar Mar 08 '21 13:03 oed

This is awesome. What other components are needed to enable an NFT to own and control a Ceramic doc? A DID provider?

codynhat avatar Mar 08 '21 21:03 codynhat

There needs to be an implementation of a DID Resolver. This is the first need.

Then possibly a separate provider. Although it would be nice if you could just use the provider of the DID that is the controller of the NFT DID. I think this should be possible.

oed avatar Mar 09 '21 09:03 oed

Ah ok. I've been trying to figure out the difference between a provider and resolver. Is this right?

DID Resolver -> General DID standard for resolving a DID document from a DID DID Provider -> Basically EIP-2844? So something that allows a DID to authenticate, sign, and decrypt?

So if a NFT DID resolver existed we could go from a did:nft -> DID document -> If the controller of the DID document is did:key or did:3, use an existing DID provider?

codynhat avatar Mar 09 '21 18:03 codynhat

Yes exactly @codynhat 👍

oed avatar Mar 09 '21 18:03 oed

Cool. Thanks for helping me understand! This is definitely something we are interested in and may be an area we can contribute.

codynhat avatar Mar 09 '21 18:03 codynhat

@codynhat Hacked together a quick prototype of the resolver. https://github.com/ceramicnetwork/nft-did-resolver

Feel free to contribute! Will likely pick it back up when I have more free time, but don't think I'll get much longer today :)

oed avatar Mar 21 '21 17:03 oed

Awesome! I'll take a look.

codynhat avatar Mar 22 '21 23:03 codynhat

Is this proposal still active? I was wondering if the DID should not include the chain-id to identify on which chain the NFT resides.

RobertOttSWITCH avatar Feb 10 '22 13:02 RobertOttSWITCH

@RobertOttSWITCH it does include the caip-2 chain_id! This proposal is active and has an experimental implementation here: https://github.com/ceramicnetwork/nft-did-resolver

oed avatar Feb 10 '22 13:02 oed

@RobertOttSWITCH it does include the caip-2 chain_id! This proposal is active and has an experimental implementation here: https://github.com/ceramicnetwork/nft-did-resolver

Oh, perfect, I didn't get that in the first place, thanks.

RobertOttSWITCH avatar Feb 10 '22 13:02 RobertOttSWITCH

Is there any plan for the specification and implementations to support Polkadot/Kusama + parachains NFTs?

ntn-x2 avatar Mar 15 '22 07:03 ntn-x2

Can smart contracts that currently own NFTs also update the data stream or does it only work with user wallets?

Amirjab21 avatar May 28 '22 15:05 Amirjab21

how would this support solana. get owner of solana NFT seems more straightforward and doesn't require a offchain indexer like subgraph

https://github.com/ChainAgnostic/CAIPs/issues/107

Solana Mainnet

solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-token:{the-token-mint-address}/{the-token-account-address}

Solana Devnet

solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K/spl-token:{the-token-mint-address}/{the-token-account-address}

import { Connection, PublicKey } from "@solana/web3.js";

(async () => {
  const connection = new Connection("https://api.mainnet-beta.solana.com");
  const tokenMint = "9ARngHhVaCtH5JFieRdSS5Y8cdZk2TMF4tfGSWFB9iSK";

  const largestAccounts = await connection.getTokenLargestAccounts(
    new PublicKey(tokenMint)
  );
  const largestAccountInfo = await connection.getParsedAccountInfo(
    largestAccounts.value[0].address
  );
  console.log(largestAccountInfo.value.data.parsed.info.owner);
  /*
    PublicKey {
        _bn: <BN: 6ddf6e1d765a193d9cbe146ceeb79ac1cb485ed5f5b37913a8cf5857eff00a9>
    }
     */
})();

qbig avatar Jun 01 '22 07:06 qbig

@qbig is it possible to get the owner of an NFT at a past moment in time? e.g. given a timestamp?

oed avatar Jun 01 '22 11:06 oed

@oed I think you can.

  1. with the unique mint account for each NFT, you can find out all its token accounts(at any point of time, only one of them has quantity 1, the current owner)
  2. all accounts are mostly created when they receive that NFT for the first time. So we we could assume each owner only buy the same NFT once, it would be easy to figure out who owned it at a past moment by just sort the owner by their creation time.
  3. but it get more complicated when:
  • someone manually created a token account with 0
  • past owners has buy and sell the NFT multiple times Then we would have to sort all the transfer transactions and find out

qbig avatar Jun 01 '22 11:06 qbig

@oed could you share why " owner of an NFT at a past moment in time" is important?

qbig avatar Jun 10 '22 11:06 qbig

@qbig In order to validate historical commits that are signed by previous owners of the NFT we need to be able to resolve this owner. Otherwise the event log would be invalidated every time the NFT changes owner, meaning that all data would be lost.

oed avatar Jun 17 '22 09:06 oed

@oed argh I see. So it's not just the current owner, but past owners of every commits in the past that are required. To obtain the info for Solana, we need to grab every past transfers https://github.com/solana-labs/solana/blob/edefaa437f136479774e556f4d429d653198a0b1/explorer/src/components/account/history/TokenTransfersCard.tsx#L248

qbig avatar Jun 20 '22 04:06 qbig

Big update to reduce complexity of the NFT DID implementation: https://github.com/ceramicnetwork/CIP/pull/126

oed avatar Apr 21 '23 06:04 oed