2

I need specifically to verify if a PDA exist inside a program without passing it as an account in the instruction. The solution I'm looking for is something like this. Thank you!

    let (pubkey_pda,__bump) = Pubkey::find_program_address(&[ctx.accounts.signer.key().as_ref()], ctx.program_id);

    if pubkey_pda.exist() {
        /// do something
    } else {
        /// create pda
    }

1 Answer 1

4

No you can’t. Solana accounts has to be passed in to read any of the data.

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.