I have a question about verifying multiple signatures in a Solana smart contract. Let's say I have a 'hello' message that has been signed by multiple key pairs using nacl.sign.detached with the Solana ed25519 program. How can I verify both the message and the multiple signatures within the Solana smart contract? also i have explored ho to do it signle signer i want to know how can do it multiple signer
1 Answer
I'm not sure I entirely understand the question, but if you are using Anchor, you can add Signer
s to your Accounts Context:
#[derive(Accounts)]
pub struct Initialize<'info> {
#[account(init, payer = payer, space = 8 + 8)]
pub data_account: Account<'info, MyData>,
#[account(mut)]
pub payer: Signer<'info>,
pub co_signer: Signer<'info>,
pub system_program: Program<'info, System>,
}
In this example, your co_signer
will be required to sign the transaction. You would probably want some other constraint in your context to define which or instruction to define which signer's are allowed.