Awesome
Minado๐: Zk Privacy Solution on Mina Protocol
What did we build? ๐ท๐ปโโ๏ธ๐
We build a Mixer Protocol in Mina, the high-level idea is to allow private transactions for Mina, which we believe is necessary for building a fully private and secure ecosystem.
Why a Mixer? ๐ค
As ZkBuilders we believe that the future should not be one where you lose control over your data. Also, we build this protocol recognizing that security and privacy should not be hard for the end-user. We envision a world where people can control their data in a smooth and low-effort way.
How does it work?๐๐ป๐ง๐ปโ๐ป
The protocol is divided into 3 parts:
-Deposit logic:
In the deposit, the following actions are executed.
-
A Minado account that will pay the gas fees is funded
-
A userAccount is funded to deposit into our minadoZkAppAccount..
- Note: In a real implementation this would not happen as the account already has a balance
-
A commitment needs to be created C(0) = H(S(0),N(0))
Note: S= Secret , N= Nullifier ( N(0) = Hash(PB(user),Random private key ))
3.1 A Secret is created using Poseidon ( Cryptography library in Snarky )
3.2 A Nullifier is created to avoid double spending
3.3 The Secret and the Nullifier are hashed and the commitment is created.
-
The commitment is added to the Leaf of the Merkle Tree.
-
A note which we can understand as a Zk-proof of the commitment is provided to the user to store it.
-
Funds are sent from the user account to the minadoZkAppAccount
-State management ( Merkle Tree) :The steps we followed are:
-
Create a Merkle Tree instance.
-
Wrap the Merkle Tree into an off-chain storage form
-
Set leaf with the Commitment Ex: C(0)
-
Get the root of the tree โ Initial commitmentโ Which would be used to verify the transaction โ
-Validation and Withdraw (Circuit)
-
The user provides the note.
-
With the note a Merkle tree Witness is generated based on the commitment index ( Which comes from the commitment provided)
-
With help of the witness the commitment is verified, without revealing it. The witness allows us to โreconstructโ the Merkle path getting to the root and validating that the commitment is part of the Merkle path
The future of our project ๐ฎ๐
We think this project is fundamental for creating a privacy and security ecosystem, also we are sure it could create more impact after this Hackathon. #The future steps that we will execute for this project are:
-
Integrate compatibility with Wallets: We want to focus first on delivering a secure, friendly, and high-quality product. We will integrate compatibility with Aura Wallet and then Chainsafe or Uniswap when the integration is ready, the goal is to increase adoption.
-
Upgrade from a Mixer to a Private Rollup: We want to build a privacy rollup that enables more builders to create ZkApps on top of our protocol, for example, Defi private protocols, including lending applications, staking applications, and an infinite number of possibilities.
-
Building bridges between Minado and other blockchains: We will start building bridges with other blockchains to increase volume and liquidity which will benefit other builders like us and will enhance network effects.
How to build? ๐ก
Our project is divided into 2 parts our Smart contract and our UI. You can find them in the following links:
UI: https://github.com/Sr-santi/mina-ui Smart Contract: https://github.com/Sr-santi/mina-eth-bogota-contract
For running the smart contract you need to: ๐
Clone the Repo
-cd Mina-smart-contract
-Run npm run build
-Run npm start to see the current implementation of our mixer.
For running the UI you need to: ๐
-Clone the Repo -cd mina-u -Run yarn -Run yarn dev. -Open http://localhost:3000/
Improvements ๐ง
-Validate merkle tree before inserting the commitment into it (Set merkle tree before adding a new leaf)
-Another withdraw proof needs to be approved to send the funds out.
-Marking sure you are setting a transition of the Merkle Tree.
-Calculate the roots of the Merkle Tree.
-We are not depositing into the contract.
-Using proof of authorization ( With balance )
-Create nullifier Tree and verify if the commitment is inside this Tree before withdrawing. ( To avoid double spending )
-Start exploting the rollup process.
## License
[Apache-2.0](LICENSE)