NoirHack 2025: Official Kickoff & Intro to Noir

NoirHack 2025 · April 2025 · 1:01:07

Public blockchains’ “enforced transparency” is presented as a barrier to real-world use, while Noir is positioned as letting developers who are not cryptographers build privacy-preserving applications without hand-coding circuits. The kickoff combines that argument with a four-week online sprint and a beginner workshop covering circuit compilation, proofs, private-by-default inputs, unconstrained-function risks, Noir.js and on-chain Solidity verification. The tooling is explicitly framed as a test, with some parts expected to break or underperform.

Speakers

Topics

From NoirHack 2025, hosted by Aztec Network.

Transcript

uh people can uh trickle in and we got this recording as well. So all right everyone uh welcome uh this is the Noir Hack 2025 kickoff. Really excited you're all here. So let's just uh jump into it. So let's uh just get straight to it. Noirhack is for you. So this is your space for the next four weeks. Your chance to dive into Noir to learn to collaborate with other builders to build things that matter for privacy. Uh to make connections and maybe win some prizes along the way. So, what's the plan? Uh, what is Noir Hack? Noir Hack is a 4-week fully online sprint focused on building privacy preserving apps with Noir running from right now to May 9th with demo day May

12th. So, the first couple of weeks will emphasize learning, exploring ideas, and uh checking out our workshops. Weeks three and four are heads down build time, but I want to clarify you can start coding whenever you feel ready. Uh the end goal is demoing your project for feedback and for prizes. Uh so we've got a large and diverse crowd. So we have three informal tracks to help you find your footing. Beginner, intermediate, and advanced. Uh beginner is if you're new to uh noir, new new to ZK, focus on uh learning the core concepts, building a cool and maybe viral even demo and asking lots of questions. Intermediate is if you've got some experience. Uh you can aim to build a solid project, connect with others, uh maybe build something grand prizeworthy.

And advanced is if you're deep in the space. This is where you uh push limits, build foundational projects that could become uh companies or products and mentor others. So all of this is on our start page for more details. Uh the norhack.com/start page. So immediate next steps, what to do right after this call. Uh first get in the discord if you haven't already. Uh go to uh the get rolls channel, grab the noir hack participant and your experience level track. Uh do this uh it's actually really important. It's how we'll judge your projects building up to demo day and engage with you as the program continues. And then second, jump into introductions. Uh post who you are, what you're about. Uh I created this

channel to just streamline the introductions. cuz I've added a pin message as well um to lay out like how to do your introductions. And then third, for beginners, your first clear task is on the start page. Complete um one of the intro tutorials. Um and we also have a proof of proof uh channel uh which where you can where you can post your uh first proof. And then fourth uh for intermediate advance, check the dev guide on the start page and start looking on the team formation uh channel. And so let's let's take a quick look at week one goals uh for each track. So for everyone uh check out the workshops this week. Uh they'll be key and also join the team and track session on Wednesday. Um that's tomorrow. Uh

beginners uh finish that tutorial post your success in the proof of proof channel and ask questions and help. uh intermediate start sharing ideas uh needs and team information connect with people uh try to help answer questions and review the core libraries some of which will be in the workshops even this week uh with ZK passport presenting on Friday and uh advanced uh connect with peers uh mentor and help uh post your ideas and you're looking for members needs that's all in the pinned message in team formation and then start thinking about uh teams and building out uh an idea Uh again, the uh noirhack.com start site has the full list of all of

these. So um Discord will be our main communication hub. So please use the dedicated Noir channels. Um announcements for all official stuff. Um notifications about any workshops uh or any other things that you need to be aware of. Uh introductions to share uh more about yourself, help and then team formation. and then proof of proof and other channels for any specific purposes. Uh check the pin messages often and be sure to use your track roles um and ask questions and engage with other builders and our devro team as much as you can. And second, the notion site start page. Uh that's uh www.noirhack.com/start is our main

infohub. All relevant documentation, guides, schedules and eventually uh workshop recordings will live there. So think of that as our source of truth document. uh we'll keep it updated. So um team uh team formation and tracks teams are uh an important part uh and a big part of how uh you can take a hackathon project and turn it into a full-fledged company or product. So we'll talk strategy in the teams and track session tomorrow. For now use the team formation uh channel and check the pin message for format. Uh and working solo is also cool. uh just focus on uh building on bu uh laying out a good idea. Uh stay engaged on discord and

stay checking the notion page uh and start building and consider getting feedback from other uh builders and from our team as ideas will only get better and more refined if they're uh challenged. Uh we'll also share more tomorrow on how you can use your track more effectively to engage with other builders and with our team. So what's next? what happens right after we uh close this call. Um first um during this call our no here uh will talk a bit more about uh the bigger picture and why privacy is so essential right now. Uh then stick around for the first intro to noir workshop with cat.

Uh it's aimed at beginners but could be a great place to fill any gaps you have in your understanding even if you're intermediate or advanced. Um and then um second we have uh tomorrow we will have the teams and track session. So don't miss it if you're thinking about collaboration. Uh there will also be more details on how to leverage your uh role uh a lot better. Um and then we'll also have our first ecosystem workshop with Michael and exploration engineer at Starkware who go into verifying noir proofs on Starknet. Thursday will be the deadline for showand tell which will be a great way to engage with uh our team building up the demo day and to find other teammates. It'll evolve as the program moves forward. So be ready to share and present whatever you

submitted. It's all right if it's just an idea right now or if you're a beginner. We're interested in just seeing your creativity and engagement. And uh finally, uh this Friday, we'll have our first library workshop with Theo, who's a co-founder of ZK Passport, um who is actually recently featured in uh uh Vitalik's post on privacy. Um so, it'll be a great way to start learning to build with this first building block. Um and again, all of this will be communicated in the Discord and laid out in the notion side star page. So now to talk a bit more about the bigger picture and why privacy is so essential. I think literally right now uh I'll hand it over to Arnu. It's always a little a little bit daunting um having u like a vitalic

tweet uh staring at you while you're while you're talking about something. Um before before I kick kick off like why I'm I'm excited at this present moment for for Noir and for for privacy and and the whole kind of privacy ecosystem. I just want to say like uh we have about 100 people on on the call now. We had more than 600 people um uh asked to take part in in Norhack. Um if you've joined the call late or if you uh are watching this on a recording um like we've we've done this in a in a way hopefully where uh if you put in effort to meet people uh to like get feedback on ideas to get better uh over the the four weeks you'll

you'll get quite a lot out. Um but uh there's just a a lot of you which is amazing. We won't be able to hold hands for for everyone. do like try to reach out to the team if you're stuck or or if there's anything that you need help on. But um I just wanted to to say that that this will be um as good as the as as what you put in essentially like the the the more effort the more um vibes you put in the the the better the the whole month will be. Um to get back to what I was actually prompted prompted to talk about which is why why I'm particularly excited. Um I I it's always a bit of a risk for me to to go into into a long monologue about this. I'll try to keep it short because I know there's hacking

to be done. But um you know in in the '90s uh we used to speak about uh cyerspace. We we used to speak about uh this place this digital uh place which was going to be a frontier where we could maybe get out of the mess um that we were in everywhere else. And gradually over the course of uh let's say the first 35 years of of a proper internet um we stopped talking about cyerspace right we we started talking just about the internet and about memes and for whatever reason our ambitions decreased and I remember um feeling quite stuck uh in the early 2010s because I I felt like there was

all this leftover promise uh for what we'd started in the '90s but never really accomplish lished and that's the context in which I encountered the the kind of Ethereum white paper you know the 2014 white paper we're going to get to the tenure of of the launch of Ethereum but like the very first white paper was was in 2014 that's what it promised to me right it was to get back at a level of ambition that we had lost sometime in the early 2000 about what online what cyerspace could be and cyerspace as a frontier as jurisdiction that was not just the US or Europe or um Argentina or or whatever else. It was uh

a place with its own culture, its own economy, its own rules. And uh Ethereum in 2014, I really thought was going to be it. Um I still think it is going to be it eventually. But what we realized when we started really pursuing this idea um uh when we started in 2017 with what became Aztec is whenever you tried to do anything real on this new platform that had deep down all this promise, it was only one or two steps after getting started that you'd hit this fundamental barrier which is real life, real things just can't happen if everything is forced to be fully

transparent. uh enforce transparency that public blockchains um that's kind of the rule of public blockchains, right? This enforced transparency. It's not just because um uh there there are things that are uh we have things to hide or what have you in your daily life. That is not something you would accept, right? And that's what we found out in 2017. We went to all these uh uh both businesses and um funds and potential customers and they just were quite keen on the pitch that we gave them at at a high level. But as soon as we started describing Ethereum, everything shut down because uh you just can't do the things you want to do. um if you have to

reveal to the world at all times everything and you know we had the brief hope in 2017 2018 that someone else would solve this problem for us. We just wanted to build products. We wanted to build things that bring people to this new cyerspace jurisdiction. But we quickly realized that there was just no one there, right? Um we we kind of had to do it ourselves. We were very very pragmatic along the way. Um and like in in retrospect we really tried to go the shortest distance at every step to try and get privacy that was workable that was easy to use that was extensible that was um that was

useful that was real privacy. Um and uh I it took us you know seven seven odd years to get to where we are now where I think for the first time you have people um who are taking tools who are not cryptographers and I I really really hope that of the 600 people who've asked to take part in no hack at most 20 are cryptographers that that is what we built for um and we're we're starting to see people actually take our tools and not have to understand the underlying cryptography and build products on top of uh any public blockchain or private blockchains like like our only to Aztec

and build really really powerful applications um that are not limited by uh the enforced transparency that public blockchains uh have kind of thrust upon us so far. I was having this conversation a couple months ago with um a friend who I think had also been quite enamored with the promise of blockchains quite early on but um had soured on it quite quite badly and uh it's only when I started talking to him about the things that you can now do uh with zero notch proofs and with private state uh and with tools that are just on the horizon like collaborative snarks or that are getting more and more practical like te's Um, and hopefully in the kind of long-term future things like FHE, uh,

that I saw him get like see the promise again. Um, and so that's why I'm excited about Norhack. Um I think uh to me it represents uh a real test but also just something really uh exciting about the state of the tools that uh we've built over um the past seven years that we've uh and and the team has poured just uh just an incredible amount of effort into making practical and performant and uh and easy to use for people who are not uh willing to just handcode circuits like we were back in 2021 or 2022. Um, but it's also a real test for us, right?

Um, it's a test of uh that effort. It's a test of uh whether everything will um uh will work. And I'm sure some things will break or will not be quite performant enough or or what have you. But ultimately, I'm just excited about the prospect of finally getting back to the original promise of uh blockchains, which is actually the original pro promise of um of the internet of cyerspace, right? Um I think we are finally we finally have within reach this this idea of creating this new jurisdiction this frontier for uh the world as it currently exists that is actually uh this jurisdiction that is adapted to the world's post internet um uh instead of always having to rely on these jurisdictions that um I think at

this point are quite obviously stale and and no longer fit for purpose. So that's my that's what gets me up in the morning. Um, and I'm I'm so so grateful for uh you all dedicating time over the month uh to use the tools to to build things with it uh to push the limits. Um if things break, just do please let us know. If you're confused about things, reach out to uh either the team or each other. Um and I'm I'm incredibly excited to see what comes out of this month. Thank you all. Hey man, thank you. I don't think I have the yeah I don't have the cool animations but um yeah thank you Arno for the the kind words and for uh sharing the broader context and um yeah

I think uh I agree that you know it's really what you uh put in. So, real quick, I think I'll share the notion page, which is what you should look at immediately after this call or maybe even during this call, especially if you missed uh parts of the presentation, and then we'll go into uh Cat's uh workshop, which will be a great intro uh even if you are uh intermediate or advanced. Uh but let me quickly just pull up the start page. So, right at the front, the very beginning, you have these check boxes on your side. You should be able to click these. Um, so again, the first few things will just be to join the discord to set your uh role. Um, and then to

introduce yourself, and then there is a weekly action plan. Each week, we'll update it with specific uh tasks that you can complete uh based on your experience level. Uh and then there's also this guide for more details on how to get started ideas uh and it links out other resources and then uh yeah let's look at uh week one. So for everyone uh join Discord, set your role, set your track role, introduce yourself, review the resources, check out the workshops uh we're about to start one right now um and also um share uh your journey uh if you'd like. And then for beginners um uh I really encourage you guys and then really anyone to participate in this

proofof proof channel uh where you can share uh your first uh proof u with a screenshot or with a tweet um and try to ask at least one question in the help channel in Discord uh for intermediate start posting project ideas connect with other people um help answer questions and review the core libraries. Again, we'll have a library workshop on Friday with uh Theo from ZK Passport. Um and then for advanced uh start getting feedback on your ideas. I would say like this is the main thing that I would emphasize and really like what makes or breaks um you know what turns an idea from just um some kind of like seed to what could potentially be a protocol or a product or business. So really try to

take advantage of the program and uh get feedback not just from our team um and you know later from uh our VCs that will be a demo day but from other builders um and try to refine like what it is that you're working on. Um and then finally uh the calendar is down here other resources and then the Friday show and tell. So this will be one way to get that feedback on your idea or on um what it is that you're building. Uh so try to apply by this Thursday. Um and uh yeah, we'll we'll have a a cool set of different uh options around uh how we'll share um what it is that uh you guys have have uh submitted and you may even uh get to present before demo day. Uh but yeah,

uh I will leave it there and then I'll hand it off to Cat to kick us off with a intro workshop. Thanks everyone. Yay. Thanks Rafie and Arno. It's always so amazing to come on the calls and hear Ann Arno speak about privacy. All right, let me see if I can share my screen here. Hold on. My privacy settings are [Music] off. I got it. I'll be back in a second, I think. Hold on a minute.

The classic Zoom permission shuffle. Yeah. Um, in in the meantime, while we wait for Cat to come back on, I I know that a lot of you have already found found the Q&A tool um on on Zoom. Um, just because there's there's quite a lot of people uh we couldn't open up the the main chat, but feel free to ask questions in there and uh obviously in the Discord as well. All right, I'm

back. Sorry about that. Can everybody see the slideshow? Yep. Okay, cool. So, um, welcome to Noir Hack everybody. This is super exciting. I think this is the biggest thing we've ever done for building with noir. It's kind of nerve-wracking. Um, but I'm really excited to see people dive into this for the first time and see everything we've been building over the past few years and actually build something really cool with no more.

There's so many different um, ideas and it's going to be awesome. But today I'm just going to talk about a little kind of introduction to zero knowledge in general. Um, this is a super super beginner workshop. So if you've never touched noir before, this will be good for you. Um I just kind of want people to like understand CK, understand noir. We're going to install Noir from scratch and just write a circuit and prove it, verify it, and and do the whole flow so you can see how all that works. We'll explore like a little bit about all the things that Noir has to offer and different things you can do with it. And then we'll also look at like gen generating a solidity verifier um which you'll probably be using in your projects. Um so you can actually do verification on

chain. So for those of you who don't know what zero knowledge is um it's basically just a proof about a fact that doesn't actually reveal the information about that fact. Um it's used for privacy. It's you know there's lots of examples. I think we have ZK passport coming in on Friday and you can basically prove anything about your passport like where you're from, your date of birth or just that you're like age is above a certain thing or your name or your last name or something without revealing any other information about that passport and it's verifiably true which is pretty freaking cool. Um, kind of like a way to think about how it works is that you've got two different entities involved in this. You've got a

verifier and you've got a prover. prover is just going to be you. Um, you're just proving something. You have all the information and you're giving some sort of like this is what it is. And then a verifier takes takes that proof and run some complicated math on it and verifies that the proof is is legit. But a good way to think about it is say you've got this verifier who's got like two balls, a blue ball and a green ball, and the prover just wants to prove that they know the color of the ball um without like revealing how they know it pretty much. So the verifier is going to throw a lot of challenges at the prover like okay tell me this tell me this I'm going to verify that all this is actually true and say like he's got the balls behind his back and he's like this is a blue

ball he takes out a blue ball and the prover says yeah that's blue and then the verifier like shuffles it behind his back and takes out the other ball and then the prover says um yeah that's different or it's the same as the previous ball and like he could just be guessing it's like 50/50 chance of whether or not this prover actually knows it but then the verifier is going to do it like hundreds hundreds of times, thousands of times, and eventually you're going to pretty much figure out like, yeah, prover knows the color of the balls. Um, so that's kind of like what we call an interactive proof. But now we've got to the point where we can do all this in like one. So the verifier bundles all of these like challenges into one big challenge and send it to the prover.

Prover does it all in one go and sends it back. And then because of that, we don't just need only the verifier to to verify it, but like anyone can actually verify um because it's just like one thing that you have to run rather than this interactive thing. And that's called a snark, which maybe you've heard you've heard this word. Lots of people are talking about it everywhere. Um and the important word here is it's succinct, so it's small, and it's non-interactive argumentative knowledge. Um, not this isn't like super important when you're building with noir, but I think it's useful to just be aware of because there's loads of different words that you're going to bump into when you're trying to build with stuff with noir.

Um, and there's also different types of snarks and there just like different optimizations, different reasons you might use them. And the cool thing about noir is that you can use all of these different like snarks um to generate proofs. So you may have heard like growth 16 or the word plonk or the word like honk or ultra flunk or ultra honk. Especially if you're on like crypto Twitter, people make fun of these words a lot. Pretty much all they are is are different types of snark proving systems. And noir um it's its own language like it's it's language but it's really really universal and you can use any sort of proving system with it.

And it's really like good to think about how these things are decoupled. So when you're writing something in Noir, it compiles down to abstract circuit intermediate representation which then is like fed into the virtual machine and that translates this ACIR into what like the constraints for whatever proving system is specified. Um so we're going to be using in this workshop Bretenberg which is the one that Aztec is building and you can use different proving systems with Brentenberg. Um but we're going to be using ultra honk. If you want to use a different one, like if you're doing a lot of onchain verification, you might want to use a different one that has different optimizations. Um, let us know in Discord and we can we can talk through that. But yeah, like the flow of how

this kind of works is that first thing you got to do is write a circuit in. This is an example of a circuit. Like it literally just looks like code. Noir is really based on Rust. And hold on. Um, it really just feels like writing a Rust program. That's kind of what we're trying to do here. And this is this what this is doing is it's taking in X. It's everything is private by default. So you don't have to specify that X is a private thing. It's taking in X. It's also taking in Y, which is public. So that means the verifier has that has has Y. And it's asserting that they're not the same. Um, so you know, you can assert that they're the same as well or whatever. We'll we'll write this in a second so you can have a look at

it. This field is just like the default field for whatever proving system we're using. Um so you can kind of the way you work with fields is like pretty much with like unsigned integers. Um that's how they look. But yeah, you use these for a lot of different things that you'll be doing with noir. Then you're going to compile it down and then you can execute it. And when you execute a circuit, you pretty much are just like assigning the variables to it. So say we would say like x is one, y is two and then we execute it and then we're like um kind of running it like a program like this this is actually you know executable this x and y and then this is the variables that I have assigned and yeah that's called a witness. So like

saying that x is one y is two is is my witness for the circuit. Then once we have our witness and we have our circuit we can prove it. So we specify whatever proving system we want to use. for example, Berettinberg, which is the one we're going to be using. And then we pass that to the circuit and we pass our witness as well. So we pass that like X is one and Y is two and then we can verify it. So we give that proof over to a verifier that can just be a person. Uh there's no like information in this proof. You can it's just like a string. You can pass this give it to anyone. Um and then they are going to run computation on it to to um verify it and then you've got a verified proof. A verifier can also be

like a smart contract which is cool. So if you want to follow along you can do that now. There's also going to be recorded. You can follow it later. Um or you can just like have a look at this repo. It's should be pretty laid out pretty well. There's like read me and stuff, so you can just follow it from there. Um, but you can go here. This is my GitHub. What is nowhere? Wait, is that what it's called? Yes. Okay. Um, this QR code will go there as well. So, it just looks like this. Um, we're going to be going from starter.

Whoops. Yeah, starter. And then just like making our way up to main. There's multiple different steps here. They each get a little bit more advanced and teach you something else. And that's what we're going to be going through. So, I have it here in my thing. Um, step one, step two, step three, step four. So, if we start with step one, there's nothing in here right now. We've just got a read me to like install stuff. And actually, I'm not going to run this. Um, but if you go to noirline.org, or click read the docs and just go to this quick start getting started quick start guide. This is going to install um noir up and then you can use that to

install nargo which is like the way that you're going to install different noir versions. So if we run this here we can see that like it's installing noir up. I would run noir up. I'm not going to do it but that's going to install nargo. It's really similar to to Rust if you're familiar with it. And then um we also want to install our proving back ends. We want to install Brettonberg. And you can just run this. It's like the same thing. You run this thing that's going to install uh BB up. And then you run BB up and it'll install Bretonberg. So got to do that. That's also in the readme in the in the repo. So I can see that I've already installed it. If I go nargo version and

BDF version awesome. All right, step one. So, we're going to start from scratch. We're going to make a new program. Super super simple. I'm going to go in step one here and just do new and give it a name. So, I can call it main. And then you'll see that there's a a different directory that's been created for me here. This main directory, it's got a source directory inside of it. Main.nr.

This is our circuit. Um, every circuit you've got to like call the main function main. Um, that's going to be the one that's actually generating the proof. It's also got a nargo toml. So, this is for like specifying, you know, the compiler and stuff to use. And if you're wanting to use any sort of noir libraries and dependencies, you'd pop them under here as well. Um, which we can do a little bit later. But if we have a look at this, this is the example that's in the slideshow. So we're taking in X, which is field, Y, which is a public field. So the verifier knows it, everybody knows it, and we're asserting that they're not the same. We can also write little tests here. Um, so these won't actually be doing any proving.

We're just kind of testing that like this actually works. So if we go into here, we can we can run our tests. We can just do nargo test. And that's going to run everything that has this like test um macro on it. couldn't find narl. I'm not in the right directory. Okay. Oh, yeah. Like something that I always say when you're running kim is make sure you're aware where the narl is because people get tripped up over that. So we'll do n test and then yeah this is passed because x and y are not the same. We can also just like play around with it.

So we uncomment this and comment that one. So now x and y are the same. We should see that it fails. Yeah. And it'll tell you why because this is not true. Cool. So now we can get onto some actual proving. Um first off, we got to actually generate like the constraint system. So we got to tell them what we're what the X and Y variables are going to be. So we can run something called nargo check. And that is going to generate this prover.l right here. And this has like all of the variables that are going to be passed into main noir.

And then that's going to be the information that the prover has. So this is like completely client side. This information doesn't go anywhere. It's just whatever whatever I have as the prover. Um so let's put one and two in here again. Those are not the same. And then we can actually generate our proof. So if we remember from the slideshow, we got to generate our witness first. And all we got to do there is do nargo execute and then whatever name you want to call your witness. So I'll say witness. And then you've got a target directory that opens up here. And this is the compiled circuit. This is going to be what we're passing to like different um things to prove and verify and stuff. That's what

it looks like. And then this is our witness which looks like this. If you try to open it, it's like a binary um file. You can you can look at them in a different way, but the way you're working with Narot, you don't have to. So now we've like done everything we can with Narot. We've generated our witness. We've got our circuit. We've written it. We've compiled it. And we can move on to using Bretenberg. And that's going to be our proving system, and we can prove things and verify things with that. We've already installed Bretenberg. We got EB in here. Um, and then we can just use it to to prove some things. So we'll do VB proof. We're going to pass in the compiled circuit. So we have it here target main.

Whoops. Main.json. And then we also got to pass in the witness that we generated. So we'll do target witness. It's right here. And then we got to give it like the output of where we want the proof to actually go. So we'll do target. Yeah. And then it's going to be put into target. So you can see here this is also like a binary file. So it looks kind of scary. We'll see it properly later when we use norjs. Um you can see what what a proof like is going to look like with hexodimals. But this is our proof. So we have a proof and inside this proof it's also got our public inputs. Um so we can literally just pass that over to to like breenber

verifier and they can just run verify which we can do right now. So before we verify, we got to we got to generate a verification key. And the way we do that is by passing in the um circuit and an output of where we want the VK to go. So now we have our verification key here and we're going to use that to actually verify the proof of that we've that we generated here. So we'll just do VB verify and we'll pass in our proof target proof and we'll give it the verification key as well.

Okay, awesome. That was really fast. So we're using alter honk here. That's the default um for Brentenberg. And we have verified our proof successfully. So yeah, we I mean we can like test it and make sure that if we give it something else and it's not going to work. I did this earlier because I'm jetlagged. Um whoops. Yeah. So little error which is good. Cool. So that's like super basics of Noir. Um we have just written a really really simple circuit. We

compiled it. We generated our our um witness. We got our proof and we verified our proof. Super super simple with with Nargo, which is really fun. So, if we go to step two, this is going to be a bit more exciting. I've already like created something here. And we're just going to like play around, I guess, with with different things that that Noir can do. And you can see that it really does feel just like writing regular Rust. So, if we let's build something like a membership thing where like you're trying to join a football club or something and it tests that you are above a certain age. Um, and we can just do this in a really simple way.

We're not going to use like CK passport. That stuff you're going to learn on Friday, but we can just play around with different types. So, say we have like this like global type that's like a person. Um, and the person is going to have Okay, it knows what I'm going to type. So the person has like a name. Um you have to whenever you're writing circuits you have to make sure that everything like has a size because um when it's just compiled into constraints like it needs to know the exact size of the circuit. So you can't have like an arbitrarily sized string or array. So because I'm going to use me here just as an example we're going to give my name is cat with three letters. So our string has has three letters and we can also give it an age. We got different types

of integers. Um we can use u8 here unsigned integer. Um what's this given me? Okay. So then we can also just say like the minimum age. So say we're going to just test that my age is above 18. So we can do like global. This is going to be used throughout the entire entire program here. Minimum age that is a uh as we specified there. And we'll say that it's first 20 because it wants me to do 18 and I don't want to listen to it.

Whoa. I clicked the button accidentally. And then in our um main, this is our our main thing. We're going to pass in like the member which will be of the type of person. And then we're going to test that they're above the minimum age. So all we're going to do is assert that the member age is above or equal to the minimum age. My cursor is so and then if that's all good then we're going to be able to actually like generate a proof here. So we can write a test for this. If we do test main um let's say let cat which is me I'm a person

um my name is cat three and my age is 27 which happened yesterday. Um and then we can run main with cat and make sure this actually works. Oh, I need to specify this as a test. Cool. So if I run logo test in here in the right place. So I've just joined this club. We can do some other stuff too. So

something that's really cool is like passphrases. Um so the way that you would like prove that you know a passphrase is that there would be a public input that the verifier knows which is just the hash of that passphrase. you can't like reverse a hash so they won't actually be able to see what it is. And then you can prove you know the passphrase without revealing the passphrase by just um generating like the hash of the passphrase and then uh proving that. So let's do that. Let's say um so let's take in a member here and we're also going to take in a passphrase which are fields and we'll take in a public um thing as well which is the passphrase passphrase hash also a field. Um, oh no, that doesn't go over

there. That goes here. And then we're first off asserting that the memor is good. And then we're also going to just like generate the passphrase from this passphrase fast from the passphrase and ensure that that is the same to the one that they actually passed in. So we'll do let that the calculated house has pass calculated. Oh my god. Pass phrase hash. This is like a tongue twister. And then we can use the standard library to use use different like different types of hashing algorithms. So the one that's really good is Peterson. Um it's going to be the fastest just because of the way that the like written constraints work. Um Peterson uses the is the fastest one to do. So, we'll do

um library hash Peterson hash. This knows exactly what I'm trying to do. And then this takes in two parameters. It takes in Whoops. takes in an array with two parameters. So, we're going to do the passphrase and then zero. And then now we have our our new calculated passphrase has. We want to ensure that it's the same as the one that we're passing in as a public input. So we just do this assert thing again. This is equal to our passphrase hash. Um so let's say we're using this as a passphrase. This is just like a hexodimal representation of a string.

And um we can get this passphrase hash by using a test and then printing the outputs. So um I'm just going to write it in here and then we can like print it in our inner terminal. So we'll do let passphrase. Oh my god. No cursor. Um, it's this. And then we're just going to do what we did here. So we'll do the Peterson hash of the passphrase and then we're going to print it. So print line. You can print from test which is oh my goodness. Print line positive hash hash.

So then when I go into here and I run nargo test again, I can do give it a little show output and it should show me the calculated patch for test. No, it didn't. Oh, yeah. Right. Don't run that one. So this is the the hash of our passphrase here. So we know this is going to be our hash. So we're going to actually use that later. So I'm going to put it in here. And now we can actually test this properly by getting passphrase. We

have here. Yeah. passwords hash which we got here. And then we got to actually pass in both of these things. So yeah, this circuit is basically proving that I'm over 18 when I pass in who I am and it's proving that the passphrase that I know is the same one that is actually I should be using. So if we run the test again, they both pass. Yay. And we can do what we did earlier. We can do uh mag check. And then we get our thing here.

And it see like slightly different. So we got to put our passphrase password after test. This is public. Um and then who I am as a person which is private stuff. So we'll just paste in what we already did. My age, my son, and my name is And then we can witness this wrong which is not here and we can prove it again.

Um, where can I put the output of the perf? Awesome. So now I have my perf. There's no point in verifying this um because you've already seen how to do that. But yeah, this is kind of like some stuff that Nargo can do or that Noir can do. Um yeah, comparing and like it's cool that you can print stuff kind of like that. So you can do a lot of different testing and things like that. But yes, that's cool. So step three, this is uh some more stuff than Noir can do. Um kind of going into like unconstrained functions. So it's an interesting thing to think about when you're optimizing stuff. So basically like everything that you put into this function is going to be actually involved in a circuit and that can get quite expensive when you're

when you're writing a lot of code inside circuits. So this is just an example of a square root algorithm. It's classic Babylonian square root algorithm um which basically is just like kind of brute forcing trying lots of different things and eventually find something that is actually the square root of whatever you're trying to do. And if I do this in here, um this is going to be pretty expensive. So we can do go on to step three. Um just make sure this works. Yeah. Okay. So this is running the square root um of 12. I've actually forgotten how to do

that. Right. So yeah, if you type in ngo info, you can get like different information about kind of the size of your circuit. So we have 148 op codes being used here, which really isn't bad, but I think we can get that down. Um, and 17 really ones, but these are the important ones, these ACR op codes. these like it's not maybe super useful because if you're using different like proving system backends they will you will have like different various optimizations for how they work with AC up codes but it's still we're going to try to get this down so yeah type in nargo info and you can like get this table of information um and what we can do now is something that's cool about square root is that like you can just square it and you can prove that what it

is is correct so we can actually write an unconstrained function for the square root And then we can constrain the answer in our in our main um circuit. So we can do unconstrained function square root. Um we're it's the exact same as what we have here. So I can just copy this into here and do this in here instead. Okay. And this won't actually be constrained. So there's no proofs being generated here. This is quite unsafe. Um, yeah. So, like be careful when you're using unconstrained functions.

You don't want to unconstrain something and then have your whole thing under constraints and accidentally generate proofs when you don't want to. But it's an interesting thing to look at when you're optimizing stuff. So then instead of actually doing the square root in our main, we can just um let square root equals the square that the square root as we call this and then we just prove that the square multiply by the square is equal to the square root square root by the square root is equal to the number that we pass in and then you can

return. Um, so whenever you're like actually calling unconstrained functions, Noir is going to give you a warning and it won't let you do it unless you actually mark it as as unsafe. So you put in a comment above it and it starts with safety and then just say, "Okay, yeah, thanks Cer. Um, we're using an uncertain function. Be careful using in prod um you kind of want to give like a backup of why you're doing it there. And then you need to actually mark it as unsafe in the code so that people are aware. So we're going to wrap this in an unsafe block right there. And now we shouldn't have any warnings. Um and yeah, this test is going to work the exact same way. It's

just saying that we want to like square root 144. We're going to call main. Main's going to call this Angus function of square root and we're going to return square root which should be 12. So, oh yeah, by the way, um we also have four loops in Noir. So, you need to specify how many times you actually want the loop to run. You can't just have like a neverending like like, you know, until I or whatever. You just have to you can only do it like 10 times. So, we're only doing it 10 times here because you only really have to because we're just going to be using small numbers. Um obviously, you can do it like hundreds of times. And the cool thing about being in an unconstrained function is that you can actually break stuff. Like you can whenever this is solved, you can click break and it will

stop a loop. So it's it's a little bit faster. Um but it's not any more expensive or less expensive because it's within a non-constrained function. So it's not actually within the circuit. Uh let's run our test here. Cool. Um we can actually like print our square root as well so that we can see that it's working. So we should get uh 12 here. 12. Yay. That's our thing. And then if we also do this ngo info again. So before AC up ACR up codes were 148 and now seven. So that's like a huge improvement um for this and it's not having any ACR upos for the square root

program because it's not constrained. So, we did a lot of optimization there and it still works, which is pretty exciting. I got seven minutes. All right, next step. You know, we can prove all this, too, but you've seen how to do that. So, let's move on. Next up, we're going to be playing a little bit with Noir.js. Um, if you are a beginner, this is the first like um kind of thing that we recommend playing around with. If you go to Noir, let's go. If you go to Noir Lang and go to tutorials, we have like a noir.js app here. Um this is a way more simplified version of this tutorial. So I recommend like playing along with this first and then you can watch the tutorial. So we've got our um L index here. We've generated our circuit here.

It's the circuit that we've already seen many many times. We're asserting that X is not equal to Y. And um then we we've compiled the circuit in here and we've got the circuit in here. So we're going to be able to use that now in our circuit in our in our JS file. So the way you got to set it up is you just like start like a new noir um object and then we also have back end. We're going to be using altrahong for this one. We have other backends as well as we talked about. And then what it's going to do is it's going to you know you're going to say one and two for X and Y. We generate the witness, then we generate the proof, and then we're going

to write that proof to a file so we can actually see what the what the proof looks like. Um, I've just got some helper functions into here, uh, which basically just like turns this proof into something that's readable. So, you can have a look at that. Um, you have to specify it starts with ox as well because it doesn't just get that to you. And then we will verify the proof using this um, proof and the public inputs. So first off defining our public inputs. We'll just do cons input is uh x is one. X is not yield. Where did that come from? Y is two. I'm not going to use cursor for workshops. Um that's it. That's all our

inputs. Then we can generate a witness using those inputs. So we'll do con witness. We call noir, we execute it. Remember when we did an argu execute and we just pass in our inputs here input and then yeah we're already ready to generate the proof. So whoops we do cons. call our back end this time because you know we we execute with with more and then we prove with our back end which is our uh ultra hunkenberg pretty much um we do generate just literally generate a proof with our

witness and then we're going to write that proof to a file and then we can verify it as simple as it was proved. So we just do conified is um back end verify proof I'm passing a proof this proof already has the public inputs in it way nojs and also no works. So the verifier does have the public inputs but they don't need to pass it into anything because the proof already has it in it. And then we can just like console log whether or not our proof is verified here. So I think we should have a yeah

script. If I go into here and run this, it does not work. Oh, need to install. Okay. Yeah, we're using NRJS and BBJS. Make sure these are like the same. Um, the ones that actually go with each other because there's like loads of different versions of Benberg and different versions of Noir. So, if you're getting some errors here, it's likely that these are not the same. Um, so just ask in Discord and we can help you out with that. So, let's try again. Start. Still doesn't work.

Okay. H. Okay. So, the way I told you that you're probably getting errors because you're using the wrong versions. That's exactly what I'm doing. All right. This is the right versions here. I think I have Yeah. All right. I'm going to have to recompile the circuit. Let's do that. CD circuit CD main execute.

Okay. Make sure I'm using the right one. Okay. All right. So, yeah, we got this error. That's actually that's awesome. That's awesome that we got this cuz um if you see this differing serialization formats between ACVMJS and your compiler, it means probably you have some sort of different versioning going on. So I had already compiled this probably in a previous version of uh Nargo and it wasn't working. So I just recompiled it and now we have our proof verified which is cool. And we can also generate a solidity contract for this.

I'll just quickly show you how to do that. I think I'm running out of time. Um so let's go to where our nargojs is and we have to first so we generate the solidity contract with breenberg um because it's like a verifier so we need to use benber for it. So the first thing we got to do is actually get a verification key. Um so we'll display we did that before is we pass in the circuit and the output of where we want it to go and then we can do write BB write solidity verifier. Um, and we give it the verification

key target and then wherever we want it to go, which is our output. So, let's just put in a target as well. Uh, okay then. Cool. So, now when we head into All right, never mind. Let's call it contract.solve. Um, work.

Okay. All right. Here we have our solidity verifier right here. Uh you do not need to know what the heck this is saying. Um but the only important function here is verify. So you can search this. You can just call this from another smart contract. you pass in the proof, the public inputs, and then if this like uh goes through, that means your your proof is verified on chain. So yeah, I think that's everything I wanted to cover. Where's my Zoom? A whirlwind tour. Um, thank you so much, Cat. And, um, if if people are anything like me, there's two uh things that come out of this workshop. one uh confusion because this looks just like regular

programming. Uh and that's that's the idea, right? Like uh you shouldn't have to think about the cryptographic back end. You shouldn't have to think about constraints really unless you're doing some uh some really custom things. And um uh so that's that's one. Hopefully this looks very familiar to to you if you're uh if you're used to to software engineering. Um, and then the second thing is you will probably have a lot of questions, things that are not you're not quite sure um, for example, what unconstrained functions are for or how they're used or where they're dangerous or um, what exactly uh, some of the things that cat did do in the back end.

And you may want to to um, uh, help your understanding. There's already a bunch of questions like that in the Q&A that the team and I have tried to answer in parallel to to Cat's um workshop, but this is if you have a question like this, uh just post it in the Discord. This is a great uh this is what this this month is also for. Uh highlight things that are that need explanation and there's definitely going to be people people around that will be happy to jump in and and try to uh help you understand all all of this. Um, and um, yeah, the the last thing is it was Cat's birthday yesterday. Uh, so a very happy birthday, Cat. Um, I unfortunately you probably don't want to be in the 27 uh year club. Uh, if you look that up, I I

don't think that's a particularly nice club to be in, but uh, let's let's not have morbid thoughts. Um, and uh, uh, yeah, it was it was a very short amount of time uh, for for a workshop. So, I really appreciate you um uh taking us through all of that uh in in such a short amount of time. Um it's all going to be recorded. If you want to watch it on zero 0.5x speed, um you you'll be able to uh after this call. Cool. Thank you, Cat. I still can't get theations.

Got to configure that later. Uh but yeah, thanks guys. Uh this was a great uh first workshop. We have another one tomorrow. Um and yeah, for some of you guys asking questions in the discord already, um try to ask in the help uh channel if possible. Um and again, like if you don't have visibility into the channels, uh you need to go to the get rules uh channel first and then mark that you're a noirhack participant. Then you'll see all the Noirhack specific uh channels to ask questions and then uh try to put like questions and help Um and then uh try to put an introduction as well. Uh and yeah, tomorrow we'll have uh a bit more on the tracks and then also on team formation. Uh but

yeah, I think uh we can we can end it here and then I'll see you guys tomorrow for the the team formation and tracks chat. Thank you. Wait, can I say something? Can I say something? Um, feel free to tag Josh, me, Cel, or James in the Discord if you got a question so we can get a notification. Especially if it's anything about what I just talked about, just tag me at Cat. Um, that is a very generous offer from Cat, I will say do it responsibly, please. There are a lot of people in the in the Discord. Um, and uh, if if you happen to be really wellversed in in noir and you want to help people out and you see people uh having questions that you know how to answer, please also jump in. Um that

that that's greatly appreciated. Thanks. Yeah, if you know how to answer, please answer. Uh try to be as collaborative as possible and help others. Bye, guys.