[General] Privacy of data stored by the smart contact #908
-
Team or ProjectNo response EnvironmentTestnet L2 block numberNo response Provide a brief description of the functionality you're trying to implement and the issue you are running into.From https://docs.zksync.io/zksync-era
What exactly does "most data" mean here? Where exactly is it stored? More specifically, is if this data from zk-sync 101 example (especially the The issue we're trying to tackle is prove that a transaction happened and stored some data for later retrieval without revealing the data that is stored. In our application, a user would call a function in a smart contract. This function will do some computation and store the results. Another function will, at some later time, use this stored result. Repo Link (Optional)No response Additional DetailsI tried to look at block explorer and did not find any answer there. See screenshots below Smart contact
2025-01-22.23-13-36.mov |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @ranile , great question! The data in your contract is never private, even with the |
Beta Was this translation helpful? Give feedback.
Private variables are stored in the same way all contract variables are stored - the main difference there is that they are not visible in derived contracts: https://docs.soliditylang.org/en/v0.8.24/contracts.html#state-variable-visibility.
This data could be decoded from the transaction data on the explorer, although it's not easily readable.
If you want to prove something about the private data (for example, that a certain private number input X resulted in a final calculation Y), you could use something like SP1: https://docs.succinct.xyz/docs/introduction, or another ZK proof-based solution. This way X would stay private but Y would be public.
If you want to be able to access the exac…