20template <
typename Curve_>
class KZG {
39 template <
typename Transcript>
42 const std::shared_ptr<Transcript>& prover_trancript)
50 quotient_commitment = Commitment::infinity();
52 quotient.
at(0) = quotient[0] - pair.evaluation;
55 quotient_commitment =
ck.commit(quotient);
61 prover_trancript->send_to_verifier(
"KZG:W", quotient_commitment);
74 template <
typename Transcript>
76 const std::shared_ptr<Transcript>& verifier_transcript)
78 auto quotient_commitment = verifier_transcript->template receive_from_prover<Commitment>(
"KZG:W");
86 auto builder = quotient_commitment.get_context();
92 P_0 = GroupElement::batch_mul(commitments, scalars);
96 P_0 += quotient_commitment * claim.
opening_pair.challenge;
97 P_0 -= GroupElement::one() * claim.
opening_pair.evaluation;
100 auto P_1 = -quotient_commitment;
121 template <
typename Transcript>
123 const std::shared_ptr<Transcript>& transcript)
125 auto quotient_commitment = transcript->template receive_from_prover<Commitment>(
"KZG:W");
131 batch_opening_claim.
commitments.emplace_back(quotient_commitment);
136 P_0 = GroupElement::batch_mul(batch_opening_claim.
commitments,
143 auto P_1 = -quotient_commitment;
CommitmentKey object over a pairing group 𝔾₁.
typename Curve::AffineElement Commitment
typename Curve::Element GroupElement
std::array< GroupElement, 2 > VerifierAccumulator
static VerifierAccumulator reduce_verify_batch_opening_claim(BatchOpeningClaim< Curve > batch_opening_claim, const std::shared_ptr< Transcript > &transcript)
Computes the input points for the pairing check needed to verify a KZG opening claim obtained from a ...
static VerifierAccumulator reduce_verify(const OpeningClaim< Curve > &claim, const std::shared_ptr< Transcript > &verifier_transcript)
Computes the input points for the pairing check needed to verify a KZG opening claim of a single poly...
typename Curve::ScalarField Fr
static void compute_opening_proof(const CK &ck, const ProverOpeningClaim< Curve > &opening_claim, const std::shared_ptr< Transcript > &prover_trancript)
Computes the KZG commitment to an opening proof polynomial at a single evaluation point.
Unverified claim (C,r,v) for some witness polynomial p(X) such that.
OpeningPair< Curve > opening_pair
Opening pair (r,v) for some witness polynomial p(X) such that p(r) = v.
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
Fr & at(size_t index)
Our mutable accessor, unlike operator[]. We abuse precedent a bit to differentiate at() and operator[...
void factor_roots(const Fr &root)
Divides p(X) by (X-r) in-place. Assumes that p(rⱼ)=0 for all j.
Polynomial p and an opening pair (r,v) such that p(r) = v.
OpeningPair< Curve > opening_pair
typename Group::element Element
static constexpr bool is_stdlib_type
typename Group::affine_element AffineElement
Entry point for Barretenberg command-line interface.
CommitmentKey< Curve > ck
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
An accumulator consisting of the Shplonk evaluation challenge and vectors of commitments and scalars.
Curve::ScalarField evaluation_point
std::vector< typename Curve::AffineElement > commitments
std::vector< typename Curve::ScalarField > scalars