🚧#9 Circom: Public and Private Inputs

In Circom, signals are treated as private by default, unless otherwise declared.

template Add() {
	signal input a;
	signal input b;
	signal input c;
	
	c === a + b;
}

component main {public [a, b]} = Add();
  • a and b are declared as public signals

  • c remains a private signal

Remember, the verifier takes public inputs (signals) and the proof generated by the prover, and verifies them.

Private inputs will only be known by 2 parties, the user who provides them, and the prover. The verifier will not have access to the private inputs.

Private inputs are encrypted within the proof generated, thus the verifier is able to verify the proof without directly knowing the values of the private inputs.

signal output is a public signal

  • When you have a signal output at the top level of the circuit - It's a public input.

Last updated

Was this helpful?