Struct tari_bulletproofs::r1cs::R1CSProof
source · pub struct R1CSProof { /* private fields */ }
Expand description
A proof of some statement specified by a
ConstraintSystem
.
Statements are specified by writing gadget functions which add
constraints to a ConstraintSystem
implementation. To construct an R1CSProof
, a prover constructs
a ProverCS
, then passes it to gadget
functions to build the constraint system, then consumes the
constraint system using
ProverCS::prove
to produce an
R1CSProof
. To verify an R1CSProof
, a verifier constructs a
VerifierCS
, then passes it to the same
gadget functions to (re)build the constraint system, then consumes
the constraint system using
VerifierCS::verify
to verify the
proof.
Implementations§
source§impl R1CSProof
impl R1CSProof
sourcepub fn to_bytes(&self) -> Vec<u8>
pub fn to_bytes(&self) -> Vec<u8>
Serializes the proof into a byte array of 1 version byte + \((13 or 16) + 2k\) 32-byte elements, where \(k=\lceil \log_2(n) \rceil\) and \(n\) is the number of multiplication gates.
Layout
The layout of the r1cs proof encoding is:
- 1 version byte indicating whether the proof contains second-phase commitments or not,
- 8 or 11 compressed Ristretto points \(A_{I1},A_{O1},S_1,(A_{I2},A_{O2},S_2),T_1,…,T_6\) (\(A_{I2},A_{O2},S_2\) are skipped if there were no multipliers added in the randomized phase),
- three scalars \(t_x, \tilde{t}_x, \tilde{e}\),
- \(k\) pairs of compressed Ristretto points \(L_0,R_0\dots,L_{k-1},R_{k-1}\),
- two scalars \(a, b\).
sourcepub fn serialized_size(&self) -> usize
pub fn serialized_size(&self) -> usize
Returns the size in bytes required to serialize the R1CSProof
.