7

I recently read about private transactions on Ethereum through zksnarks.

I have 2 questions. I think the answer to the first one is yes, but I would just like to get it confirmed.

1) Will zksnarks enable my transaction data to be private? For example, if I have a smart contract that takes in as input some private user data like their phone number I would like that information to not be publically viewable on the blockchain.

2) Are there any code examples available on what it would take to integrate zksnarks into your contract?

2
  1. Yes, but you can already do that. You can take a phone number add a salt and hash it to get a hidden phone number. But what you can do with zksnarks is prove that your phone number is in a list without revealing what your number is. https://www.youtube.com/watch?v=84Vbj7-i9CI is a nice example of how you can use zksnarks.

  2. https://github.com/barryWhiteHat/snarkWrapper shows how to prove a snark inside a contract.

2

IMHO, the best entry point on this topic in the context of Ethereum is this high-level overview blog post written by Consensys:

https://media.consensys.net/introduction-to-zksnarks-with-examples-3283b554fc3b

Moreover, as Ismael already mentioned, when you feel, you're comfortable with the topic, you could start digging deeper and look into ZoKrates -> https://github.com/JacobEberhardt/ZoKrates

UPDATE: It seems ZoKrates now has support for SHA256 -> https://zokrates.github.io/sha256example.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.