This is an alternative to #588 as requested by @real-or-random which I also slightly prefer (EDIT: this seems to be generally preferred now). The main difference is that the sign-to-contract commitment step happens in the signature function and not the nonce function. Also the nonce_is_negated
argument in schnorrsig_sign
is replaced by an s2c_opening
object. A new argument to schnorrsig_sign
is added called s2c_data
. There’s no need to add a context argument to nonce functions. I also added parsing and serialization for s2c_opening
s. Manual initialization of s2c_opening
is not necessary anymore.
Example:
0/* Signer */
1secp256k1_s2c_opening opening;
2unsigned char s2c_data[32];
3secp256k1_schnorrsig_sign(sign, &sig, &opening, msg, sk1, &s2c_data, NULL, NULL);
4
5/* Verifier */
6secp256k1_schnorrsig_verify_s2c_commit(ctx, &sig, s2c_data, &opening);