rust-secp256k1-zkp icon indicating copy to clipboard operation
rust-secp256k1-zkp copied to clipboard

Add Bindings for Schnorr Adaptor Signatures

Open siv2r opened this issue 7 months ago • 1 comments

This PR introduces Rust bindings for the Schnorr adaptor signature functionality added in: https://github.com/BlockstreamResearch/secp256k1-zkp/pull/299. The secp256k1-zkp PR is pending review from the maintainers, but I don’t expect the user-facing APIs to change much. Hence, I’m opening the bindings PR here.

Changes:

  • Provides FFI interfaces to the corresponding libsecp256k1-zkp functions:
    • secp256k1_schnorr_adaptor_presign
    • secp256k1_schnorr_adaptor_extract
    • secp256k1_schnorr_adaptor_adapt
    • secp256k1_schnorr_adaptor_extract_sec
  • Introduces a dedicated module for adaptor signature bindings:
    • adds the zkp::schnorr_adaptor::SchnorrAdaptorPreSignature wrapper type.
    • Implements methods to:
      • Create pre-signatures with presign.
      • Extract the adaptor point via extract_adaptor.
      • Adapt a pre-signature to a valid Schnorr signature using adapt.
      • Extract the secret adaptor through extract_secadaptor.
    • Includes a correctness test to ensure proper functionality.

Note: The overall diff might appear large because the first commit (528f610) updates the secp256k1-zkp-sys vendor with the Schnorr adaptor module (since those changes haven’t been merged upstream yet). The code changes relevant to the bindings are in commits 2 and 3.

siv2r avatar Apr 06 '25 14:04 siv2r

Nice, thanks!! I reviewed the code, though I don't think we should merge it until upstream merges theirs and we can vendor it from the main repo.

apoelstra avatar Apr 08 '25 12:04 apoelstra