Hello, everybody. Welcome to the last day at the Manara Village. If you are just wandering in here, you arrived just in time for a talk by the world-famous Cathy Heung, who is going to give us a deep dive into bulletproofs. Now, if you are a swimmer, you may be familiar with diving deep. Diving into mathematics is a lot... it's a lot different. And you come out just as exhausted, but it's a different form of exhaustion. So Cathy here is going to very gently, gently take us through bulletproofs. And I hope you all come out the other side smarter, because all of this is going to go over my head. Cathy, please... please be gentle. Oh, he's my lapel. Hi, I'm Cathy. For some context, I worked on an implementation of bulletproofs in Rust, both at Canon and Gstellar, and we have the fastest implementation in existence. And so I feel like maybe that makes me qualified to just tell you a little bit about how bulletproofs works. So maybe before I begin, there's a lot of stuff that I didn't cover. And what I cover is largely determined by what you guys want to hear. So what I submitted to this talk was, let's go really deep into the math of bulletproofs. We can do that, but we can also do less of that and talk more about the things we've built on top of bulletproofs, what other people can use it for, maybe proposals of what Monero might want to do. So maybe by a show of hands, how many people are here because they really want to just get into the math? Oh, okay, cool. Let's do that. And then if we have extra time afterwards, I'm happy to talk about other exceptions over that. Awesome. So the motivation of why we care about bulletproofs. First, I guess we should talk about why we care about zero-knowledge proofs. So for some of you, this might be redundant, but I'll just cover some basic ground first. So a zero-knowledge proof is a way to make a proof that's stating it's true about some input without revealing what that input is. So that might be a little confusing and abstract. One example of a zero-knowledge proof is a range proof. So a range proof is a proof that a certain number is in a range, usually like 0 to 2 to the n, and you can show that this proof is true without revealing what your number is. So instead of revealing your number, you're revealing it as your secret, you make a commitment to that number, and that commitment is binding, hiding, and you can show that commitment to someone without revealing your secret. So we'll talk a little bit more about range proofs, actually a lot more about range proofs, so don't be too intimidated yet. So probably a lot of things you're familiar with, but in a blockchain transaction, it's not confidential, this is what it looks like. And an important thing for validity of this transaction is that your inputs sum to the number that's equal to your outputs. So here you can visually check that 5 plus 4 equals 2 plus 6, you're not making any extra money out of thin air. And if you wanted to make this confidential, there's many ways to do this, but one proposed way is just called confidential transaction, proposed for Bitcoin, and a broken way to do this would be to use an additively homomorphic commitment, and just say, well now we're just going to do A, B, C, and D, which are the blinding and hiding for our secret values. And then you just check that A plus B equals C plus D, and this will be true with very high probability, if and only if your interior secret values actually sum up to the same value. Now, can anyone tell me why this is broken? Anyone? What's that? Yes? That is true, there's a very small chance that this can be incorrect, and this is because of the way that you have your commitment scheme, but that's like such small probabilities that that's actually not something that we're going to worry about. What about you? Exactly, yeah, so like this works with everything, but if you have a negative number, this also still works. And so this is still like technically correct, but definitely not correct in the context of a blockchain financial transaction. So we don't want this to be possible. And for those of you who want to like understand the math better, when I say a negative number, it's actually a negative number mod P, and so what this is basically equivalent to is an extremely large number in your prime order group, and so those two statements are equivalent. So you could be allowing someone to spend negative $1, or you could be allowing them to spend just like P-1, where P is very large. So that's just to be technically correct here. So what we want to do is to insert a range proof that all your secret values are in a certain range. So as long as your range proof is from zero to a number that's still smaller than your prime order group P, then this will make sure that you don't add any like negative weird numbers. So yeah, that's one example of how zero-knowledge proofs are useful in the blockchain context. Obviously, there's many other ways to use them, and there's also many ways to use zero-knowledge proofs outside of blockchains too, but you're probably interested in the blockchain applications. And what do we care about bullet proofs? So bullet proofs is a pretty cool paper. It came out in 2017 from Stanford. And it gives us a lot of properties that we really want in a blockchain context. So what we really want is a constrained proof size because all the nodes have to receive a proof and verify them. And bullet proofs provides a pretty constrained proof size O of log N, where N is the number of multipliers. It also gives us really fast verification. So that's important because, once again, you have to have all nodes sync up. And bullet proofs provides fast verification that also allows you to batch, which means that you can verify multiple proofs in parallel more efficiently, and aggregate, which means you can combine multiple proofs into one proof that they are all correct. And then lastly, this is a really nice property and sort of a big differentiator from ZK-Smart, for instance. You can have ad hoc logic that doesn't require trusted subtle. So if you wanted to create a custom smart contract, for instance, you don't have to have a trusted reference string that requires your setup string. So that is a big thing that is appealing about bullet proofs and a big pain point of using ZK-Smart. And I know a lot of more recent zero-knowledge proof protocols, such as Ksharks, which is great, H is for hybrid, actually gives you a hybrid mode between bullet proofs not requiring trusted setup and ZK-Smarts requiring trusted setup. So that's just like a fun side note. But basically, at the time, when we were looking to implement zero-knowledge proofs, bullet proofs was the thing that definitely made the most sense. So what we wanted to do was, well, first of all, understand the paper so we don't just blindly implement it, and then second, once we understood, then, you know, implement it using really best practices and existing libraries and Rust, and then make it a good performer. So you're all here to hopefully understand the paper, so let's dive right in. This is what it feels like to read the paper. We have some assumptions, for example, like we would like to prove that E is in range, and then it just gives us this massive multiscalar multiplication, and you're like, what is going on? Oh my gosh. So I would like to hopefully give you a path between step one and step two. And when we tried to figure that out, it took us actually like a month or two of just like whiteboarding out possible hypotheses of how we get from step one to step two and being like, no, that's wrong. No, that's still wrong. Okay, we actually like came up with something, and then we wrote up all of our notes online. So if you listen to this talk, you want more information, or maybe you see this talk and you're confused about some points, we actually have all of the notes for this online at docu-channel.alabic.rs. Also, I will post the slides online too, so don't worry about finding all the URLs. And then, oh, the last thing is that after we understood all of the math, Oleg came in with his graphic genius and made a cyberpunk visual of how all the math works. And so hopefully when you come back to the slide at the very end, you'll be like, oh, I understand all these transitions. That would be really great. Well, most of them. Cool, so the most fundamental building block of bulletproofs is this inner product algorithm. So this is actually not unique to bulletproofs. This was introduced by a previous paper out of UCL, and bulletproofs just made this three times more efficient. So, what is an inner product? An inner product, for instance, C is an inner product of A and B is the sum of entry-wise multiplications of vectors A and B. So for some syntax in this slide and in the bulletproof paper, bolded letters represent vectors. So here C is the inner product of vector A and vector B. So, naively, if you wanted to prove to me that C was equal to the inner product of A and B, and you had A and B, how could you do that? Just shout out some ideas, super naively. How would you do this in O of N space? Yeah, you could just send vector A, vector B and scalar C to B, and then I as the verifier could do the multiplication. So obviously this proof would be O of N space, because N is the length of A and B. The thing that boldproof introduces is a way to do this in O of N space. So what this looks like is first you start out with vectors A and B and your scalar C. Then you split A and B into two halves. Then you take this random scalar X, and right now you don't have to worry about where X comes from. All you have to know is that it's not zero, because if it's zero then you're screwed. And it's totally random. You cannot predict it ahead of time. So you take this random scalar X and you multiply it by the first half of A and you multiply the inverse by the second half of A sorry, the second half of A and then you get this A prime and then you do a split between with B prime and A prime and B prime are now half the length of A and B. And then you get this big mess for C prime But, actually watch this it's sort of magic. Because of the way that we selected the inverse and not inverse for A prime and B prime for X we can actually simplify this mess of C prime to be equal to the inner product of A low and B low plus the inner product of A high and B high plus like some garbage. And, wait for it... This, the inner product of A low and B low plus the inner product of A high and B high is, by definition of inner product proof the same thing as the inner product of A and B. So, do you see what's going on here? That line is actually the same thing as C above. Wow! Okay, can you raise your hand if you understood that. If you don't, I can repeat because I feel like this is a really critical part of understanding. Okay, cool. Sort of, sort of. Okay, so, yeah. Good, I'm getting to that. So, first we appreciate that the math works here so that you actually have C in your representation of C prime. And then you have this garbage. So, this garbage you have to just commit to it. So, let's call the thing underlined in green L and the thing underlined in red R. And then we send those two, so there are two points, we send those two points to the verifier. And you just say C prime is equal to the C from the previous round plus X squared times L plus X negative 2 times R. So, in summary, this is one round. And in one round, what we have achieved is that we have half the size of A, half the size of B, and committed to two points. That's a constant number of points. So, from, like, theory of computation, if you do a happy every step and every step you do a constant number of commitments, then you have a protocol that takes O of N, O of log N space. So I'm going to follow along so far. Okay, cool, so this is actually like the core nugget of what makes bullet proofs so efficient. Now you can, for very long vectors A and B, be able to make a proof that C is the inner product of A and B in O of log N space. Instead of before the only options are O of N space or something like on that order of code performance. Oh, and then at the very basic case, we have you know, A prime and B prime are just single scalars. And you send, you know, the single A prime to B prime and the prover, the verifier checks that that's equal to your basic case C prime. Cool, so yeah, that's sort of inner product. And then just sort of like, as a recap, if you are the prover, now you have received one L and one R point for every one of these steps. And then you also received the C prime. So you effectively like reverse this process and you build up what every higher C is using the L and R from that previous step until you get to the top level C. And if your top level C is equal to the C that you expect then you're like, wow, this all verifies for me. So that is our core building block here. Before we move on, any questions? Votes? Alright. So I did skip some things. So, one thing that I skipped is how we actually get the X. I told you don't worry about it because all you need to know is it's not zero, that it's random. In practice, we use the Fiat-Humier heuristic to get these challenge scales. What we actually do is we bind the X to all of the things in the previous round. So that you only get this random X once you've come into everything before. So you can't actually maliciously choose this X. So that's something that I didn't talk too much about. If you're curious about it, I can explain more. I also didn't talk about how operations are actually over commitments over the plain values. In all of these examples, I just used a plain A and B, but we actually are operating over additively homomorphic commitments in the exact same way that in our earlier example for our confidential transaction, we're actually operating over additively homomorphic commitments when we check that they add to the same else. And then the last one is just a performance thing. We use multi-exponentiation to have faster verification, but that's not fundamental to the math. It's just cool performance speedups. Alright, so we just covered the inner product building block, and now you might be wondering why do we even care? Why does it matter that C is the inner product of A and B? Whatever. And the reason that it's actually really cool or why we care about this form is because we can actually by applying math and cryptography to a statement we can represent effectively any statement as an inner product. If you don't believe me, I'll show you with this range proof, and then I can also show you with our generalized constraint system proof, which therefore reduces from any statement. But, let's look at the range proof first. So, here what we want to do is we want to start out with a statement of range. 0 is less than or equal to v, which is less than 2 to the n. We want to do some things to it tbd, until it's in the form of C equals inner product of A and B such that if C is equal to the inner product of A and B then with very high probability v is in range. Cool. Is everyone on board with this solution? Any questions so far? Alright, so now we're just looking at this in-between math and computer science. Alright, so the first thing that we want to observe is really interesting. So, if v is in range from 0 to 2 to the n, then v must be a binary number of like n. So, in this example, if v is 3, v is definitely in range between 0 to 2 to the n if n is 4. So, you must be able to represent v as a binary number of like 4. Cool. So, as a mental exercise you can try this with any value between 0 and 2 to the 4 and you'll see that yes, indeed, it does work. And if you try to represent something larger so 2 to the 4 plus 1 you'll see that you cannot actually fit everything in these boxes. Cool. So, by definition, binary numbers. So, I think this is pretty cool, first of all. Any questions so far? If you don't follow this, you'll be lost with the rest of this explanation, so I want to make sure it's on board. Don't be embarrassed. It took us at least a month to figure this out, so don't be embarrassed for covering it in like two minutes. Cool. So, we now have v of 3, this is our secret value, and we want to prove that it's between 0 and 2 to the 4. What we do is we call the binary representation of v, A sub L and this is what the paper uses, so I'm just trying to be consistent. And then we can say that v is the inner product of A sub L and 2 to the N. Remember, inner products can be of any two vectors that are the same length. So here we're actually representing v as an inner product. So, maybe some of you are thinking like, whoa, we've actually jumped from this v in range all the way to the inner product statement. Are we done? I wish. That would be really nice. No, we're not done. And the reason for this is because if this is your only statement, you can actually do something malicious with your A sub L. Does anyone have any guesses as to what you can do with this selection of A sub L that would be malicious, that would allow you to make a value that's outside of the range, but for whom this inner product argument is actually true? Yes, exactly. A sub L, nothing about the statement v equals the inner product of A sub L and 2 to the N requires that A sub L is actually just binary. So, if we have last digit or the first digit is 100, then v would be a huge number, but this inner product statement would still be true. So, what we want to do... Oops, I actually have slides to watch all of this. There we go. So, here's some examples of v. What we want to do is basically add another statement that A sub L has to be binary. And the way that we do this is we create an A sub R. A sub R is the bits of A sub L minus 1. So, if you have 0, 0, 1, 1, then A sub R is negative 1, negative 1, 0, 0. So, this has a really neat property where if you multiply every bit of A sub L with the corresponding bit of A sub R, then if A sub L is only bits, then you'll get a vector of zeros. If A sub L is anything else, for example 100, then you'll get 100 times 99 and that's not a zero. So, this is actually a statement that makes sure that A sub L is comprised of bits. So, now we have three statements. One being the vector is actually A sub L times inner product of 2 to the N. The second one being A sub L times A sub R equals zeros. And the third being the definition of A sub R. Cool. So, how's everyone doing? Does this make sense? Why do we use A sub R? Cool. And obviously you can combine steps 2 and 3 into just one statement without defining A sub R, but we tried to do that and then realized that that breaks the protocol because you have to separately make a commitment to A sub R. So, just trust me that you actually need to do all three of these things. Cool. So, now we have come up with these three statements. If they're true, then your original range statement is true. So, before moving on, I need to introduce another mathematical building block that allows you to combine statements. So, the same way that we got a challenge scalar last time, previously in the inner product group, here let's just pretend we have a challenge scalar. Let's not worry about how we get it, which is random and it's not zero. If A equals zero, if B equals zero, then you can actually combine these two statements together into one statement using this random challenge by saying A plus B equals zero. And as long as X is random, then with extremely high probability, this last statement will be true if and only if A equals zero and B equals zero. Does this make sense? Let's see. And if you want to be malicious, and also to check your understanding, can someone tell me what X has to be in order to maliciously make an X such that A plus BX equals zero even if A and B do not equal zero? Zero. Yeah, that's true, yes. And also you can set X as equal to A divided by B. And that will also give you maliciously a way to circumvent this double combination step. So we just have to check X is not equal to zero and sample X in such a large space that the probability that it's equal to A divided by B is so small that we don't even worry about it. And in practice, we sample X from 2 to the 255 minus 19, so we're fine. Don't worry about it. Cool. So, we can actually do this multiple times. Don't be scared. This is the same idea. We can do this multiple times, but instead of using X once, we can multiply the first one by nothing, the second one by well, here our conuscular is Y by Y, our third one by Y squared, so on and so forth, and everyone has a different exponent of Y. And the reason that we'll have to do this is because if Y is random, then taking Y to a certain exponent is also going to give you something that is random in that space. And so, the way that we write this combination is the inner product of A and B times the vector of Y to the N equals 0. So, it's a little bit weird syntax, but that's just how we write it. And so, since the prover can't predict Y, the latter statement, this inner product of A and B times Y to the N equals 0 is true with very high probability. Alright, so this is our building block. I'm just showing you how you can use random calendars to combine a bunch of statements together, and hopefully you'll also have a little inkling of like, hmm, this is interesting, because this last statement is actually an inner product statement. So, remember how this whole journey is us trying to start with a range statement and ending up with an inner product? This is actually a tool that we'll use to get to that inner product. So, the way that we'll use this tool is that the verifier gives us a random form of scalar Y. So, this comes from somewhere. In practice, it comes from the Pyatchenko heuristic. Then, we rewrite the second two statements, because the first statement is already in the inner product proof form, so we're already pretty well along there. But the second two statements, we use this Y to combine the statements together into inner product forms. So, once again, originally, the second statement, A sub L times A sub Y equals zero, a vector of zeros, is actually multiple statements. It's N statements, one statement for each index of A sub L and A sub R. And what we actually do is we're combining all of those statements by multiplying each of those statements by a different power of Y. And then, we're combining them in one inner product argument. So, this is just the format that we write it in once we combine it with Y. And then, we do the same for the second one. Cool. So, how are you feeling about that? We use this challenge scalar, do some crazy stuff, and three inner product arguments. Alright. And then, we do it again. Now, we take a random talent scalar, Z, and our argument, remember how I was saying if A equals zero and B equals zero, then, like, A plus B times a challenge scalar X equals zero. So, we're doing the exact same thing here. Here, we have B equals A sub L inner product of two to the N, which you can actually rewrite as zero equals A sub L inner product of two to the N minus B. And what you do is you just multiply that by Z squared, multiply the second thing by Z, multiply the third thing by C to the zero. And then, you end up with this statement. Cool. Now, you have one statement. Remember how our goal is to get one statement that is one inner product argument. So, we're really close. We have one statement that's three inner product arguments. And then, we do some math that I'm not going to bore you with that's basically just algebra. You just, like, take some things apart and rearrange them. And then, you end up with this inner product statement equals this thing on the right. So, if you're curious about what that math is, we wrote it up here. It's really not actually that interesting. But, look here on the right. This is exactly the format that we want. We want an inner product argument where the thing on the left, inner product of the thing on the right equals C. So, we can essentially represent we can think of the thing before the comma as A and the thing after the comma as B and the thing after the equals as C. So, to recap we have or, sorry, LOR I forget the letters I used. But, to recap, this is our journey. We started with a range statement. We broke it up into three separate statements that must all be true if this range is actually if the values are actually in range. And then we applied these, like, random challenge scalars such that we could rearrange all three of these into one inner product argument. And that is basically in the same format as what we wanted. T is the inner product of LOR. And going all the way back to the beginning, now that it's in this inner product argument, if and only if this inner product is true, then the B is in range. And we have a really efficient way in O of all N to prove that this inner product is true. Cool, so it comes full circle. Yeah, this is LOR of T of inner product. So, before I move on to how this is actually kind of oversimplifying it, I want to make sure that the simplification makes sense to everyone. Anyone have questions? Yes. Yes, for sure. So, so the first part is we took this Y and we took the Y to rewrite each of these. So now we have here on the right hand side, here on the left hand side, we now have three statements, and these three statements have to be true. But we want some way to somehow smush all of these three statements into one statement. So if we're not looking at all the annoying math, but we just have three statements that are like A equals 0, B equals 0, C equals 0, and you want to represent that as just one statement, what you can do is you can take a random number, Z in this case, and you can say if A plus B times Z plus C times Z squared equals 0, then with extremely high probability, we know that all our three individual statements, A equals 0, B equals 0, C equals 0, those are all true. So that's exactly what we're doing here. We're multiplying the first thing by Z squared, multiply the second thing by Z, multiply the third thing by Z to the 0, or nothing. And then that gives us the equation on the right. And then we just move the Z to the end, just because it's pretty random. Cool, does that answer your question? Okay, so I have one on my hand. Yeah? Ooh, oh man. I was hoping that, you know, this delta represents all of the messy casements that we don't actually want to write out. And I think if we go on to the next slide, the same way that in the previous slide I was like, these are things that I'm not diving into even deeper, that's one of the things is that delta just represents everything that is a public knowledge. So delta doesn't have anything that's secret in it. The proof and the verifier both know what's in delta. And that's why we can just abstract it into this delta nice thing. Because it doesn't contain anything too important or too secret. Cool, any other questions? Alright, so that's a good segue into the next section, which is that as you might notice, A sub L minus Z on the left-hand side of the product, if you were just to send it to the verifier, the verifier would just learn when your A sub L is, and then be like oh, I knew your secret, come on. So that's sort of silly. And so what we actually do in practice is we make a commitment to what's on the left and the right of the inner product. And then really nice, and then also, so like these are things that we actually want to make commitments to, and we will send over the commitments instead of sending over the plain secrets. What does that look like? Maybe first I should, you know, review what commitments are. So if you have an additively homomorphic commitment, like I mentioned way at the beginning of the talk, then if you have some secrets, A plus B equals C plus C, then your commitments will also maintain the additive property of those secrets. So then the commitment of A plus the commitment of B would be equal to the commitment of C plus the commitment of D. And then similarly, this also extends to multiplication by scaling. So if you have 2 times E equals F, then 2 times the commitment of E equals the commitment of F. So you don't have to worry about how this works, you can just sort of treat this as a black box. If you do want to learn about how this works, it's really just a Peterson commitment, and it's really straightforward, you're just multiplying by a group element and adding a blind factor times another group element that's orthogonal, it's not that crazy, I'm also happy to dive into that more. But if you want to treat this as a black box, then basically all you do is you start out with the thing on the left of the inner product, the thing on the right of the inner product, and the thing on the side, and you just make commitments to them. And if the inner product of those commitments is true, then with extremely high probability, then the secrets inside those commitments are also true. So that's really nice, because that's sort of the magic of an additively homomorphic scheme. And in practice, that's what we do. So, as a recap, let's see... Yeah, so, as a recap, this sort of takes us full circle, we can send over this inner product argument without fearing that we're revealing any secrets. So things that I omitted are how the column scalars are generated, how the commitments work in detail, once again there are some commitments, and I also skipped over how the values are blinded, that's part of how the commitments work. So if you want a deeper dive into that, I'm also happy to talk about that, but it's okay just treating it as a black box and being like, yes, that's how it works. So the end result of, you know, we understood the paper, we implemented it, and then sort of, oh, I forgot to include that it's less than one millisecond per 64-bit input verification, and that's even without patching. So if you were to patch, you can get multiple verifications in even less time. And so, yeah, that's our numbers, and I think that's all of the material that I've had for today. I'm also happy to talk about, you know, how we use this and other ways to abstract, you know, bullet groups over arbitrary statements instead of only over range groups. So maybe, um, let's start with some questions. Let's see if I have time. Let's start with some questions about the actual, like, math part of this talk, and then maybe after that I'll just take requests for other things that we want to hear about. Any questions about the math? Anything that you guys are happy to do for me? Yes. Yes. Great question. So the reason that we do this, um, well, we, meaning really, like, Benedict who wrote the paper, um, the reason that he does this is because then you have some really cool property where, um, here, you actually get the x of the b-low to, uh, sorry, the x that is, uh, x inverse attached with b-low to cancel out the x in a-low. So, here, let me just, like, review how this works. So, if you have the inner product of this with this, what you're actually doing is you're taking this and multiplying it by this, and that gives you a-low times b-low, or any a-low product with b-low. And then here, the x inverse here cancels out with x here, and that gives you a-high inner product with b-high. And so that's just a nice sort of magic. Um, and if you didn't have that, like, canceling out the property, the axiom wouldn't be able to reconstruct c from, um, c prime. So, good question. Um, that is really cool. Cool. Any other, um, questions about math? Yes, hi. Oh, yes, um, ladies at this, so you're also kind of blonde, but it's, um, sorry, I also have these slides online if you want to just, like, review the slides. It's darkintangle.org.rs slash bulletproofs. If you just go to that, you can navigate all the notes. Um, the distinction between I'm so sorry, I should make the URL bigger. Um, the distinction between doc internal and doc, like, external, is that the doc.doc.rs actually gives you the API and all the documentation for the API for how to use this, whereas doc internal gives you an internal look of the math, and this is a really nice thing that we have because we made everything in Rust. We have, like, Rust documentation for many. Um, yeah. Awesome. Okay, uh, any other questions about the math? And if not, uh, I can take requests for things that you would like to hear about that are sort of above and beyond this. I can choices of, like, what I can talk about. I have uh, we worked a lot on constraint systems, which is basically how to build an arbitrary statement and then make proof about it. Uh, I can talk about Cloak, which is how we build a confidential assets protocol using all of this. I can talk about CKBM, which is like a smart contract language that we built on top of all this. Anyone super excited about any of these things? Yes. Oh, definitely. Um, yeah, relatively cool. Um, I don't might have slides for it, but basically um, the idea is when you have a paper that says like, the prover gives something to the verifier. The verifier, like, does this random challenge sampling and then gives a challenge back. Um, in the paper, usually they say, like, this is an interactive coin protocol. We naively, like, obviously just use the fiat from your peers to make this non-interactive. And then as an implementer, you're like, what? Like, how? And so Mervin has basically a strobe-based transcript protocol that Henry made. Henry was one of my colleagues who helped with the Bulletproofs implementation. We were working on, like, how do we make this non-interactive? And he was like, this would be a really good use case for a library that takes care of all of that for you. In practice, for papers, when you implement the fiat from your peers thing, a lot of times people just hash the things that the prover gives to the verifier. You're like, we just hash this, and then we take the challenge from it, and then we use the challenge. So just, sorry, here's an example. If you wanted to take a challenge, like, here, for instance, x, like, where does this x come from? And a lot of times, a lot of the time people just, like, take, for example, the vector a and hash it into the vector b and hash it into the vector y somehow, and get the challenge x. But this is sort of easy to misuse, or easy to get a little bit wrong, and also really complicated if you're doing multiple rounds of this. And so that's why Henry made Merlin, which is effectively a black box, where you're like, I put my randomness in here. I don't have to worry about the clouds behind the scenes, and I get some randomness back that I have guarantees about that it's actually fully random, that it's domain separated, you don't have, like, hash collisions, things like that. So that's actually, and so that's where we get x from. We actually use the Merlin transcripts to get x, to get the y, to get the z for all of these random challenge scalars. Yeah. Anything else? Anyone want to hear about any other things? I could also be done. Way more. Okay. I think the coolest thing that we built on top of this is the cloak protocol. So let me just pull up my slides for that. Sorry. All right. So I guess maybe to back up, so Bulletproof is not just a range-proof protocol, it's a, they call it in the paper, they call it circuit-proof protocol as well, where you can take any arbitrary arithmetic circuit and then make a proof that it is correct over some inputs while keeping those inputs secret. It turns out that coding up arithmetic circuits is like a huge pain, and so we actually just changed the representation to a constraint system. They're really easily translatable from one to the next, but constraints are a little bit easier to talk about. So you have a multiplicative constraint, which is you have three variables, and you have the additional constraint that x times y equals z for each of those secret variables. And you also have a linear constraint, which is like some linear combination of secret variables with clear text weights. So these are like the tools that you have with which to build up this constraint system. And with a constraint system, you can actually represent anything that is efficiently verifiable. So by this, I mean any NP-complete program can be, you know, changed into or represented as a constraint system. So that's pretty nice. Fun side note is that the extension that my colleague, Oleg, made over this constraint system protocol actually broadens the things that you can represent from NP-complete to PSPACE. So like if you're a theory nerd, that's like free fun. But if you're not, it doesn't matter. So you can represent basically any program you want as a constraint system. So what we wanted to do was to make a confidential assets protocol. And confidential assets is a lot harder to make than a confidential transaction protocol because you want to keep the asset types secret. And so like, my idea is you're just like, I want to add together all the sums of all the different asset types. Then you have to specify which assets are the same, and that would reveal which assets are which over enough analysis. So you can't just sort of sum together things the same way that you do for confidential transactions with one asset type. So what we came up with was sort of multiple gadgets that we composed together. So on the right hand side we have a range gadget, that's what we call it, which is a collection of constraints that basically make sure that the variables in the constraint system are in range. And then we add some new ones. So a shuffle gadget is basically a collection of constraints that make sure that the inputs and the outputs are validly ordering over each other. So you can't just introduce a new input and introduce a new output. Then the shuffle gadget would fail. And then there's a merge gadget, which either merges two inputs into one, or just moves them without altering. Same with split. Split either splits one item into two, or it moves the two inputs into the two outputs without altering it at all. So, I guess before I jump into how this is all assembled, intuitively, if you're dealing with multiple assets and you want to have some way to prove that your input to this protocol and your output to this protocol are valid, you want to prove that your inputs have been rearranged in such a way that the asset types are preserved but without creating or destroying value. So this is really tricky because you can't actually reveal what asset groupings you have. So this is like a fine, it took us a while to come up with this solution. But what it does is basically we group these gadgets together such that any output reordering is a valid actual transaction output reordering that of the inputs should be able to satisfy this collection of gadgets. Let me walk you through why this is the case, or how you actually prove this. So suppose that your inputs are $5, 3 yen and $4. What you as a prover would do, since you have a lot of secrets, you would look at this and be like, okay, well I know that I have to group all of my assets of the same kind together into the same chunks. So you would use the shuffle to reorder this such that your dollar amounts are together and your yen is at the very end. Then you will merge your dollar amounts into one lump sum and you'll merge again. Well, you will, because you only have one. And then you shuffle it such that your non-zero values are at the very top of the shuffle for each asset type. And then, this is the part that's like, hopefully the intuition, is that you're going to split your lump sum into whatever your target amounts are. So here I offer target amounts of 3 yen, 6 dollars and 3 dollars, so you'll take your 9 dollars and split it into 6 dollars and 3 dollars. And then you'll be able to go down the coast. It's just one output. And then, just to preserve the randomness of your output, you'll shuffle it one more time. You'll apply a range check to it to make sure that none of these are negative. And then you get your outputs. And so, if your outputs are valid, then you should be able to do this successfully. If your outputs are not valid, suppose that one of your outputs you wanted to make it 100 dollars, you would not actually be able to correctly satisfy all these guys. One of these guys would be like, wait, where did this extra money come from? Like, this is not a valid constraint of satisfaction. So this is the intuition for how it works. And then for a verifier, the verifier actually only receives these commitments to the input and commitments to the outputs. And it can't tell what happened within each of the gadgets because all of it are just like commitments to the verifier. But all it can do is verify that, yes indeed, this proof succeeded or this proof failed. And then, you know, valid and invalid transaction. So that's the intuition for Cloak. And I think the important thing to illustrate here is that this is just one of many uses for the Bulletproof Constraint System API that you can come up with. We just sort of made this by hand after figuring out what would make sense as a way to build it. And anyone else can basically make their own protocols and proofs as well. So that's cool. That's my little I think I'm out of time. Do I have time for questions maybe? Or should I just... Alright, any questions about the last bit? Yes. Yeah, so here at the very end we have a range check. And so basically the output of the third shuffle right here is 3 yen, 6 dollars and 3 dollars, right? And we just want to add a range check that all of those values are between 0 and 2 to the n for some large amount. For example, if we wanted to maliciously make a $100 output, then we would basically end up with shuffle 3 and we'd want to somehow make $100 as one of the outputs and then negative... math is hard... negative 92, something... another negative number. But then that would fail the range check. So basically the range check makes sure that we can't make extra money. Sorry. You can ask more questions afterwards. I'm going to cut off. Thank you for all of your attention.