Documentation ¶
Overview ¶
Implementation of BulletProofs in Go
Index ¶
- Variables
- func CalculateL(aL, sL []*big.Int, z, x *big.Int) []*big.Int
- func CalculateLMRP(aL, sL []*big.Int, z, x *big.Int) []*big.Int
- func CalculateR(aR, sR, y, po2 []*big.Int, z, x *big.Int) []*big.Int
- func CalculateRMRP(aR, sR, y, zTimesTwo []*big.Int, z, x *big.Int) []*big.Int
- func Delta(y []*big.Int, z *big.Int) *big.Int
- func DeltaMRP(y []*big.Int, z *big.Int, m int) *big.Int
- func GenerateNewParams(G, H []ECPoint, x *big.Int, L, R, P ECPoint) ([]ECPoint, []ECPoint, ECPoint)
- func InnerProduct(a []*big.Int, b []*big.Int) *big.Int
- func InnerProductVerify(c *big.Int, P, U ECPoint, G, H []ECPoint, ipp InnerProdArg) bool
- func InnerProductVerifyFast(c *big.Int, P, U ECPoint, G, H []ECPoint, ipp InnerProdArg) bool
- func MRPVerify(mrp MultiRangeProof) bool
- func PadLeft(str, pad string, l int) string
- func PowerVector(l int, base *big.Int) []*big.Int
- func RPVerify(rp RangeProof) bool
- func RandVector(l int) []*big.Int
- func STRNot(str string) string
- func ScalarVectorMul(v []*big.Int, s *big.Int) []*big.Int
- func StrToBigIntArray(str string) []*big.Int
- func VectorAdd(v []*big.Int, w []*big.Int) []*big.Int
- func VectorAddScalar(v []*big.Int, s *big.Int) []*big.Int
- func VectorHadamard(v, w []*big.Int) []*big.Int
- func VectorSum(y []*big.Int) *big.Int
- type CryptoParams
- type ECPoint
- type InnerProdArg
- type MultiRangeProof
- type RangeProof
Constants ¶
This section is empty.
Variables ¶
var VecLength = 64
Functions ¶
func CalculateL ¶
Calculates (aL - z*1^n) + sL*x
func CalculateLMRP ¶
Calculates (aL - z*1^n) + sL*x
func GenerateNewParams ¶
func InnerProduct ¶
The length here always has to be a power of two
func InnerProductVerify ¶
Inner Product Verify
Given a inner product proof, verifies the correctness of the proof Since we're using the Fiat-Shamir transform, we need to verify all x hash computations, all g' and h' computations P : the Pedersen commitment we are verifying is a commitment to the innner product ipp : the proof
func InnerProductVerifyFast ¶
func MRPVerify ¶
func MRPVerify(mrp MultiRangeProof) bool
MultiRangeProof Verify Takes in a MultiRangeProof and verifies its correctness
func PadLeft ¶
from here: https://play.golang.org/p/zciRZvD0Gr with a fix
func RPVerify ¶
func RPVerify(rp RangeProof) bool
func RandVector ¶
func StrToBigIntArray ¶
Types ¶
type CryptoParams ¶
type CryptoParams struct { C elliptic.Curve // curve KC *btcec.KoblitzCurve // curve BPG []ECPoint // slice of gen 1 for BP BPH []ECPoint // slice of gen 2 for BP N *big.Int // scalar prime U ECPoint // a point that is a fixed group element with an unknown discrete-log relative to g,h V int // Vector length G ECPoint // G value for commitments of a single value H ECPoint // H value for commitments of a single value }
var EC CryptoParams
func NewECPrimeGroupKey ¶
func NewECPrimeGroupKey(n int) CryptoParams
NewECPrimeGroupKey returns the curve (field), Generator 1 x&y, Generator 2 x&y, order of the generators
func (CryptoParams) Zero ¶
func (c CryptoParams) Zero() ECPoint
type ECPoint ¶
type InnerProdArg ¶
InnerProd Proof This stores the argument values
func InnerProductProve ¶
func InnerProductProveSub ¶
func InnerProductProveSub(proof InnerProdArg, G, H []ECPoint, a []*big.Int, b []*big.Int, u ECPoint, P ECPoint) InnerProdArg
Inner Product Argument
Proves that <a,b>=c This is a building block for BulletProofs
type MultiRangeProof ¶
type MultiRangeProof struct { Comms []ECPoint A ECPoint S ECPoint T1 ECPoint T2 ECPoint Tau *big.Int Th *big.Int Mu *big.Int IPP InnerProdArg // challenges Cy *big.Int Cz *big.Int Cx *big.Int }
func MRPProve ¶
func MRPProve(values []*big.Int) MultiRangeProof
MultiRangeProof Prove Takes in a list of values and provides an aggregate range proof for all the values. changes:
all values are concatenated r(x) is computed differently tau_x calculation is different delta calculation is different
{(g, h \in G, \textbf{V} \in G^m ; \textbf{v, \gamma} \in Z_p^m) :
V_j = h^{\gamma_j}g^{v_j} \wedge v_j \in [0, 2^n - 1] \forall j \in [1, m]}
type RangeProof ¶
type RangeProof struct { Comm ECPoint A ECPoint S ECPoint T1 ECPoint T2 ECPoint Tau *big.Int Th *big.Int Mu *big.Int IPP InnerProdArg // challenges Cy *big.Int Cz *big.Int Cx *big.Int }
func RPProve ¶
func RPProve(v *big.Int) RangeProof
RPProver : Range Proof Prove Given a value v, provides a range proof that v is inside 0 to 2^64-1