1

If I am using the Native Ed25519 Program to verify a message signature, I will need to add the pre instruction that will contain signature, message and public key to verify. In my custom program, I will be checking if this instruction existed in the instruction list and verify the message integrity. However if I want to prevent the replay of this signature, I need some nonce in the signature that will make the message unique and invalid after first usage.

As I understand if we want to implement this, it would mean creating and maintaining an account by paying minimum rent. This PDA account will store the unused nonces of a user or a last used nonce or the next usable nonce or any such information can be used to check the uniqueness of a signature. However if I need to verify signatures of several users, I will have to create the accounts for all of them.

Is this the only way I can protect agains signature replay? Are there any better ways of doing this?

If my transaction is a durable nonce instruction can I access the block-hash that was used somehow and implement replay protection? Note that, I may not be able to use latest block-hash as the signature to be verified might be generated ahead of time. However durable nonce's block-hash can be used at it will be same until consumed.

1
  • If you want to prevent replay, then your program will need to store some state somewhere. You could do it per-user or globally.
    – Jon C
    Commented Nov 22 at 21:38

0

Your Answer

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

Browse other questions tagged or ask your own question.