Schnorr signatures come with big potential but limited support in the Ethereum ecosystem. Here's a reminder of the advantages they have in a multisignature setup:
Nevertheless, they are not so popular and probably the main reason for this is the lack of hardware support and the difficult off-chain setup you need to handle them.
Here, I'll demonstrate how to enable and use these schnorr signatures as a Safe module. Here' the github repository
Here's a link to the solidity contract if you don't want to waste your time with words
If you're new to Safe, you have to know two things about it:
We're going to tap in its execTransactionFromModule
metod to execute transactions after the schnorr signature validation
This is the standard Schnorr signature verification, tapping into ecrecover
:
Mind you, this is not enough. This is generally good enough to verify schnorr signatures but there are a couple of things missing:
So we'll have to a few additional things in the module to assure all's good
When deploying the module, we'll set a few properties:
The signer is the schnorr EVM address with privileges to execute transactions from the safe.
And the safe address is… well, the safe address this module will be enabled for.
So in our example, each Safe will have to deploy his safe schnorr module.
And finally, the safe will have to enable it through enableModule
We construct the execute function that will allow this to flourish:
Let's point out the basics:
And that's it! What remains is the execution which we perform by calling safe.execTransactionFromModule
for all the calls in the commitment. All of this is a single transaction so remember, if one call is invalid, all the calls will revert
This is how you could implement Schnorr in a Safe. What can you use it for? Currently, mainly for a backup in case something happens to the original signers.
Be wary that enabling a module in a Safe bypasses the original multisig setup. So proceed only if you know what you're doing.