witness

package module
v0.0.0-...-5b7d914 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

README

go-rapidsnark witness calculator

Calculates witness, that can be passed to a prover (snarkjs, go-rapidsnark/prover or rapidsnark) to generate a zero-knowledge proof.

Installation

go get github.com/iden3/go-rapidsnark/witness

Dependencies

This package depends on wasmer shared library, which needs to be copied from wasmer-go module source code. E.g. to run compiled project on Alpine linux you would need to copy /go/pkg/mod/github.com/wasmerio/wasmer-go@v1.0.4/wasmer/packaged/lib/linux-amd64/libwasmer.so from the build host/container.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseInputs

func ParseInputs(inputsJSON []byte) (map[string]interface{}, error)

ParseInputs parses WitnessCalc inputs from JSON that consist of a map of types which contain a recursive combination of: numbers, base-10 encoded numbers in string format, arrays.

Types

type Circom2WitnessCalculator

type Circom2WitnessCalculator struct {
	// contains filtered or unexported fields
}

Circom2WitnessCalculator is the object that allows performing witness calculation from signal inputs using the WitnessCalc WASM module.

func NewCircom2WitnessCalculator

func NewCircom2WitnessCalculator(wasmBytes []byte, sanityCheck bool) (*Circom2WitnessCalculator, error)

NewCircom2WitnessCalculator creates a new WitnessCalculator from the WitnessCalc loaded WASM module in the runtime.

func (*Circom2WitnessCalculator) CalculateBinWitness

func (wc *Circom2WitnessCalculator) CalculateBinWitness(inputs map[string]interface{}, sanityCheck bool) ([]byte, error)

CalculateBinWitness calculates the witness in binary given the inputs.

func (*Circom2WitnessCalculator) CalculateWTNSBin

func (wc *Circom2WitnessCalculator) CalculateWTNSBin(inputs map[string]interface{}, sanityCheck bool) ([]byte, error)

CalculateWTNSBin calculates the witness in binary given the inputs.

func (*Circom2WitnessCalculator) CalculateWitness

func (wc *Circom2WitnessCalculator) CalculateWitness(inputs map[string]interface{}, sanityCheck bool) ([]*big.Int, error)

CalculateWitness calculates the witness given the inputs.

Jump to

Keyboard shortcuts

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