privacy-scaling-explorations / zk-kit.noir

A monorepo of reusable Noir circuits.
MIT License
7 stars 1 forks source link

feat: ecdsa on BabyJubJub #17

Closed YashBit closed 2 weeks ago

YashBit commented 3 weeks ago

Implement ECDSA Signature Generation and Verification in Noir

Overview

This PR introduces a comprehensive ECDSA (Elliptic Curve Digital Signature Algorithm) implementation in Noir, utilizing the Baby JubJub curve. The implementation includes functions for signature generation, verification, and related utility operations.

Key Features

Function Definitions

calculate_signature

Generates an ESDSA signature for a given message using a private key and random nonce.

verify_signature

Verifies an ECDSA signature against a given message hash and public key.

mod_inv

Computes the modular inverse of a field element with respect to a given modulus.

field_from_bytes

Converts a byte array to a field element, supporting both big-endian and little-endian formats.

derive_public_key

Computes a public key from a private key using the Baby JubJub curve.

derive_public_key_optimized

Provides an optimized version of public key derivation using pre-computed curve parameters.

Usage

This implementation can be used for secure digital signature generation and verification in Noir projects. It's particularly useful for blockchain and cryptographic applications requiring ECDSA functionality.

Notes

Future Improvements

YashBit commented 2 weeks ago

@signorecello

I am still working on the integration test, but the code for ECDSA is complete. Compiles without any errors. Please can you comment on the logic, etc?

signorecello commented 2 weeks ago

Closing this PR as we have significant evidence of you asking community members to do the remaining work on your behalf.

YashBit commented 2 weeks ago

@signorecello

Hi,

Implementing ECDSA was not a part of the work for the grant that I received. So I have not asked people to complete work that is "on my behalf", but I wanted to collaborate further with the community and add value.

Moreover, I merely asked you to comment on the logic. Hence, I believe closing this PR signals poor judgement.