merkle

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 2 Imported by: 9

Documentation

Overview

Package merkle provides a ZKP-circuit function to verify merkle proofs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateProofHelper

func GenerateProofHelper(proofSet [][]byte, proofIndex, numLeaves uint64) []int

GenerateProofHelper generates an array of 1 or 0 telling if during the proof verification the hash to compute is h(sum, proof[i]) or h(proof[i], sum). The size of the resulting slice is len(proofSet)-1. cf gitlab.com/NebulousLabs/merkletree for the algorithm

func VerifyProof

func VerifyProof(api frontend.API, h mimc.MiMC, merkleRoot frontend.Variable, proofSet, helper []frontend.Variable)

VerifyProof takes a Merkle root, a proofSet, and a proofIndex and returns true if the first element of the proof set is a leaf of data in the Merkle root. False is returned if the proof set or Merkle root is nil, and if 'numLeaves' equals 0.

Types

This section is empty.

Jump to

Keyboard shortcuts

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