How to verify offchain signed message inside onchain program

How to verify offchain signed message inside onchain program

Manage alerts

Loading saved threads...

hammad ali · External communityPost link
External question — Solana Stack Exchange Author: hammad ali Original post: https://solana.stackexchange.com/questions/16765 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I want to implement verfying signature same as ethereum in solana ethereum guide ( https://solidity-by-example.org/signature/ )
Quote
Report
Jimii · External communityPost link
External answer — Solana Stack Exchange Author: Jimii Original post: https://solana.stackexchange.com/a/16766 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Ethereum uses the Secp256k1 signing algorithm. Solana provides said algorithm and also ED25519 programs as pre-compiles. You can call them onchain but it would use up too many CUs Including as a top-level instruction in your transaction is the best option, https://github.com/anza-xyz/agave/blob/8f9fc2ada2396fc1e41a7393e9ac8714635d3107/sdk/src/secp256k1_instruction.rs#L1215-L1247 Previous answers to this, with the Ed25519 https://solana.stackexchange.com/a/13901/1708 https://solana.stackexchange.com/a/16605/1708
Quote
Report
Gopinath Shanmugavadivel · External communityPost link
External answer — Solana Stack Exchange Author: Gopinath Shanmugavadivel Original post: https://solana.stackexchange.com/a/23126 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Check this https://github.com/zfedoran/brine-ed25519 . Find this in https://crates.io/crates/brine-ed25519 . works in SVM. Here I provide sample signature verification flow. use brine_ed25519::sig_verify; let pubkey: [u8; 32] = [...]; let sig: [u8; 64] = [...]; let message = b"hello world"; sig_verify(&pubkey, &sig, message)?;
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Solana Stack Exchange Author: Jimii Source score (net votes, not local likes): 0 Original post: https://solana.stackexchange.com/a/16766 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Ethereum uses the Secp256k1 signing algorithm. Solana provides said algorithm and also ED25519 programs as pre-compiles. You can call them onchain but it would use up too many CUs Including as a top-level instruction in your transaction is the best option, https://github.com/anza-xyz/agave/blob/8f9fc2ada2396fc1e41a7393e9ac8714635d3107/sdk/src/secp256k1_instruction.rs#L1215-L1247 Previous answers to this, with the Ed25519 https://solana.stackexchange.com/a/13901/1708 https://solana.stackexchange.com/a/16605/1708

Cancel quote

Checking account access…