17 if (context.signing_key != roster.signing_key()) {
24 const std::array<unsigned char, 33>& key,
const FieldElement& weighted_challenge,
26 const auto negative_weight = weighted_challenge.negate().to_bytes_be();
27 std::array<unsigned char, 33> key_term{};
28 if (
purify_point_scale(secp_context, key.data(), negative_weight.data(), key_term.data()) == 0) {
31 const auto scalar = response.serialize();
32 std::array<unsigned char, 33> nonce{};
42 if ((partial.nonce[0] != 0x02 && partial.nonce[0] != 0x03) ||
47 partial.response, secp_context),
48 "accountable:partial_nonce");
49 if (nonce != partial.nonce) {
59 const ConflictContext& context, std::span<const unsigned char> canonical_body,
61 if (member_index >= roster.
members().size()) {
65 "accountable:partial_challenge");
66 return check_partial(roster.
members()[member_index], challenge, partial, secp_context);
71 std::span<const unsigned char> canonical_body,
76 if (partials.size() != roster.
members().size()) {
80 "accountable:aggregate_challenge");
82 for (std::size_t i = 0; i < partials.size(); ++i) {
84 "accountable:aggregate_partial");
88 "accountable:aggregate_response");
89 std::array<unsigned char, 33> key{};
95 "accountable:aggregate_nonce");
int purify_point_scale(purify_secp_context *context, const unsigned char point33[33], const unsigned char scalar32[32], unsigned char out33[33])
int purify_bppp_offset_commitment(purify_secp_context *context, const unsigned char commitment33[33], const unsigned char scalar32[32], unsigned char commitment_out33[33])
C ABI bridging Purify C++ code to secp256k1-zkp BPPP functionality.
static FieldElement from_bytes32(const std::array< unsigned char, 32 > &bytes)
Decodes a 32-byte big-endian field element.
static FieldElement from_u64(std::uint64_t value)
Constructs a field element from an unsigned 64-bit integer.
Canonical 32-byte scalar response; carries no nonce or proof.
static Result< ScalarSignature > deserialize(std::span< const unsigned char > bytes)
Parse exactly 32 big-endian bytes below the group order, including zero.
Experimental public key aggregation for one ordered coalition roster.
std::span< const SigningRosterMember > members() const
Members in their original order; effective weights include parity.
const std::array< unsigned char, 32 > & signing_key() const
Canonical even-Y aggregate signing key for ConflictContext.
#define PURIFY_RETURN_IF_ERROR(expr, context)
Evaluates an expected-like expression and returns the wrapped error on failure.
#define PURIFY_ASSIGN_OR_RETURN(lhs, expr, context)
Evaluates an expected-like expression, binds the value to lhs, and propagates errors.
Status verify_partial_response(const SigningRoster &roster, std::size_t member_index, const ConflictContext &context, std::span< const unsigned char > canonical_body, const PartialResponse &partial, purify_secp_context *secp_context)
Check sigma_i*G = R_i + e*b_i*P_i for one ordered roster member.
Result< FieldElement > signature_challenge(const ConflictContext &context, std::span< const unsigned char > canonical_body, purify_secp_context *secp_context)
Compute the versioned Q/U/T/body challenge, without a nonce point.
Result< ScalarSignature > aggregate_responses(const SigningRoster &roster, const ConflictContext &context, std::span< const unsigned char > canonical_body, std::span< const PartialResponse > partials, purify_secp_context *secp_context)
Check all ordered partial equations and sum their scalar responses.
constexpr Unexpected< Error > unexpected_error(ErrorCode code, const char *context=nullptr)
Constructs an unexpected Error value from a machine-readable code.
Expected< T, Error > Result
Expected-returning convenience alias for Purify value-producing APIs.
Expected< void, Error > Status
Expected-returning convenience alias for Purify status-only APIs.
int purify_bip340_validate_xonly_pubkey(purify_secp_context *context, const unsigned char xonly_pubkey32[32])
Returns nonzero when the x-only public key encoding parses successfully.
struct purify_secp_context purify_secp_context
Caller-owned reusable secp256k1 context handle shared across Purify C and C++ APIs.
Public context shared by conflicting statements in one slashable slot.
Public session contribution; the raw full nonce is not normalized.
An ordered individual signing key and its normalized public weight.