Private Transactions on SUI at the SUI Overflow Hackathon
Introduction
Although blockchain wallets provide a form of pseudo-anonymity to their users, all transactions associated with a given address are publicly visible on the blockchain. This transparency poses a significant challenge to user privacy. Anyone can trace every transaction from a wallet, revealing the entire transaction history once the wallet is linked to an individual.
To address these privacy issues, we introduce Private Transactions on SUI, enabling confidential and anonymous transactions. By utilizing zero-knowledge proofs (zk-SNARKs), we ensure that transaction details, including the sender, receiver, and transaction amount, remain hidden from public view, providing a much-needed layer of confidentiality in the SUI ecosystem.
Target Audience
Private Transactions on SUI target several key user groups within the SUI ecosystem who highly value their financial privacy and wish to keep their transaction history confidential. These groups include:
- DeFi Enthusiasts and Traders
- High-Net-Worth Individuals
- Crypto Investors
- General Crypto Users
- Crypto Companies
- Organizations that handle payrolls via blockchain
How Does the Private Transactions on SUI Work?
Let’s suppose, User A wants to send a SUI token to User B using a private transaction. User A goes to the Private Transactions website and connects their wallet. When the wallet is connected, a private zkWallet is also generated from the private keys of User A.
Initializing a Commitment
User A manually initializes a commitment, which includes the zk-address of User A and the amount of SUI tokens to be deposited. For example, User A deposits 100 SUI. The commitment will be:
Shielding the SUI Token
The 100 SUI is then transferred to a common pool, and the commitment is added as a leaf node in a Merkle Tree. An event is emitted, containing encrypted information necessary for the receiver to spend the commitment.
Private Transfer of SUI Tokens
To privately transfer 10 SUI tokens from User A to User B, the commitment is split into C11 and C12 (Assuming the relayer takes 0 fees at this phase, whereas, in the future, it is a business opportunity for relayer operators).
The message is sent to the SUI Chain with the help of a relayer which includes the zkProof of the signature and the proof of proper formation of C11 & C12, ensuring the input value matches the sum of output values.
If the zkProof is verified, the nullifier of the commitment C1 is recorded in the blockchain to prevent double-spending. The new commitments C11 and C12 are then added to the Merkle Tree.
Unshielding the SUI Token
Suppose User B wants to unshield the 10 SUI tokens received from User A. User B submits zkProof of the signature and zkProof for unshielding. Along with zkProofs, SUI Address (public address) and the amount being unshielded are passed as public parameters.
In the chain, if the zkProof of unshielding and signature is verified and asserted (C111 === hash(SUI Address, amount)), then the SUI token is transferred from the pool to the User SUI wallet.
Few Key Terminologies
Event Emission:
An event emission contains information in an encrypted form necessary for the receiver to utilize the fund.
View Keys:
The symmetrically encrypted information can only be decrypted by the sender and the receiver using a shared secret key formed by certain operations on their own private viewing key and the public viewing key of another party.
Auditability/Compliance:
The private viewing key can be provided to law enforcement agencies or any other body if the account needs to be audited to prove there are no connections with known bad actors.
What’s Next for Private Transaction
- Support Fungible and Non-Fungible(NFT) tokens for private transfers
- Integrate private interaction with De-Fi apps and other third-party apps
- Use waku-like protocol for secure transaction processing via relayer
- Integrate PPOI(Private Proof of Innocence) mechanism to filter out bad actors
Conclusion
Participating in the SUI Overflow Hackathon allowed us to address a critical need for privacy in blockchain transactions. Through our project, Private Transactions on SUI, we demonstrated how zero-knowledge proofs (zk-SNARKs) can enable confidential and anonymous transactions, safeguarding user privacy.
We have successfully developed and tested our solution on Devnet, showcasing its potential to protect transaction details from public view. The hackathon experience provided valuable feedback and validated the importance of our work.
Moving forward, we are excited to further refine and implement Private Transactions on SUI, aiming to enhance user privacy and security on the SUI blockchain.
Thank you for your support, and stay tuned for more updates!