Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.82k stars 2.03k forks source link

NFT wallet created after transferring DID with NFT [Bug] #15137

Open danieljperry opened 1 year ago

danieljperry commented 1 year ago

What happened?

I started with a DID (did:chia:1cxw5dqug4gavvgylx88zfkmqv235ryr6j9tvyjwwuga0pa52wjvqavdyar) with one associated NFT. I transferred the DID with this command: chia wallet did transfer -i 7 -ta xch1gdhch02gp6352plffxqy7ppaar2dvtnek6p2cc79nc5apqzae37sktag6l

The destination wallet shows that the DID was transferred, minus the NFT:

DID did:chia:1cxw5dqug4gavvgylx88zfkmqv235ryr6j9tvyjwwuga0pa52wjvqavdyar:
   -Total Balance:         1.0
   -Pending Total Balance: 1.0
   -Spendable:             1.0
   -Type:                  DECENTRALIZED_ID
   -DID ID:                did:chia:1cxw5dqug4gavvgylx88zfkmqv235ryr6j9tvyjwwuga0pa52wjvqavdyar
   -Wallet ID:             3

However, the source wallet now contains an NFT wallet with the old associated DID:

NFT Wallet:
   -Total Balance:         0.0
   -Pending Total Balance: 0.0
   -Spendable:             0.0
   -Type:                  NFT
   -DID ID:                did:chia:1cxw5dqug4gavvgylx88zfkmqv235ryr6j9tvyjwwuga0pa52wjvqavdyar
   -Wallet ID:             12

The source wallet shows the NFT still being custodied by the same DID, even though that DID is now associated with the destination wallet:

chia wallet nft list -i 12

NFT identifier:            nft14lh7agq6v92g0n8u9c7hpkmfan44ku26s80t48ntw2mcqelxrhnqackyz9
Launcher coin ID:          afefeea01a615487ccfc2e3d70db69eceb5b715a81deba9e6b72b78067e61de6
Launcher puzhash:          eff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9
Current NFT coin ID:       dd4a3c895d19a1b4a5c433a581c5fc3dfa25eb44d0f4ab6ecc738e4a9520c18f
...
Owner DID:                 did:chia:1cxw5dqug4gavvgylx88zfkmqv235ryr6j9tvyjwwuga0pa52wjvqavdyar

I would expect the NFT to be stored in the primary NFT wallet instead of this new wallet. Additionally, I would not expect it to have an Owner DID at this point.

Version

1.8.0rc3.dev1 (main branch)

What platform are you using?

Windows

What ui mode are you using?

CLI

Relevant log output

No response

ytx1991 commented 1 year ago

According to the current behavior, transferring a DID will not transfer related NFTs together. Since the wallet will not update anything about NFTs, so it's expected to see NFT is still belong to the old DID.

danieljperry commented 1 year ago

Is this the expected behavior? It seems strange that Wallet1 contains an NFT, which is still associated with a DID from Wallet2. The two wallets could be controlled by different people. It would seem more logical if, after the DID transfer, either:

  1. The NFT loses its DID association (Wallet1 has the NFT, Wallet2 has the DID, and they are totally separate), or
  2. The NFT is transferred with the DID (Wallet 1 has nothing, Wallet2 has the NFT and the associated DID)
ytx1991 commented 1 year ago

It's not easy to update/transfer NFTs with a DID, since we don't know many NFTs we are talking about. We can only transfer a limited number of NFTs in one transaction. This means we need users to pay more tx fee. The current feasible solution is we reject the DID transfer if there is any NFT related to that DID.