3

I am developing a Bridge from EVM to Solana and backwards. The EVM flow is following: User wants to make a deposit, the back-end signer builds transaction parameters and signs them offchain. After this, user makes transaction with the same parameters and server's signature so the Smart Contract can verify everything was constructed properly and verifies server's Ed25519 signature inside.

I was trying to implement the same flow in Solana Program for bridging, but it turns out that it's very tricky to verify Ed25519 signature in Solana program (I found the example, but custom flow failed)

And it just came to my mind, that in Solana you can have multiple signers for one transaction. And it sounds to me like the same thing as long as all arguments are determined by back-end anyways. Am I right? I am using Anchor and I only need to specify two signer in the accounts struct? One for the user, and another for server, which won't be used in logic at all?

1 Answer 1

4

Yep typically the way you'd do this in Solana is with multiple signers. Have the backend create a transaction and sign it, and send it to the user. They sign it and then send it to the network.

Then have some program as part of the transaction that has an account with the #[account(address=SERVER_ADDRESS)] constraint to make sure that your server's address is used.

Here's a playground example: https://beta.solpg.io/66b37272cffcf4b13384d2aa

If I use any address other than the hardcoded one as server_signer then the transaction will fail.

2

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.