1

I am trying to perform collection verification using Solana on-chain (Rust) code.

let verify_collection_ix = VerifyCollection {
    metadata: *metadata_account.key,
    collection_authority: *payer_account.key,
    payer: *payer_account.key,
    collection_mint: *collection_mint.key,
    collection: *collection_metadata.key,
    collection_master_edition_account: *collection_master_edition_account.key,
    collection_authority_record: None,
}.instruction();

invoke(
    &verify_collection_ix,
    &[
        metadata_account.clone(),
        payer_account.clone(),
        collection_mint.clone(),
        collection_metadata.clone(),
        collection_master_edition_account.clone(),
        system_program.clone(),
        rent_account.clone(),
        metadata_program.clone(),
    ],
)?;

However, when I try to verify the collection in this way, it fails with the error log below.

  logs: [
'Program 5QV2JKhmKshShindhxERAnpbJ7yKz4Hv7S89dhLHr7cf invoke [1]',
'Program log: Start Program : 5QV2JKhmKshShindhxERAnpbJ7yKz4Hv7S89dhLHr7cf',
'Program log: Verifying collection',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [2]',
'Program log: IX: Verify Collection',
'Program log: Collection Must Be a Unique Master Edition v2',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 26200 of 180043 compute units',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x52',

When I verify using the metaplex function on the client, the verification succeeds even in the same situation, but I have no idea what the problem is.

metaplex.nfts().verifyCollection({
mintAddress: nftAddress,
collectionMintAddress: collectionAddress,});

If anyone knows how to solve this problem in Rust code, please help. I'm spending too much time on this one issue.

2 Answers 2

1

Check the master_edition address you are passing in. That might be causing it.

To also simplify your work, Metaplex provides CPI IX builders so that you do not have to worry about account management.

VerifyCollectionCpiBuilder::new(&mpl_metadata_program)
            .metadata(&metadata_account)
            .collection_authority(&authority.to_account_info())
            .payer(&authority.clone())
            .collection_mint(&collection_mint)
            .collection(&collection)
            .system_program(&system_program)
            .sysvar_instructions(&sysvar_instructions)
            .invoke()?;

docs.rs reference https://docs.rs/mpl-token-metadata/latest/mpl_token_metadata/instructions/struct.VerifyCollectionV1CpiBuilder.html

3
  • thank you for the reply. However, I reviewed the address you mentioned and changed it using VerifyCollectionCpiBuilder, but the same error still occurs. In this case, is the NFT of the collection mint, or the PDA account used as the collection metadata account the problem? That being said, verification was successful using the client metaplex function, so I don't know what the problem is. :-(
    – StarPJ
    Commented May 28 at 9:13
  • are you trying to verify an already verified collection? could you share the collection mint?
    – Jimii
    Commented May 28 at 9:49
  • 1
    When I checked, I tested it incorrectly with another NFT and the verification was successful using the Metaplex function. I tested properly again and it failed with the same error. However, the problem has now been resolved, and it has been confirmed that the error in the text occurred because the max_supply value of the master edition was specified as 1 instead of 0 when minting the collection NFT. Thanks for your help!
    – StarPJ
    Commented May 29 at 1:25
1

It has been confirmed that if the max_supply value is not set to 0 when creating a collection NFT, the 'Collection Must Be a Unique Master Edition v2' error occurs when attempting verification with the collection.

These days, if you use the client function provided by Metaplex, problems like mine will not occur, but I am leaving a solution for those who want to try NFT minting using only Rust functions like me, or for me in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.