set_v1.zk 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. k = 13;
  2. constant "Set_V1" {}
  3. witness "Set_V1" {
  4. // An instance of `Base` is a field element, where it is a member of
  5. // the finite field F_p where
  6. // p = 0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001
  7. //
  8. // Private input a user generates locally
  9. Base secret,
  10. // Whether to lock the name
  11. Base lock,
  12. // Whether to set in the canonical root name registry
  13. Base root,
  14. // The name
  15. Base key,
  16. // The value the name resolves to or
  17. // the next sub name registry which is also an account
  18. Base value,
  19. }
  20. circuit "Set_V1" {
  21. // Most statements are imperactive statements:
  22. // var = statement(var_or_witness1, var_or_witness2, ...);
  23. account = poseidon_hash(secret);
  24. // `constrain_instance` requires the value be provided as public input
  25. constrain_instance(account);
  26. constrain_instance(lock);
  27. constrain_instance(root);
  28. constrain_instance(key);
  29. constrain_instance(value);
  30. // Check whether `lock` and `root` are of {0, 1}
  31. bool_check(lock);
  32. bool_check(root);
  33. }