metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.31k stars 6.27k forks source link

Unable to sign NFT creator using Candy Machine v2 #1332

Closed beaubrewer closed 2 years ago

beaubrewer commented 2 years ago

Unable to sign NFT creator property using Candy Machine V2 Signing the creators is an important step especially if you are using the creators pubkey to determine validity of a particular NFT. After creating a CMv2 and minting, the creators array shows the CMv2 PDA as a creator and verified = 1. The creator (individual that uploaded the assets and created the Candy Machine, is listed but verified = 0. This is expected.

Signing is done with a single NFT using the Candy Machine sign command, or you can sign all NFTs from a particular Candy Machine by using sign_all.

This works perfectly with Candy Machine V1 but is broken in Candy Machine V2.

To Reproduce

  1. Create your Candy Machine v2
  2. Mint NFTs
  3. Attempt to sign NFTs (either sign or sign_all)
  4. No error is thrown, but the Metadata is never updated to show the creator as verified = 1

Expected behavior After signing the creator should have verified = 1

Additional context I have been able to sign the NFTs using Metaboss with one caveat. You need to list the PubKey found in the NFTs metadata vs. the Candy Machine ID as you would expect. metaboss sign all -k <keypair> --candy-machine-id <pubkey of the first creator in metadata>

This is a workaround, but I would expect Candy Machine V2 to be able to sign properly.

beaubrewer commented 2 years ago

The program log shows this failed transaction after attempting to sign using CMv2:

1 Metaplex Token Metadata instruction

Program log: Instruction: Sign Metadata > Program log: Incorrect account owner Program Metaplex Token Metadata consumed 1812 of 200000 compute units Program returned error: custom program error: 0x39

darek292 commented 2 years ago

@beaubrewer how were you able to get this working? I've created a test NFT with 2 images (using CM V2), minted both and then tried to sign using:

metaboss sign all -k <keypair> --candy-machine-id <pubkey of the first creator in metadata>

Where keypair is the keypair of the first creator in the metadata and candy machine id is the address listed under creator under creators[0].address (I only have one creator with share = 100).

I also tried to run it with keypair set to the account that created the candy machine (which is different than the creator listed in the metadata). No luck in any case and all I'm getting is "No unverified metadata for this creator and candy machine" no matter what I do. I've tried post-mint, pre-mint, mid-mint, sign one, nothing appears to work.

Solscan also confirms it's unverified, I think this is a huge blocker. I believe royalties won't work if the creator(s) aren't signed?

beaubrewer commented 2 years ago

@darek292 I'm not sure why there is only a single creator in your metadata. You should have two. One being the candy machine, which is already marked as verified, and the other should be yours with share = 100. I'm assuming another process is removing the candy machine creator before you get to this point, but that's a total guess.

Screen Shot 2021-12-29 at 9 32 05 PM

After signing with metaboss, the "verified" property in the second creator gets set to 1 as expected.

darek292 commented 2 years ago

Sorry, I wasn't clear but had two as well. It simply worked later today, not sure what was up. Thanks anyhow!

samuelvanderwaal commented 2 years ago

FYI, with metaboss you can add --v2 to your command to allow you to use the pubkey of the candy machine as you originally expected:

metaboss sign all -k <keypair> --candy-machine-id <candy_machine_id> --v2

CMV2 has a candy machine id (found in your cache file) and a separate creator key it can sign with that it puts in the creators array. Which one were you using for the cm cli command?

beaubrewer commented 2 years ago

@samuelvanderwaal This doesn't appear to be working. Do you have a successful test case of this? Adding the --v2 flag and using the pubkey of the candy machine would be awesome if it worked.

I have tested this a number of times now and it never finds or signs any of the unverified mints.

samuelvanderwaal commented 2 years ago

@samuelvanderwaal This doesn't appear to be working. Do you have a successful test case of this? Adding the --v2 flag and using the pubkey of the candy machine would be awesome if it worked.

I have tested this a number of times now and it never finds or signs any of the unverified mints.

Can you open an issue on the Metaboss repo with your CM idand an example token you tried to sign for?

We also have someone assigned to this bug for the candy-machine-cli so should be fixed soon.

SudarminThen commented 2 years ago

Is this sign all v2 is needed for all the NFTs minted from CMv2? Why is it not in the documentation?