S5 - Intro to Circom & ZK App Architecture

ZK & Privacy Bootcamp - April · 28 Apr 2026 · 1:45:38

Milica introduces Circom through signals, constraints and arithmetic circuits. Students build multiplication and number-guessing examples in zkREPL, using circomlib comparators and Poseidon hashes while debugging inputs and commitments.

Speakers

Topics

From ZK & Privacy Bootcamp - April, published by dev3pack; community: dev3pack.

Transcript

Hi. So, I just put a message on the on the Google Classroom and also like on our chats.

So, we will wait maybe 5 minutes before starting. If we're good, all right. Yes. So, I'll see you in 5 minutes then. >> Mhm.

>> Let Let's wait a a bit more. Um just to make sure like who will be on when he was something like this. Because it's very variable content, you know? So Yeah, sure thing. By the way, I put on Google Classroom uh the resources that you put on the on the group. Um Oh, cool. Super cool. People can check it.

Yeah. Yeah, super cool. I've uh Yes. I have devoted some time for it. I even forgot it existed that repo, but I have writing down everything that helped and I'm just like, "Oh my god, it's a gold mine." It's super cool. Nice. Um do do do do So today is about introduction to Circom and also ZK app architecture, right?

Yeah, we're going to make um some uh um uh some um applications, some small applications with ZK REPL. Okay. Yeah. So for them to see how this programming look like in um ZK in the main. All right. Um do do Um I remember last time um

I told him text me and and she told me like she wanted to do something about um for my verification etc. Um, for people who who advance Yeah. with the lean language etc. Like because it's kinda something explored by term foundation actually. Um Yes. Like around both quantum ethereum, you know.

So it's more advanced. Yeah. Mhm. Do you think people would be uh open for that? For a formal verification part in this group? Mhm. If they're advanced enough and want also to to be more into advanced cryptography maybe. Uh I don't know. Like also around um kinda cyber security.

This kind of profile can be interest by that. Mhm. Yeah um it's a bit uh more of advanced topic. Mhm. But yeah, I think it would be maybe better for um September course. Yeah, for those who want to to become kinda a researcher um core ethereum contributor, something like this. Um mhm >> Okay.

So, let's start, I think. Um Okay. Mhm. Also, I put a tweet >> have What did you say? Uh I put a tweet uh a post on X. Aha. I'll never call it X. It will be always be Twitter. Mhm.

Okay. Uh how much we are? 13. Ah, let's see you. Yes, because I was doing a a community call right before. Like 1 hour ago or something like this. And the dogs to get ready for the hackathon. Aha. It's It's starting soon, like in 10 days maybe. Um I >> Everyone is excited around the world. Yeah, but has it something totally new for for me to do at this scale.

It's like, you know, a bit stressful. >> Aha. But I'm I mean, I think people at my place will be more very like far more stressed. But I don't know. It's It's just about experimentation, the first time doing that, you know. It's exciting, but also like what the heck can happen? Imagine the the hackathon platform crash. What to do? I'm a bit scared about >> Yeah. I'm a bit scared about that, but let's see.

Yeah, yeah. What's the worst thing that can happen? Imagine that and nothing will be worse than that. And And did you see me share Mhm. Did you see the >> Yeah, yeah. the post about It's Prague like about events uh this time like this uh going very hard. Um like she she did post it a tweet literally about getting budget etc. on different things.

Um but I I I really think it's good to do that because um most of the people are in the same situation, communities etc. Um so yeah, uh I mean at least people will understand that they have to contribute uh to make uh the existing still uh still up happening, let's say. Um anyway just wanted to share that. Mhm. Mhm. Mhm. Mhm. Let me um Okay, let me share my screen.

Let me share my screen. Zoom is sometimes a bit confusing for me. Let me let's see. All right. Yeah. Just watch. Okay, I suppose everybody see the slides.

Yes, I'm good. Super cool. Um welcome yet again at our fifth session. Um, today uh we're going to look at Circ um. Uh my name is Milica. I'm leading privacy and ZK for that three pack uh with Celine. I'm also doing PhD research in the uh field of zero knowledge proofs. Um In previous sessions we have seen um advanced uh um cryptography. We have seen KZG. I've shared some materials with you on number theory. Um also on different proving systems, what are the

differences. And um in this short time that uh we um have um as a course um uh we're going to showcase um how to work with one of the uh famous programming languages when it comes to ZK uh implementation and that one is Circ um. Um but one thing before uh um before we guys start with that is um uh just wanted to see with you if um you have guys tried KZG at home uh that we had. Um did you guys engage in materials?

Um I just want to hear some feedback. Was it that scary as the last time as you have went through a couple of times uh through equations? And as I mentioned like our resources are on uh on Google Classroom. So if you need anything, it's there. Yeah. Yeah. Don't be shy. Just like say or you can say no, you can say yes.

Yeah. Yeah. Yeah. Whatever. It can be a binary answer. It's That is completely fine. All right. Yeah so Let's let's go through Okay. I cannot move any slides. Why? Let me uh Yeah so let's um Let's talk about Circom. Um So, when you take a look at Circom, on the first glance, it looks like a programming language, but it doesn't

strike you as um um objective programming languages that you have seen or procedural ones um since um it's uh it is not really a programming language um that we see um every day. And so, what is it then? It is a hardware description language. But before we go further, I'm uh curious to um see uh which programming languages have you used uh before.

Um so, you can go write what you are fluent in. Uh either JavaScript or Python or something else. Um let's um let's see. And you can always take the mic as well if that is easier for you. So, I would like to see like uh what experiences you guys have since that would um that would drive me in a better direction to explain Circom to you. Okay, so we have a C++ TypeScript Python Solidity uh Rust Solidity Python Solidity Rust

Huff Nice. I I haven't seen Huff for a for a long time. TypeScript C++ Python Rust JavaScript TypeScript Okay. Um let's see like so it the the answers are um they are uh uh kind of uh repeating themselves and um it's either Python Solidity Rust and TypeScript and JavaScript it's usually revolving around those couple of languages.

Um but yeah, with Circom you wouldn't have um something that um you would see something that resembles classes um like for example those classes that we have in Java for example um and uh um interfaces but um really um if we would take a look at Circom it would be best described as hardware description language.

Um what does that mean? It it means that you need to develop uh a certain way of thinking about um uh about um your code that is not standard as we did with Solidity uh or with uh TypeScript or Solidity uh or or Rust or something else. I'm just reading out comments and and it's uh new comments are popping out. Um but what you need to develop um as as opinion about it is a way of thinking it as if we're thinking about hardware.

So for me, it was a bit easier and more natural transitions since I have I have studied electronics. So when I first saw it, it's just spark sparked something inside of me saying like, okay, this is something familiar. But I remember what was it like when I as someone who worked specifically with electronics when I started studying programming and I have seen objective programming, it was strange to me and I needed to I needed to shift my mindset as well as

for functional programming. So you you would need that small change small shift of mindset, but once you get there, everything will be fine. I promise because I did like couple of shifts in programming like three or four so far. So it is um it is interesting because it resembles the real world. But at the same time, it is a bit constructing as well since you would need to work with um

you would need since if you're going to work with polynomials, then you would need to take care about flattening out polynomials and preparing it for the systems that um Circom uses. And we're going to see them soon. So um, Circom works with wires and gates. Um, that is why, um, usually what is uh, mentioned is that it's uh, hardware description language because in the real world we do have those wires.

Uh, if we see them as one and then as two and then we have those nodes. Um, we also call them gates. Um, and then the operation happens at those uh, gates. So, for example, you would see multiplication of S1 and S2 in its node. That would result in um, a signal, but let's let's call it uh, a new wire, a new carrier of a signal called S5. That would multiply with a new input signal S3 and would result in S6.

That would um, uh, make addition with S4. And that that is how it works like. So, you see it's um, it is not as complicated, but every step putting two wires um, that goes that go in that one uh, that one gate and one that is leaving. And um, yeah, of course there's a set of rules for Circom. Uh, one is working with an uh, finite fields.

Um, we have seen uh, finite fields in uh, the class before. Uh, we have um, we made the drawing on on a blackboard. Um, how does the um, how does one um, finite field look like and what does it mean exactly? And one new thing for you guys and that is rank one uh, constraint system. Um, so what does that mean? Uh, we'll uh, take a look at that uh, once we start working uh, what's um, a polynomial but um, uh, for now you can think of it as um,

the product of two linear combinations that must equal another another. So, it's enforcing it. That is that's why it's a bit different than regular programming languages. So um instead of um, saying like I wrote a multiplication, um, the prover for example would say I must satisfy certain equations, certain set of rules.

Um, yeah, as every language uh, we're using um, to speak one, we have to know the words and uh, those are signals in our case. Um, you can think of them uh, as variables. Um, if we um, have them uh, or constants and variables as we have them in in other uh, programming languages. Uh, but for one uh, we do have um, inputs and outputs. Those are the two main ones.

And uh, we would have the intermediate one, the signal. Um, I'll show you why um, in the previous slide. So, example, S1, S2, S S3, and S4, they would be inputs, but S5 and S6, they would be intermediary ones. Okay, so far, so good. Let's do a small wipe check. Okay.

Okay. Sure. Putting thumbs up. All right. Yeah, but words are not enough. We need something to connect them, and we would need to know the verbs as well. Uh one of them is assignments, the other one is constraints. Um the assignments, they're working um as if you would assign a value to a certain variable, and uh constraints, um they would um we would use them to uh connect and um make um

um let's say uh undeniable connection between um two uh signals. Um okay, so uh for the assignment to uh operators, um this is uh what we're going to use. Um there is uh assignment with and without constraint, and then you would have the constant expression where you are um adding um certain constant um to um a variable. Um you'll have linear ones and, uh, quadratic as well.

These are the operators that we're going to use. And, um, yeah, so, uh, one of the things you can think of as something we had in in physics is that um, with every equation um the the sum needs to be zero. So, everything you are adding, um, let's say this, uh um the, uh, electricity I1 and I2, they need to result in a sum of everything that leaves that node. So, we can see them, um, as wires here, but, um,

if we put everything on one side, saying that I1 + I2, uh, I3 I4 and I5, that needs to equal zero. The same rule applies here, and, um, that's, um, something that you need to have in mind, uh, while writing code. Yeah, this is some, uh, funny electronic circuits that, um, that you can see like how the everything, every node and every wire functions the same way. Um, everything that goes into that node and leaves that node, if we, um, if we count them,

uh, add them and subtract them, it needs to, um, be, uh, equal to zero. But, um, luckily, uh, we do have, uh, rank one constraint system, so we don't have, um, this complicate, uh, this complicated schemes. Um, so, yeah, um, how we're going to present, um, certain equations. Um, usually we will have, um, um, usually we will not have, uh, balanced tree, to say so, like we have here. You would most likely have something that's, um, from, uh, that looks like this.

One example, um, usually it's like this. Uh where um, it doesn't look as nice and balanced. But, um, but, yeah, it is, um, for for the sake of this example, we have this one. Um so uh, with wires and gates that we have here, it is, um, we're going to use, let's say, X1 as input, and we'll have X2 as input, as well. And, um, also one constant and um intermediary um, intermediary signals. I'm not sure

if do you guys see if I am hovering over something? Like this. Is there any change on the presentation? Or not? Okay, I can annotate. Um, Uh, I I I see these are Oh, yeah, okay, fine, wait. Input. >> Okay. Yeah. Yeah, yeah, yeah, super cool. These are inputs. Um, this one is output, so it's it's this one. Okay, I'm not as skilled as I thought I would be.

And we would have two intermediary signals that would lead to calculating X, otherwise known as output signal. >> Okay. People are confirming they're seeing that one. All right.

All right, then annotation didn't go away. Arrow drawings. Cool. Works. So for um so for what we had um in the previous example um now we're going to do uh flattening of the polynomial and we'll need to um create it as a simpler equation using wires and gates.

Um this is your polynomial. But um because you cannot just um present x to the power of two and you would need um an intermediary signal um then um this is your um cheat sheet a bit to um to showcase how can you do that, but um let's um do it step by step using uh let's see. Using this one example let's create a tree um for this one as well.

And uh please um share your uh drawings with us with uh with camera once you got it. Let's see. Do we need Uh so yeah, let's um let's uh let's uh create it like we did in um Let's create a tree like we did in the previous example here. So that we can uh present it nicely. Who's going to show the first tree?

Someone is in tornado warning. Go, Mr. Wojis go. Let's give uh people a couple of minutes so that they can um create a tree out of this one.

>> Anyone ready to share their tree? Okay so using uh polynomial that we have here, um 3 x to the power of 2 + 2 x + 2, uh we should create a tree example that would resemble this example uh before. So, we should have something like this one.

Using using this polynomial. So, we will have 5 as input, we'll have x as input, and we'll have operations, uh but in the end, we should have described this polynomial using a tree. I hope I don't had written down this

uh polynomial. And leave this as an example to what it should be. If someone needs a a polynomial once again now, I can share it again. Yes, I'm checking it

uh uh the validity of the result. Just struggling a bit what's uh the resolution. >> Let me check.

So for Yura, this is 3 * X plus two. So um what we need in this um uh uh what we needed this is wires and gates. But you are definitely on a good track. X * X * three. Okay.

And then X. Okay. All right. So for Akshat, I see that um you are um you have X then you have two in this right portion, but um the right way would be to have um two and X on um on equal sides uh one next to each other and then having the operator that multiplies them.

And once you have that one, then you can do um addition to five. But the good thing is we are on the good track. Anyone else ready to share their tree?

Mhm. Anyone else

for for sharing their tree? Okay, if that is everyone then we can um we can go uh to the next slide. But yeah, um so far from what we have seen in our chat, uh people have shared um their trees, um it is mostly correct. Um so the the gates that we're using um and we see them as nodes,

um they are uh been uh, they should be used as operators. And uh um the end values should be used as input signals. And, uh, we have a couple of input signals here. One is three, then X, then two, then five. Some of them constant, some of them variables. And, uh, people have got it right. Um, so, that is, uh, really great. I do congratulate you guys for, uh, your effort. And, um, let's go further. So, every time you see, um, um,

uh, some of the, uh, um, some of some of the equations like this, uh, polynomials, you would need to think, um, how would Circ process that? Okay? All right. Um, so, for example, >> ask you? Do we need to balance, do we need to balance the tree? My tree is not optimal in this at this point. No. No, no, no. Not at all. Not at all. You would, um, it could happen that you have uh um, everything, uh, on one side, and that is completely fine.

That is, um, that is, uh, just fine. And um there there are issues with that. Don't bother yourself with balancing. Oh, thanks. So, we had, yeah, just, uh, yeah, sure. Um, so, we had an example in the beginning that would, uh, look balanced but um uh, not, um, not every all of them would be balanced out. All right. Um, so, one of the, um, how does flattening look like? And, if we'll take a look at one snippet of circom as it would look like this one and this way

would calculate the polynomial. Yeah, we can start working with ZK Rapple and soon we'll go to website where we can try out everything we have learned and yeah, we don't have to install the rust tool chain and thanks to the park team and that have enabled this for us.

This is website that we're going to use. Let me just write that down for you. Okay. Guys just give me a moment because there is some noise and some guests that have arrived just a second. Okay, here I am.

Guests are going to be fine. All right. >> All right. Um Have Have you guys opened the camera port dot dot? All right. Uh I will code with you guys.

And since it's um for me, I have learned to um work with pen and paper every time I have learned new programming language or just a new perspective, I would be And yeah, people are opening. I see comments. Fine. I would be um sharing I would be sharing my output from uh from my notebook with you guys.

Um so that we go step by step so that you can ask questions as well, and nothing will be rushed. Okay? So, let's go there. Yep. Mhm. Mhm.

See? >> So far so good. Any questions so far? Okay, I don't see much of it.

Okay let's Let's try again. Can you see my screen? Oh yeah that's I see questions. What should we do with calculation? Yeah, it's just describing the polynomial.

It's only for that. Sorry? We can see your screen. Okay, let's try it once again. Okay. Should be now, now? Yes, all good. Okay.

So, uh we should be at this specific address. Okay, I will I hope you guys don't see it well. Thumbs up if you are there. Okay.

So, let's um land everybody on the proper page uh because you would need to um type and um we're going to validate that code and run it and we're going to see results and we're going to play with that as well. Um so, uh it is important um that you see and you should see the original example. So, we're going to work behind that example uh with our own. So, uh let's uh try um okay, first of all, we would need to have pragma um circom

2.1.6. Six. It's difficult to find if I'm looking but I'm writing and I'm also writing it uh the coordination is still not um there. Yeah, we can we can also add a new file. Um you can create new gist and uh attach it to your GitHub as well. Uh okay. So, uh let's try um seeing how does it look like once uh we have multiplication of three inputs? That means it is

to in order to satisfy a rank one constraint system and that one is non-quadratic because we're having this degree of three. Then we would need to have some intermediary or helper signals. And I'll show you how it looks like. Okay set. Um Oh no. Sorry. Uh uh so in in in Circom we have templates.

We're going to use Mux three. Um Let's say uh signal inputs A signal input B then uh signal inputs C because we want three numbers. That's why it's called Mux three.

Then uh So these are all these there's are input signals. So you need to type only that. Is everybody um managing with this? Maybe I'm writing too fast or Then we'll have output signal. Let's call it mux. Okay see.

Why we use ABC? We could use any kind of name. Doesn't matter. Um The thing is that once you are assigning values, you would need to um uh uh to reference them by uh uh by names. Okay let's Yeah, just to make it a more clear one. Um so, also we're going to have helper signal that is not going to be called either input or output because that one is in the middle.

And um let's call it um I don't know, helper. And let's see uh okay, you see everything. So, helper signal would be assigned and constraint A * B. Then mux this output signal. We're going to do the same constraint uh with helper * C.

All good for now? Let us see end of template. And then we're going to invoke them. Saying component main We named it looks three. And then we would be able to have inputs

that is um A So for example, three then B C uh four C should be five And then once we run it in the caracal dot dev, you should have the result of this input.

So let's see what the result is for everyone who have run it. Can we use outputs as inputs? No. You have two inputs for every So every wire is um Every two wires are connecting to a gate but

only one wire leaves the gate. >> Okay. So, for in order to run it, you need to

um uh just to think it's um only enter shift enter and it would it would run your code. Then you can use um uh one of the uh the systems like Roth 16 or Plonk and um but yeah, that is for a for later.

Let me share this with you. So, you should have you should have something like this as a message on the right-hand side once um once you run your code. Mhm. Let's Can you scroll? Um yes, I can. See.

There is nothing apart from this one. Yeah, this is a dash not pretty one, but still there. Oh yeah.

I have forgot this one. Thank you, Yoshiki. >> Uh we can't hear you.

Sorry. Sorry. So, Yura, can you share your screen to so that we can see what exactly you did? I will try. Mhm. Can you see my screen?

Should I stop sharing then? Yes. Okay, then I'll stop sharing then. Let's see. Uh is it okay? Can you see my screen? Yeah, I think so. It's yours. I guess. Yeah. Okay, so where are you um assigning inputs.

Uh I don't know where I should where I should assign it. So >> Just in the in the file? Yeah, yeah, yeah. That's that is where you should have um No, no, no, no, no. It should It should leave as um as a comment. We just need to change variables. Like this?

Mhm. Uh I'm not sure what it's Uh so this is only input. In our polynomial example, we have only one input, X. Yeah, but you said that you have um you have changed the places of input and outputs.

But um from what I see, this is um this is um it is fine to um to assign um input times uh constant. That would That would go. That would work. What do you mean? Uh Uh like in the first example. Yeah, yeah, that one would work. >> Um So we we have R

1 output. Uh we use it in R 2 as an input. And it seems to be okay. Maybe maybe I Maybe I'm wrong. Maybe it's not calculated as as it should. Uh can you run it again, please? Uh I'm sharing only one window. Maybe I should share screen.

Wait a minute. Yes. So, I open Ah, and I see the same inputs. I don't know what should what How can I change it? Yeah, yeah. It needs to um try shift enter for the previous one.

Previous what? Yeah, for ZK-Rapple.dev. Um you would need to then you would need to generate more or And the same screen as well. Mhm. What is wrong with it? Why it generates the same? Maybe it can it Maybe it can work only with that template.

Initial one. What what do you think? Mhm. Mhm. Mhm. Yeah cool. You could for example have um two outputs, one calculating the sum, the other one calculating multiplication.

Yeah, you can do that. But making constraints between outputs, I'm not sure. I'll need to check. Uh huh. If we If we think of it strictly, we should make uh make another inputs.

Right? Okay. And then Ah no. What are the inputs? Uh are they outer sources or or they can be something which assigned it in the program. I don't understand. I don't understand. >> The input we declare the inputs are they obtained

from external sources? >> Aha, aha, aha, I see, I see. Uh um the question is can we make uh constraints between inputs, do you mean? I mean, I want to understand what are inputs. Inputs if I uh guess get it right are are external sources. Yeah, you can think of them as that. Like like if you have a certain webpage and then you are entering some values like username and password, that way you have just uh under um invoking uh your

um your template um what's uh what's uh and after having um your uh inputs declared, um that is when uh um you would have them as inputs. So, like it would be different for any kind of uh um any kind of uh circuit. Sometimes it would be um saying um your age, for example, and then the circuit would need to verify that you are um

over 18 or something like that. All right? So, I probably uh it uh shows the same page web page because it's saved uh on GitHub. Yeah, probably. It It deletes the page for that for the files on GitHub. Yeah. Yeah, yeah, yeah, yeah. That's That's right.

>> so, I want to understand is this calculations correct? Calculate Are these calculations correct or not? I mean, I don't know. >> Um so, creating uh creating uh uh constraints between outputs, um I'm not sure if you can make that. Do you Can you have um multiple outputs? Yes, you can. But, um if you can make um constraints between them, I'm not sure. I'll have to check that.

Okay. >> But, um um I I don't think you can, but I'm I need to uh I need to check it and um like, you know. Okay. Okay, you guys should Okay, now I should share. Do you guys see this?

My notebook? Yes. Okay, any any other questions regarding um this example that we have? Okay. Let's try some other example, then. Okay, want to do this. if I don't start writing something else.

Okay um this time we're going to use just another example to to see we're going to use Poseidon as a function and this is way for me to show you how can you find other libraries in in circom. So we're going to go through that again. Why is that? Because why in inventing the wheel, right?

When you should when you can just use something that's there out of the box. So let's go. So just make new line here. circom 6 And we're going to include um from one library we're going to use two functions.

One of them is Poseidon which is hash. And another one is going to be comparators. So let's go. It is quite standard practice for including libraries and functions. It is just the notation. It's from circomlib. Poseidon um dot circom Another one.

comma dot dot circom All right. Then we are ready to write a template. Let's say guess number And uh yes, we're going to have signal inputs

solution Do you guys see what I'm writing? Sometimes I'm not sure if that is readable enough. That's fine. It's It's not like medicine medicine writing. So that's why Oh, yeah. Yeah. Yeah. Yeah. Yeah. Looks good. >> I still did not um develop that uh style. No inputs solution commitment

>> Mhm yes. Okay. Let's wait a bit for everyone. Uh template um you can think of it um from a functional programming perspective. We can call almost anything a function as a function, but it is more like a class as well. For instance, it is um um yeah, in object-oriented programming, it is um it is um seen as a class so that you can just invoke it with certain values.

Cool. So, okay. much space here. So, we're going to have signal outputs. Answer. All right. Any other Any other question so far? No. And now, we're going to include um a component uh from our library.

Is correct. Uh let me just uh quickly check that one if I'm Okay. >> I just wrote camel cased.

Uh, but it's should be more This is together. Okay, let me Let me share uh this library with you guys. Come on. So that you know where I'm getting um um these functions from. Okay um Here it is. This is um

Eden 3 Circom library. And this is where we're getting our comparators. Then uh also I'll show you these ones as well. But you have a question. Uh sorry. You have a question. Uh-huh.

I'm not sure I do understand. Sebastian, can you please take a mic? Uh yes, sorry. Uh my question is uh Uh, what's the component What's about the component? Uh Can you please refresh? Because sign signal is is available. So, you have inputs and outputs that are available. Correct? And what is component?

Okay. Uh, so for component, you can think of it as we are um trying to um as we are trying to use uh someone else's function and we are um just uh declaring it here. So, we're going to use is equal um as function from comparators.circom that we have um here in uh in uh in our library. Uh, one of those um that um the first link that I have shared.

So, in order to be able to use all the functions um in order to be able to use is equal as a function, we would need to uh name it um as um uh we we need to give it some um name and uh then we'll be able um to use it. That is that is all. Um nothing else. So, someone else have uh has already produced um those uh uh um comparisons for us or um hashes for us and we don't have to write um all of that code by ourselves. But uh we can uh

just uh use it as it is uh off-the-shelf. Um and yeah, for that um we're we're calling it component. Yeah. Um yeah. Um but also let's um Perfect. Let's Thanks. Mhm? Sorry? Thanks. No worries. No worries. That's why I'm here. So, um we want to um do do the comparison and uh since um um yeah, um I'll I'll show uh I'll show you it. Sometimes it's a confusing to

it is not always consistent uh what um inputs and outputs um as in uh of a name what all the function that have been created, but you can always look it up in in a library and it's crystal clear. Okay, so we're going to use is correct guess um as input. We're going to use guess for a first one and I will going to use that.

Okay, here. Input one. We're going to use solution. Then uh we'll we'll use um Poseidon to calculate um solution hash. Uh that is going to be Let me check.

Poseidon or Poseidon. Mhm. And the value would be one because we have only one input. I'll share that one. Oh, maybe now even, yeah. Let's Let's share it here. Okay, let me share this one.

All right. You should see this now. Um so, this is what we're using, this one. Okay, so this is number of inputs. And we have one input here. And we're going to use that one. Okay, on to uh remarkable.

So, now we have to calculate solution hash. So, what did we say? Inputs. So, this is first input. It should be solution commitment. Then the answer

should be is correct. Is Uh uh uh one thing. is missing. Oh, yeah. The output of solution hash. Why did we calculate that one? If we don't want to make a constraint with solution.

I said this one doesn't make sense because it should calculate a hash based on solution. Sorry guys, my bad. This is just solution. And then we should compare if Oh my god, looks terrible. Check.

Okay. So this is uh This is one check and we should say the answer. Our answer should be is correct guess. Output. >> Then we're going to invoke with compound name.

Uh what do we say here? No. It's running away. Should be We would need to have solution commitment. And should be guess number.

It could be a bit better. Right. Then we can have um certain numbers. All right. Let's see. Okay, I will Mhm. >> I'm not sure what is written above. Yes, yes, yes. Um um I'll be uh finding uh example to where it is.

Comparators. And I would share my screen with you immediately. See which one it is. It is It's check is correct guess we took from is equal. Mhm. Let me find this one.

Mhm. Okay. Stop sharing this one, but I will share another one. Here you are. It is this one. From comparators.circom. Takes two inputs, gives one output, and checks if everything is fine.

You have um some um other interesting functions that you can check if it's less than, less equal than, greater than, greater or equal than. You have different um different uh uh circuits, multiplexers, see.

You can go and do a bit of research what everything there is. >> Yeah, it looks a bit weird, but it's because we are um enforcing a rank-one constraints. Mhm. Yeah, people love coding on paper.

Super cool. Let me uh re-share my remarkable. Okay. Um so, as we had previously we're going to use some inputs. Input. Uh what did we have? Uh solution. How did we call them? Solution, I guess. Okay.

So, where and okay, we need solution. I'll tell you how to reach this number. So, you see, it's writing somewhere here. It's getting dark. But here, but um should be Oh, here it is.

9904. Why is this? Because that is um sign hash of four. Close everything down. Let's have a chance for everyone to write this.

No. Doesn't want to cooperate as I want to. Yes, yes, yes. Should be It should be um should be JSON like I don't know. Um Yeah. Yeah, my bad. Mhm.

Yeah, people are following. People are following. So, it should be guess instead of answer. I'm proud of you guys. You're not You are not uh um uh You're actually following the class and it's not too boring for you guys. What's the problem? Check.

Yes. Let's see. Correct guess has two inputs. One is guess, the other one is solution. Solution hash. I'm going to walk and get giving it solution. We're comparing if the hash that was computed with Poseidon is the same as the solution commitment. We're enforcing that. And also we're making constraints there. The answer should be the output of is correct guess that out because we got guess and solution both there to be

compared. Then we're binding that the solution commitment cannot be changed. Not sure if we have missed something. Let's check. No, no, no. Not It can be one. Let me check. I'll share.

So it is component and let's see. Which one is correct? Guess.in, right? Is that you are what you are? So um it doesn't need to be that sometimes it's um dot in um as what uh is equal. Um I'll um as I as I shared with you guys with comparators here, um this is uh

this is the one. I'll paste it here. So, the function we're using for a comparing um has two inputs and both are named uh with in. Um the other one we're using uh is beside and it has um inputs. But, let me check once again just to make sure. Should be Yes, inputs. Okay.

So, the other template we're using is this one. So, that's why it sometimes it's confusing, but it's Mhm.

Yes, it's uh every time it's uh depends on what is defined which what each component we have um we we're using. So, this time we're using Is equal and Poseidon. Uh some of them they have um inputs like Poseidon has um the number of um parameters. Um then um Is equal doesn't um have um inputs within a function but um through parameters.

Uh uh um Sorry, Poseidon they're using parameters but um they're both using inputs. Yeah, depends on the

So, I see people are a bit complaining. It doesn't work as um as we have imagined but um due to ZK Rebel.dev but it's could be that something that is left in cache. Could be that it's just that it's saved. Um one of the two reasons could be uh uh uh uh Oh, yeah. Also, it could be that um that number is not the Poseidon hash of four. So, which one Who can calculate uh Poseidon hash of four?

Mhm. And if we copy that instead of this number Which website have you used, Akshat? Mhm.

Okay. Guys, you can save this example as just on your GitHub. So that we have it for for later references. And once again, congratulations. You have built um your first circum circuits. Okay, guys. Um if there are no

questions, that would be it for today. I would encourage you to play, um, a bit around, um, ZK REPL, and, uh, see, uh, if you can, uh, create some, let's say, guess numbers. It doesn't have to use any specific hashes. You can use some other functions, but, um, uh, playing around, and, uh, uh, yeah, I can I can create some homework. I would, uh, um, I will, um, send you two or three tasks, um, so that you can, um, write that down, and make, um,

uh, assertions, and, uh, and constraints, and we'll see if, um, you got that right. Yep. What will be next time? You'll see. It's going to be a bit of surprise. Okay, Selene, if that is all, I'm going to send, uh, homework, and we're good for today.

Yeah, and I will put the recording, uh, on YouTube, and then also on our chat, please Google Classroom as well, and, uh, yeah. We're good. Thanks a lot. A lot of practice today, again. Yeah. But, yeah, that's good. Like it's a small group, but very interactive one, so. Yeah. Yeah, yeah, yeah. Small but chosen. So, see you, See you on Thursday, then.

Yes. All right. Take care. Cheers. Bye. >> See you in two days. Bye-bye.