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.

42 lines
1.1 KiB

  1. /*
  2. # withdraw.circom
  3. WARNING: WIP, very initial version of the miksi circuit
  4. +--------+
  5. PUB_coinCode+------->+ |
  6. | | +----+
  7. PUB_amount+--------->+Poseidon+------->+ == +<-----+PUB_commitment
  8. | | +----+
  9. PRI_secret+--------->+ |
  10. +--------+
  11. */
  12. include "../node_modules/circomlib/circuits/babyjub.circom";
  13. include "../node_modules/circomlib/circuits/comparators.circom";
  14. include "../node_modules/circomlib/circuits/poseidon.circom";
  15. include "../node_modules/circomlib/circuits/bitify.circom";
  16. include "../node_modules/circomlib/circuits/smt/smtverifier.circom";
  17. include "../node_modules/circomlib/circuits/smt/smtprocessor.circom";
  18. template Withdraw() {
  19. signal input coinCode;
  20. signal input amount;
  21. signal input commitment;
  22. signal private input secret;
  23. component hash = Poseidon(3, 6, 8, 57);
  24. hash.inputs[0] <== coinCode;
  25. hash.inputs[1] <== amount;
  26. hash.inputs[2] <== secret;
  27. component eq = IsEqual();
  28. eq.in[0] <== hash.out;
  29. eq.in[1] <== commitment;
  30. eq.out === 1;
  31. }
  32. component main = Withdraw();