You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
688 B

  1. include "../node_modules/circomlib/circuits/comparators.circom";
  2. /*
  3. Circuit to check that prover knows a private inputs x & y,
  4. such as x**a - y**b = 0, where a & b are known parameters.
  5. */
  6. template Equation(a, b) {
  7. signal private input x;
  8. signal private input y;
  9. signal aArray[a];
  10. signal bArray[b];
  11. for (var i=0; i<a; i++) {
  12. if (i==0) {
  13. aArray[0] <== x;
  14. } else {
  15. aArray[i] <== x * aArray[i-1];
  16. }
  17. }
  18. for(var i=0; i<b; i++) {
  19. if (i==0) {
  20. bArray[0] <== y;
  21. } else {
  22. bArray[i] <== y * bArray[i-1];
  23. }
  24. }
  25. component checkEq = IsEqual();
  26. checkEq.in[0] <== aArray[a-1];
  27. checkEq.in[1] <== bArray[b-1];
  28. checkEq.out === 1;
  29. }
  30. component main = Equation(4, 8);