Module bulletproofs_gadgets::zero_nonzero[][src]

Functions

is_nonzero_gadget

Enforces that x is 0. Takes x and the inverse of x.

is_zero_gadget

if x == 0 then y = 0 else y = 1 if x != 0 then inv = x^-1 else inv = 0 x*(1-y) = 0 x*inv = y The idea is described in the Pinocchio paper and i first saw it in https://github.com/HarryR/ethsnarks/blob/master/src/gadgets/isnonzero.cpp Enforces that x is 0.