Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFT DID Method specification #95

Open
oed opened this issue Mar 8, 2021 · 19 comments
Open

NFT DID Method specification #95

oed opened this issue Mar 8, 2021 · 19 comments
Assignees

Comments

@oed
Copy link
Member

oed commented Mar 8, 2021

Discussion for CIP-94

@oed oed self-assigned this Mar 8, 2021
@oed oed added the Discussion label Mar 8, 2021
@codynhat
Copy link

codynhat commented Mar 8, 2021

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

@oed
Copy link
Member Author

oed commented Mar 9, 2021

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
Copy link

codynhat commented Mar 9, 2021

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
Copy link
Member Author

oed commented Mar 9, 2021

Yes exactly @codynhat 👍

@codynhat
Copy link

codynhat commented Mar 9, 2021

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

@oed
Copy link
Member Author

oed commented Mar 21, 2021

@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
Copy link

Awesome! I'll take a look.

@RobertOttSWITCH
Copy link

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
Copy link
Member Author

oed commented Feb 10, 2022

@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
Copy link

@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
Copy link

ntn-x2 commented Mar 15, 2022

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

@Amirjab21
Copy link

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

@qbig
Copy link
Contributor

qbig commented Jun 1, 2022

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

ChainAgnostic/CAIPs#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
Copy link
Member Author

oed commented Jun 1, 2022

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

@qbig
Copy link
Contributor

qbig commented Jun 1, 2022

@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
Copy link
Contributor

qbig commented Jun 10, 2022

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

@oed
Copy link
Member Author

oed commented Jun 17, 2022

@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
Copy link
Contributor

qbig commented Jun 20, 2022

@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
Copy link
Member Author

oed commented Apr 21, 2023

Big update to reduce complexity of the NFT DID implementation: #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants