---
# System prepended metadata

title: My First Halo2 Circuit for Dili Babies.

---

# My First Halo2 Circuit for Dili Babies. 

Disclamer: This is my understanding of a [Vitaliks article on ZKP](https://medium.com/@VitalikButerin/quadratic-arithmetic-programs-from-zero-to-hero-f6d558cea649) that was then converted into the HALO2 cirquit with the help of [this video series](https://www.youtube.com/watch?v=zXF-BDohZjk&list=PLePMF1PHQMvGosj3kE646fdRmjpwaHB5r). While those were hlepfull, I did find both peieces of information not sufficient to effectively on-ramp on their own. Both make some knowledge assumptions, or face technical issue making it super hard to follow. 

 

## What is a Zero Knowledge Proof?
In cryptography, a zero-knowledge proof or zero-knowledge protocol is a method by which one party (the prover) can prove to another party (the verifier) that a given statement is true while the prover avoids conveying any additional information apart from the fact that the statement is indeed true.

**Example:** When going to the bar in US you will most likely be asked for an id to check that you are over 21. The issue is when you hand the id to prove your age you also share your full date of birth. Ideally you should be able to prove age without sharing the DOB.

## What are we going to prove?

In this tutorial we will pove that for a given equation x^3+x+5 we know such x where the equation will ecual to 35. In other words we will prove we know such x that will suttisdfy x^3+x+5=35.


## Flattening the problem.
First we need to express our problem in terms of * and +. That is because the our circuits only support those two operations out of the box. Luckily enough that is very easy to do:

```
a = x * x
b = a * x
c = b + x
d = c + 5
```
We can also visualize it as a circuit aka chain of gates. I will be making more analogies to circuits later as well, but here the important part is that we only have 2 gates which are + and * as well as we tend to pass the output of an earlier gate into the next gate.

![](https://i.imgur.com/XEAocAO.png)

What we will try to check later on is that after every gate our output is exactly correct. So if we set x to 3 in the first * gate then a should be equal to 9. We would need to add such check for every gate and we will do that in tne nect section with the means of Rank 1 Constraint System.


## Translating this into tables
When it comes to Circuits everything we do is stored in a table. Then we can run different operations on the table to make sure that the table is valid. This process is essentially called verification.

Let's try and visualize this for x = 3. This is indeed the solution to the problem.
