merkleswap

package
v0.0.0-...-e663500 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const KeyPathPrefix = "merkleswap"

KeyPathPrefix denotes the file name for Merkle MultiSwap circuits

View Source
const TreeDepth = 28

TreeDepth denotes the depth of Merkle in the test circuit.

Variables

This section is empty.

Functions

func LoadVerifyingKey

func LoadVerifyingKey(filepath string) (verifyingKey groth16.VerifyingKey, err error)

LoadVerifyingKey load the verification key from the filepath

func Prove

func Prove(testSetSize uint32) (*groth16.Proof, error)

Prove is used to generate a Groth16 proof and public witness for the zkMultiSwap

func SetupZkMultiswap

func SetupZkMultiswap(size uint32)

SetupZkMultiswap generates the circuit and public/verification keys with Groth16 "keyPathPrefix".pk* are for public keys, "keyPathPrefix".ccs* are for r1cs, "keyPathPrefix".vk,save is for verification keys

func TestMerkleMultiSwap

func TestMerkleMultiSwap(testSetSize uint32)

TestMerkleMultiSwap is temporarily used for test purpose

func Verify

func Verify(proof *groth16.Proof, setsize uint32) bool

Verify is used to check a Groth16 proof and public witness for the zkMultiSwap

Types

type Circuit

type Circuit struct {
	// default uses variable name and secret visibility.
	TestInputs []frontend.Variable `gnark:",public"` // test values
	//------------------------------private witness below--------------------------------------
	TestOutputs []frontend.Variable // test values
}

Circuit is the Merkle tree-based MultiSwap circuit for gnark. gnark is a zk-SNARK library written in Go. Circuits are regular structs. The inputs must be of type frontend.Variable and make up the witness. The Circuit is only used for test purpose to measure the overhead of MerkleSwap

func AssignCircuit

func AssignCircuit(size uint32) *Circuit

AssignCircuit assign a circuit with UpdateSet32 values.

func InitCircuitWithSize

func InitCircuitWithSize(size uint32) *Circuit

InitCircuitWithSize init a circuit with challenges, OriginalHashes and CurrentEpochNum value 1, all other values 0. Use for test purpose only.

func (Circuit) Define

func (circuit Circuit) Define(api frontend.API) error

Define declares the circuit constraints

Jump to

Keyboard shortcuts

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