Skip to content
Discussion options

You must be logged in to vote

Hi,

you have access to the number of variables (public, secret, internal) and to the number of constraints through a compiled circuit like this:

type exp struct {
	X frontend.Variable
	Z frontend.Variable `gnark:",public"`
}

func (circuit *exp) Define(curveID ecc.ID, cs *frontend.ConstraintSystem) error {
	tmp := circuit.X
	for i := 0; i < 5; i++ {
		tmp = cs.Mul(tmp, circuit.X)
	}
	cs.AssertIsEqual(tmp, circuit.Z)
	return nil
}

func main() {

	var circuit exp
	ccircuit, err := frontend.Compile(ecc.BN254, backend.GROTH16, &circuit)
	if err != nil {
		fmt.Println(err)
		os.Exit(-1)
	}

	fmt.Printf("nb constraints: %d\n", ccircuit.GetNbConstraints())
	nbInternals, nbSecret, nbPublic := cc…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sshravan
Comment options

@spector-in-london
Comment options

@shreyas-londhe
Comment options

Answer selected by sshravan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants