Open ronanyeah opened 2 years ago
I'm hoping to achieve something like this:
fn verify(message: &[u8; 32], sig_bytes: &[u8; 64], signer: &Pubkey) -> bool {
let signature = Signature::new(sig_bytes);
let keypair = Signer::new(signer.to_bytes());
let result = keypair.verify(message, &signature);
result.is_ok()
}
@ronanyeah you should be able to achieve this with the ed25519 program https://docs.solana.com/developing/runtime-facilities/programs#ed25519-program
CPI to that program within yours and you're good
Thanks! I'm currently porting this file from Transaction::new_signed_with_payer
to use CPI, invoke(...)
etc.
Apparently this program doesn't work for CPI for GPU reasons: Program failed to complete: Program Ed25519SigVerify111111111111111111111111111 not supported by inner instructions
https://github.com/solana-labs/solana/issues/19843
Apparently the correct approach is to verify the signature in a separate instruction, then walk through the instructions in your program code using Sysvar1nstructions1111111111111111111111111
to confirm the signature value.
I want to verify multiple signature in solana smart contract how can i do this . i am able to verify signle signature in smart contract . but how can i verify multiple signature
I am trying to figure out if signature verification is possible onchain. If it is I will create an example for the cookbook.
I have tried to implement it with various ed25519 rust crates but keep running out of CPU:![Screenshot from 2022-01-17 22-31-46](https://user-images.githubusercontent.com/9598261/149871495-db352181-dbe4-4418-8195-4f71dc844c9a.png)
I think this file is relevant, but relates to the SDK (which is offchain only): https://github.com/solana-labs/solana/blob/master/sdk/src/ed25519_instruction.rs