I am trying to implement EdDSA verification using solidity as all my contracts are written in solidity.I wanted to upgrade it to use EdDSA algorithm, but I found no packages that support it that are production ready.I found Geth-snarks implementation that requires points on the curve as input.I wanted a implementation that takes in a compressed public key and {R,s} to verify the signature.
4 Answers
Here are some reference, you can check below:
-
This should be the accepted answer - OP was looking for EdDSA, not ECDSA Commented Feb 9, 2023 at 7:08
This is an implementation of EDDSA signature verification with sha512 digest (based on this RFC).
https://github.com/rdubois-crypto/FreshCryptoLib/blob/master/solidity/src/FCL_eddsa.sol
I recently have open-sourced the library for message verification on Farcaster, you can use Ed25519.sol from there.
https://github.com/pavlovdog/farcaster-solidity/blob/main/contracts/Test.sol#L58
bool valid = Ed25519.verify(
public_key,
signature_r,
signature_s,
message_hash
);
Verification currently takes about 1m gas, which can be reduced by using ZK proofs.
Openzepplin has a library that supports ECDSA operations here https://docs.openzeppelin.com/contracts/2.x/api/cryptography