What is Nostr?
Abdel / A₿del ∞/21M 🐺 - 🐱
npub1hr6…2e29
2024-08-01 14:33:45
in reply to nevent1q…tl59

Abdel on Nostr: So in this case you would need a way to prove that the computation was done ...

So in this case you would need a way to prove that the computation was done correctly. A hash is not the correct way to think about it, since a hash is about integrity of data but not integrity of computation.
What you need to generate is a Zero Knowledge Proof, there are many different type of proofs (SNARKs, STARKs, and many variants in each family etc).
You have multiple approaches to prove a computation. either you build specific circuits / AIR for the computation you prove, or you are able to prove a higher level language, where you use a VM that is provable, and then you dont have to write custom circuits for each computation.
This is the approach i am proposing here. Basically you can write your computation in Cairo language, which is a language that enable you to build provable program.
So in your example the flow would like this:
- write a program in Cairo that performs the sum and return the result
- run the program with the Cairo VM to generate the execution trace (something needed to generate the proof)
- run a prover (like STWO) to generate the STARK proof
- then on the client side you verify the proof instead of re doing the computation yourself

Of course on small programs like this example it does not really make sense because you would just do a naive re execution and compare the result. But on complex programs it makes sense because the verification is exponentially faster and cheaper as the program complexity grows.
Author Public Key
npub1hr6v96g0phtxwys4x0tm3khawuuykz6s28uzwtj5j0zc7lunu99snw2e29