Based on Solana cookbook, PDA is derived from program ID and seeds.

There's no possibility that program ID is different, so I thought maybe there's mistype in seeds.

I checked over 30 times seeing program's seed and test code's seed, but they are same and keep occurs "seeds constraint was violated" error.

This problem is occured trying to initialize metaplex's Collection Authority Record(not imported from library, declared at my program with same format).

Below code snippets are program/test code and I'm running my program at devnet.

  • program
// same format at Metaplex library but different data type
pub struct CollectionAuthorityRecord {
    pub key: u8,                          //1
    pub bump: u8,                         //1
    pub update_authority: Option<Pubkey>, //33 (1 + 32)

// part of InitializeCollectionAuthRec
    payer = signer, 
    space = 500, 
    seeds = [
        // collection_nft_mint.key().as_ref(), 
pub collection_authority_record: Account<'info, CollectionAuthorityRecord>, 
  • test code
it("Initialize collection authority record", async () => {
    const [collectionAuthorityRecord] = await PublicKey.findProgramAddressSync(
        // collectionNftMint.address.toBuffer(), 
        new PublicKey("22TxMWPYoBJ1dq9MVWt9eaiYyZPkoXZk8WWxaFT116UE").toBuffer(), 
        // pdaCollection.toBuffer(),
        new PublicKey("7kNPcRsksfS8KV6KtoKNMFKxY82YkWXz5QZyG3kEHynF").toBuffer(),  
    try {
      const tx = await program.methods
          signer: owner_PDA.publicKey, 
          collectionAuthorityRecord: collectionAuthorityRecord, 
          metadataProgram: METADATA_PROGRAM_ID
      console.log("View transaction in explorer:")
    } catch(e) {

If I'm missing something, plz let me kwow. Thanks.

  • can you add more context to the owner_pda account?
    – Ademola
    Commented Jul 22, 2023 at 7:52
  • owner_PDA is data account to store some public data. When creating PDA, signer is classified between owner_PDA and user with public and private.
    – 0xLuckycig
    Commented Jul 22, 2023 at 8:04

1 Answer 1


When deriving a PDA, the programId should be that of the program that owns whatever account whose PDA you're trying to find.

Here because you're defining CollectionAuthorityRecord as an account owned by your program, it follows that the program ID should be that of your program, and no longer the token metadata program ID.

  • Thank you for reply! I'm new to solana ecosystem so it was pretty confusing about detail concept of account. Understood why my code isn't working and I gotta read Solana docs more precisely. Thank you again.
    – 0xLuckycig
    Commented Jul 23, 2023 at 4:31
  • Glad to help. Happy hacking!
    – Ademola
    Commented Jul 25, 2023 at 18:46
  • @0xLuckycig this answer solved your problem? If so, consider accepting it (gray check mark in the left of answer) and upvoting if you didn't this (a round button that contains up arrow) Commented Jul 28, 2023 at 6:29
  • @Petəíŕd Thank you for notice. I did it
    – 0xLuckycig
    Commented Jul 28, 2023 at 6:30

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.