BlockstreamResearch / secp256k1-zkp

A fork of libsecp256k1 with support for advanced and experimental features such as Confidential Assets and MuSig2
MIT License
372 stars 208 forks source link

bppp: redesign generators API #220

Open jonasnick opened 1 year ago

jonasnick commented 1 year ago

See discussion here.

jonasnick commented 1 year ago

The only two reasons I can come up with to have a secp256k1_bppp_generators object in the API are:

  1. Avoid hard coding too many generators in the source code. For single (unaggregated) rangeproofs, we need at most 71 generators, so I don't think this is a conern. We could easily hard code them and remove secp256k1_bppp_generators from the API.
  2. Allow using specific generators. We currently use this in testing to cross-test the rust and C implementation with diverging generator generation code. However, we could relatively easily hard code the same generators in the rust implementation. Another reason to use specific generators is that the rangeproof prover/verifier need to be aware of the "asset generator" and use it as one of the generators. But the asset generator is already an extra argument in the rangeproof API and does not require messing with secp256k1_bppp_generators.