1

I calculated the PDA of an account using the public key of my local wallet, then I initialized it on-chain (using the canonical bump). One of my tests tries deleting the account, which works, but then I need to initialize this same PDA again to try other functionalities.

I'm getting an error when trying to initialize the same PDA again:

Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

So I have some questions:

  1. Considering that I deleted the account using #[account(close = signer)], can I use the same PDA again or is this PDA forbidden from being used?
  2. Would I need to recalculate the PDA to use a new bump, or can I use the same PDA?

1 Answer 1

2
  1. Yes, you can reuse the same PDA after deleting the associated account using #[account(close = signer)].
  2. It's generally considered a best practice to recalculate the bump seed using getProgramDerivedAddress before each initialisation attempt.

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.