3

If we have a public key, how can we determine if it is a PDA? Especially in the case where we don't have any information about the source code programs related to the public key. Is it possible to check this on-chain?

1 Answer 1

4

Just found the solution.

Use is_on_curve method of PublicKey. It tries to decompress from the curve 25519 using bytes_are_curve_point, which is a requirement of program derived addresses.

1
  • 2
    while this is generally accurate, it should be noted that there is a legacy address derivation scheme (the so-called *WithSeed system instruction variants) that did not strictly force their outputs off-curve and may produce addresses on-or-off curve
    – trent.sol
    Jul 18, 2022 at 19:05

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.