Hi Abdel, thank you for giving showcase on using ZK Proofs as verifiable DVM. It is interesting case and love your work.

I have no experince yet integrate ZK Proofs in practical application. Given these following function:

https://github.com/atrifat/sentiment-analysis-api/blob/2f16b2ebbec2d2ded723cf00dccf4ef86a0367b3/app.py#L137

How do we implement ZK proofs in those "predict" function?

Reply to this note

Please Login to reply.

Discussion

Thank you.

In general I would say there are 3 options to generate a ZK proof for a specific computation:

- build custom circuits: this is a very low level task that requires deep knowledge of moon math and cryptography, super hard to maintain.

- use a general purpose ZK VM like Risc Zero and prove the execution of your existing code you want to prove. The benefit is that you don’t have to rewrite the code you can use it directly as is. However there is a big performance overhead

- rewrite the code you want to prove with a specialized high level ZK DSL like Cairo (this is the technique I am using). Maximal efficiency.

Oh, I think many devs who are not familiar with ZK proof might choose second aproach due to minimum modification of the original code or they just can't due to all dependencies which hard to be rewriten all over. 😅

> However there is big overhead

Does it slow down much to generate the proof along the code? More than 1000ms?

Yes the overhead can be very big depending of the size of the computation.

Possibly it can be 2 order of magnitudes slower and more expensive.

I see, it is quite hard for critical computation that need fast processing (< 100 ms) especially if the implementation can't be rewritten totally.

Based on your experiences, is it possible to generate zk proof for external API request?

Examples:

1. We provide DVM that gives weather data that were processed from external weather Red API service

I see, it is quite hard for critical computation that need fast processing (< 100 ms) especially if the implementation can't be rewritten totally.

Based on your experiences, is it possible to generate zk proof for external API request? Or is it limited to computation that was calculated directly on host machine?

Examples:

1. We provide DVM that gives weather data that were processed from external weather Rest API service

2. Text Summary DVM that gives summary after request them into external AI service (GPT4, Lllama3.1 405, etc) due to can't self host it

Both cases need external service