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?

RagHaven
  • 245
  • 1
  • 8
  • 1
    You can take a look at ZoKrates. – Ismael Jan 22 '18 at 05:04
  • Related: https://ethereum.stackexchange.com/questions/1129/what-data-will-zk-snarks-protect and https://ethereum.stackexchange.com/questions/12631/is-there-any-way-to-hide-a-transaction – eth Sep 24 '18 at 05:34

2 Answers2

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

ivicaa
  • 7,519
  • 1
  • 20
  • 50
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.

user34374
  • 31
  • 1