backend

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 10 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       uint64
	NbPublicWires uint64 // includes ONE wire
	NbSecretWires uint64
	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   uint64 // total number of constraints
	NbCOConstraints uint64 // 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 curve ID as defined in gurvy (gurvy.BLS381)

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() uint64

GetNbConstraints returns the total number of constraints

func (*R1CS) GetNbWires

func (r1cs *R1CS) GetNbWires() uint64

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) ReadFrom added in v0.3.6

func (r1cs *R1CS) ReadFrom(r io.Reader) (int64, error)

ReadFrom attempts to decode R1CS from io.Reader using cbor

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]

func (*R1CS) WriteTo added in v0.3.6

func (r1cs *R1CS) WriteTo(w io.Writer) (int64, error)

WriteTo encodes R1CS into provided io.Writer using cbor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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