# Would be possible to hide a function execution with zkSNARKs?

I read that with an hypothetical integration of zCash/zkSNARK with Ethereum, it would be possible to hide the sender, the receiver and the value of a transaction.

My question is if would also be possible to hide other data sent in a transaction, like the name of the function that you want to execute and the parameters of it. And in that case, how that would affect the state of the contract.

• – eth
Sep 24, 2018 at 5:37

zkSNARKs prove, in zero-knowledge, that a certain argument is true.

Zero-knowledge here means that it leaks nothing about the argument except whether or not it is true. An example -- if you picked a card from a deck, and I asked you if it was a heart, you could show me this is true without leaking any other info about the card (like if it's an ace, 2, whatever) by showing me all of the cards that aren't hearts. This is an example of a proof in zero-knowledge (zkp).

In ZCash, I think the zkSNARK proves that you have ownership of an amount of ZEC greater than or equal to the amount that you are trying to spend in a given transaction.

I don't think submitting a zkp that you called a function would be sufficient to actually call the function. Maybe you could submit the state change that occurs as a result of calling the function, along with a zkSNARK proving that you called a legitimate function in a legitimate way and it resulted in that state change?

This situation would require you to prove something more complex than 'I own n ZECs and n>k, with k the transaction value'. There is a result that any NP function can be proven in zero-knowledge, and I'm fairly sure zkSNARKs are general enough that this is/will soon be a possibility. From the libsnark readme:

A computation can be expressed as an NP statement, in forms such as the following:

• "The C program foo, when executed, returns exit code 0 if given the input bar and some additional input qux."

• "The Boolean circuit foo is satisfiable by some input qux."

• "The arithmetic circuit foo accepts the partial assignment bar, when extended into some full assignment qux."

• "The set of constraints foo is satisfiable by the partial assignment bar, when extended into some full assignment qux."

You wouldn't even have to integrate ZCash and Ethereum, just somehow use libsnark and get someone to accept your oddly formed function call. It might just take a non-trivial amount of work ;)