backend

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type R1CS

type R1CS struct {
	// Wires
	NbWires       int
	NbPublicWires int // includes ONE wire
	NbSecretWires int
	SecretWires   []string // private wire names, correctly ordered (the i-th entry is the name of the (offset+)i-th wire)
	PublicWires   []string // public wire names, correctly ordered (the i-th entry is the name of the (offset+)i-th wire)
	Logs          []backend.LogEntry
	DebugInfo     []backend.LogEntry

	// Constraints
	NbConstraints   int // total number of constraints
	NbCOConstraints int // number of constraints that need to be solved, the first of the Constraints slice
	Constraints     []r1c.R1C
	Coefficients    []fr.Element // R1C coefficients indexes point here
}

R1CS decsribes a set of R1CS constraint

func (*R1CS) AddTerm

func (r1cs *R1CS) AddTerm(res *fr.Element, t r1c.Term, value fr.Element) *fr.Element

AddTerm returns res += (value * term.Coefficient)

func (*R1CS) GetCurveID

func (r1cs *R1CS) GetCurveID() gurvy.ID

GetCurveID returns the curveID of this R1CS

func (*R1CS) GetNbCoefficients

func (r1cs *R1CS) GetNbCoefficients() int

GetNbCoefficients return the number of unique coefficients needed in the R1CS

func (*R1CS) GetNbConstraints

func (r1cs *R1CS) GetNbConstraints() int

GetNbConstraints returns the number of constraints

func (*R1CS) GetNbWires

func (r1cs *R1CS) GetNbWires() int

GetNbWires returns the number of wires

func (*R1CS) IsSolved

func (r1cs *R1CS) IsSolved(assignment map[string]interface{}) error

IsSolved returns nil if given assignment solves the R1CS and error otherwise this method wraps r1cs.Solve() and allocates r1cs.Solve() inputs

func (*R1CS) Solve

func (r1cs *R1CS) Solve(assignment map[string]interface{}, a, b, c, wireValues []fr.Element) error

Solve sets all the wires and returns the a, b, c vectors. the r1cs system should have been compiled before. The entries in a, b, c are in Montgomery form. assignment: map[string]value: contains the input variables a, b, c vectors: ab-c = hz wireValues = [intermediateVariables | privateInputs | publicInputs]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL