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.

59 lines
2.2 KiB

  1. # miksi [![Test](https://github.com/miksi-labs/miksi-core/workflows/Test/badge.svg)](https://github.com/miksi-labs/miksi-core/actions?query=workflow%3ATest)
  2. *From Esperanto, **miksi** (miks·i): to mingle, to blend, to mix, to shuffle*
  3. ![](miksi-logo00-small.png)
  4. **Warning:** This repository is in a very early stage.
  5. WebApp to use miksi-core can be found at https://github.com/arnaucube/miksi-app
  6. ## Circuits tests
  7. ```
  8. npm run test-circuits
  9. ```
  10. ## Smart Contracts tests
  11. ```
  12. npm run test-sc
  13. ```
  14. ### Compile circom circuit & generate Groth16 verifier contract
  15. ```
  16. ./compile-circuits.sh
  17. ```
  18. ## Spec draft
  19. ### Deposit
  20. - user generates a random `secret` & `nullifier`
  21. - computes the `commitment`, which is the Poseidon hash: `commitment = H(coinCode, amount, secret, nullifier)`, where:
  22. - `coinCode`: code that specifies which currency is being used (`0`==ETH)
  23. - `amount`: the amount to be deposited
  24. - `secret`: random, private
  25. - `nullifier`: random
  26. - get all the commitments from the SmartContract
  27. - build the MerkleTree with the getted commitments
  28. - add the new computed `commitment` into the MerkleTree
  29. - generate zkSNARK proof, where is proving:
  30. - prover knows the `secret` & `nullifier` for the `commitment`
  31. - the transition from `RootOld` (the current one in the Smart Contract) to `RootNew` has been done following the rules (only one addition, no deletion)
  32. - user sends ETH to the smart contract `deposit` call, together with the zkProof data
  33. Deposit circuit can be found [here](https://github.com/miksi-labs/miksi-core/blob/master/circuits/deposit.circom).
  34. ### Withdraw
  35. - user gets all the commitments from the SmartContract
  36. - build the MerkleTree with the getted commitments
  37. - generate the siblings for the `commitment` of which the user knows the `secret` & `nullifier`
  38. - generate zkSNARK proof, where is proving:
  39. - user knows a `secret` for a public `nullifier`
  40. - which `commitment` is in the MerkleTree
  41. - which MerkleTree `root` is the one that knows the SmartContract
  42. - if the zkProof verification passes, and the nullifier was not already used, the Smart Contract sends the ETH to the specified address
  43. Withdraw circuit can be found [here](https://github.com/miksi-labs/miksi-core/blob/master/circuits/withdraw.circom).