ceramicnetwork / CIPs

The Ceramic Improvement Proposal repository
https://cips.ceramic.network/
MIT License
83 stars 22 forks source link

NFT DID Method specification #95

Open oed opened 3 years ago

oed commented 3 years ago

Discussion for CIP-94

codynhat commented 3 years ago

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

oed commented 3 years ago

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.

codynhat commented 3 years ago

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?

oed commented 3 years ago

Yes exactly @codynhat 👍

codynhat commented 3 years ago

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

oed commented 3 years ago

@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 :)

codynhat commented 3 years ago

Awesome! I'll take a look.

RobertOttSWITCH commented 2 years ago

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.

oed commented 2 years ago

@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

RobertOttSWITCH commented 2 years ago

@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.

ntn-x2 commented 2 years ago

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

Amirjab21 commented 2 years ago

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

qbig commented 2 years ago

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>
    }
     */
})();
oed commented 2 years ago

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

qbig commented 2 years ago

@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 commented 2 years ago

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

oed commented 2 years ago

@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.

qbig commented 2 years ago

@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

oed commented 1 year ago

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