1 00:00:00,000 --> 00:00:01,080 Hello, everybody. 2 00:00:01,080 --> 00:00:03,440 Welcome to the last day at the Manara Village. 3 00:00:03,440 --> 00:00:17,220 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. 4 00:00:17,220 --> 00:00:21,180 Now, if you are a swimmer, you may be familiar with diving deep. 5 00:00:21,400 --> 00:00:25,180 Diving into mathematics is a lot... it's a lot different. 6 00:00:25,180 --> 00:00:29,280 And you come out just as exhausted, but it's a different form of exhaustion. 7 00:00:29,280 --> 00:00:34,540 So Cathy here is going to very gently, gently take us through bulletproofs. 8 00:00:34,880 --> 00:00:40,200 And I hope you all come out the other side smarter, because all of this is going to go over my head. 9 00:00:40,200 --> 00:00:43,580 Cathy, please... please be gentle. 10 00:00:44,440 --> 00:00:46,280 Oh, he's my lapel. 11 00:00:48,080 --> 00:00:50,500 Hi, I'm Cathy. 12 00:00:50,800 --> 00:01:02,080 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. 13 00:01:02,080 --> 00:01:07,220 And so I feel like maybe that makes me qualified to just tell you a little bit about how bulletproofs works. 14 00:01:07,320 --> 00:01:11,220 So maybe before I begin, there's a lot of stuff that I didn't cover. 15 00:01:11,480 --> 00:01:16,320 And what I cover is largely determined by what you guys want to hear. 16 00:01:16,340 --> 00:01:21,800 So what I submitted to this talk was, let's go really deep into the math of bulletproofs. 17 00:01:21,800 --> 00:01:32,960 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. 18 00:01:33,100 --> 00:01:39,140 So maybe by a show of hands, how many people are here because they really want to just get into the math? 19 00:01:39,560 --> 00:01:40,660 Oh, okay, cool. 20 00:01:40,660 --> 00:01:41,400 Let's do that. 21 00:01:41,400 --> 00:01:46,760 And then if we have extra time afterwards, I'm happy to talk about other exceptions over that. 22 00:01:47,160 --> 00:01:47,840 Awesome. 23 00:01:49,480 --> 00:01:53,640 So the motivation of why we care about bulletproofs. 24 00:01:53,640 --> 00:01:56,420 First, I guess we should talk about why we care about zero-knowledge proofs. 25 00:01:56,420 --> 00:02:02,460 So for some of you, this might be redundant, but I'll just cover some basic ground first. 26 00:02:02,580 --> 00:02:12,160 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. 27 00:02:12,160 --> 00:02:14,640 So that might be a little confusing and abstract. 28 00:02:14,640 --> 00:02:17,400 One example of a zero-knowledge proof is a range proof. 29 00:02:17,400 --> 00:02:28,900 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. 30 00:02:28,900 --> 00:02:39,200 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. 31 00:02:39,420 --> 00:02:45,640 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. 32 00:02:45,640 --> 00:02:53,640 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. 33 00:02:53,640 --> 00:02:59,660 And an important thing for validity of this transaction is that your inputs sum to the number that's equal to your outputs. 34 00:02:59,660 --> 00:03:06,400 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. 35 00:03:06,860 --> 00:03:24,720 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, 36 00:03:24,720 --> 00:03:31,220 well now we're just going to do A, B, C, and D, which are the blinding and hiding for our secret values. 37 00:03:31,220 --> 00:03:41,800 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. 38 00:03:42,720 --> 00:03:45,080 Now, can anyone tell me why this is broken? 39 00:03:46,760 --> 00:03:47,640 Anyone? 40 00:03:49,280 --> 00:03:50,300 What's that? 41 00:03:51,240 --> 00:03:51,980 Yes? 42 00:03:53,980 --> 00:04:05,520 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. 43 00:04:05,520 --> 00:04:06,340 What about you? 44 00:04:09,870 --> 00:04:16,830 Exactly, yeah, so like this works with everything, but if you have a negative number, this also still works. 45 00:04:16,850 --> 00:04:23,710 And so this is still like technically correct, but definitely not correct in the context of a blockchain financial transaction. 46 00:04:23,710 --> 00:04:26,450 So we don't want this to be possible. 47 00:04:27,550 --> 00:04:44,910 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. 48 00:04:44,910 --> 00:04:51,770 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. 49 00:04:52,090 --> 00:04:55,130 So that's just to be technically correct here. 50 00:04:55,370 --> 00:05:02,970 So what we want to do is to insert a range proof that all your secret values are in a certain range. 51 00:05:02,970 --> 00:05:15,290 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. 52 00:05:15,810 --> 00:05:21,150 So yeah, that's one example of how zero-knowledge proofs are useful in the blockchain context. 53 00:05:21,150 --> 00:05:29,810 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. 54 00:05:29,930 --> 00:05:31,530 And what do we care about bullet proofs? 55 00:05:31,530 --> 00:05:33,890 So bullet proofs is a pretty cool paper. 56 00:05:33,890 --> 00:05:36,030 It came out in 2017 from Stanford. 57 00:05:36,110 --> 00:05:40,750 And it gives us a lot of properties that we really want in a blockchain context. 58 00:05:41,230 --> 00:05:48,810 So what we really want is a constrained proof size because all the nodes have to receive a proof and verify them. 59 00:05:48,810 --> 00:05:54,410 And bullet proofs provides a pretty constrained proof size O of log N, where N is the number of multipliers. 60 00:05:55,150 --> 00:05:57,270 It also gives us really fast verification. 61 00:05:57,270 --> 00:06:02,530 So that's important because, once again, you have to have all nodes sync up. 62 00:06:02,570 --> 00:06:17,170 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. 63 00:06:17,410 --> 00:06:23,310 And then lastly, this is a really nice property and sort of a big differentiator from ZK-Smart, for instance. 64 00:06:23,310 --> 00:06:26,550 You can have ad hoc logic that doesn't require trusted subtle. 65 00:06:26,550 --> 00:06:33,750 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. 66 00:06:33,950 --> 00:06:41,610 So that is a big thing that is appealing about bullet proofs and a big pain point of using ZK-Smart. 67 00:06:41,610 --> 00:06:56,230 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. 68 00:06:56,230 --> 00:06:58,970 So that's just like a fun side note. 69 00:06:59,470 --> 00:07:05,990 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. 70 00:07:06,110 --> 00:07:20,290 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. 71 00:07:21,230 --> 00:07:25,270 So you're all here to hopefully understand the paper, so let's dive right in. 72 00:07:25,270 --> 00:07:27,510 This is what it feels like to read the paper. 73 00:07:27,630 --> 00:07:37,670 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? 74 00:07:37,670 --> 00:07:38,550 Oh my gosh. 75 00:07:38,590 --> 00:07:43,590 So I would like to hopefully give you a path between step one and step two. 76 00:07:43,930 --> 00:07:55,190 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. 77 00:07:55,850 --> 00:07:57,290 No, that's still wrong. 78 00:07:57,370 --> 00:08:01,430 Okay, we actually like came up with something, and then we wrote up all of our notes online. 79 00:08:01,450 --> 00:08:12,030 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. 80 00:08:13,210 --> 00:08:17,770 Also, I will post the slides online too, so don't worry about finding all the URLs. 81 00:08:18,870 --> 00:08:28,530 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. 82 00:08:28,650 --> 00:08:33,290 And so hopefully when you come back to the slide at the very end, you'll be like, oh, I understand all these transitions. 83 00:08:33,710 --> 00:08:34,490 That would be really great. 84 00:08:34,490 --> 00:08:35,670 Well, most of them. 85 00:08:36,130 --> 00:08:41,590 Cool, so the most fundamental building block of bulletproofs is this inner product algorithm. 86 00:08:41,810 --> 00:08:43,950 So this is actually not unique to bulletproofs. 87 00:08:43,950 --> 00:08:49,890 This was introduced by a previous paper out of UCL, and bulletproofs just made this three times more efficient. 88 00:08:50,470 --> 00:08:52,710 So, what is an inner product? 89 00:08:52,810 --> 00:09:02,290 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. 90 00:09:02,370 --> 00:09:11,550 So for some syntax in this slide and in the bulletproof paper, bolded letters represent vectors. 91 00:09:11,550 --> 00:09:14,990 So here C is the inner product of vector A and vector B. 92 00:09:15,470 --> 00:09:23,890 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? 93 00:09:23,970 --> 00:09:27,250 Just shout out some ideas, super naively. 94 00:09:30,210 --> 00:09:33,350 How would you do this in O of N space? 95 00:09:34,890 --> 00:09:42,510 Yeah, you could just send vector A, vector B and scalar C to B, and then I as the verifier could do the multiplication. 96 00:09:42,830 --> 00:09:49,250 So obviously this proof would be O of N space, because N is the length of A and B. 97 00:09:49,710 --> 00:09:54,330 The thing that boldproof introduces is a way to do this in O of N space. 98 00:09:56,370 --> 00:10:01,410 So what this looks like is first you start out with vectors A and B and your scalar C. 99 00:10:01,470 --> 00:10:04,290 Then you split A and B into two halves. 100 00:10:04,810 --> 00:10:11,230 Then you take this random scalar X, and right now you don't have to worry about where X comes from. 101 00:10:11,230 --> 00:10:14,990 All you have to know is that it's not zero, because if it's zero then you're screwed. 102 00:10:14,990 --> 00:10:16,690 And it's totally random. 103 00:10:16,690 --> 00:10:18,650 You cannot predict it ahead of time. 104 00:10:18,650 --> 00:10:38,190 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. 105 00:10:38,610 --> 00:10:46,490 And then you get this big mess for C prime But, actually watch this it's sort of magic. 106 00:10:46,530 --> 00:11:01,010 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. 107 00:11:01,770 --> 00:11:03,710 And, wait for it... 108 00:11:03,710 --> 00:11:12,830 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. 109 00:11:12,950 --> 00:11:15,150 So, do you see what's going on here? 110 00:11:15,150 --> 00:11:18,170 That line is actually the same thing as C above. 111 00:11:18,670 --> 00:11:19,430 Wow! 112 00:11:20,610 --> 00:11:24,190 Okay, can you raise your hand if you understood that. 113 00:11:24,190 --> 00:11:28,230 If you don't, I can repeat because I feel like this is a really critical part of understanding. 114 00:11:28,550 --> 00:11:29,530 Okay, cool. 115 00:11:30,210 --> 00:11:31,390 Sort of, sort of. 116 00:11:31,390 --> 00:11:33,590 Okay, so, yeah. 117 00:11:39,120 --> 00:11:40,620 Good, I'm getting to that. 118 00:11:40,620 --> 00:11:47,060 So, first we appreciate that the math works here so that you actually have C in your representation of C prime. 119 00:11:47,060 --> 00:11:48,520 And then you have this garbage. 120 00:11:48,700 --> 00:11:51,500 So, this garbage you have to just commit to it. 121 00:11:51,500 --> 00:11:57,020 So, let's call the thing underlined in green L and the thing underlined in red R. 122 00:11:57,120 --> 00:12:03,760 And then we send those two, so there are two points, we send those two points to the verifier. 123 00:12:03,940 --> 00:12:12,840 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. 124 00:12:14,440 --> 00:12:17,720 So, in summary, this is one round. 125 00:12:17,720 --> 00:12:24,380 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. 126 00:12:24,380 --> 00:12:26,060 That's a constant number of points. 127 00:12:26,060 --> 00:12:41,260 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. 128 00:12:41,600 --> 00:12:43,420 So I'm going to follow along so far. 129 00:12:44,460 --> 00:12:49,620 Okay, cool, so this is actually like the core nugget of what makes bullet proofs so efficient. 130 00:12:49,620 --> 00:12:59,700 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. 131 00:12:59,700 --> 00:13:05,760 Instead of before the only options are O of N space or something like on that order of code performance. 132 00:13:07,140 --> 00:13:14,900 Oh, and then at the very basic case, we have you know, A prime and B prime are just single scalars. 133 00:13:14,900 --> 00:13:22,020 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. 134 00:13:22,360 --> 00:13:26,000 Cool, so yeah, that's sort of inner product. 135 00:13:26,220 --> 00:13:35,480 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. 136 00:13:35,480 --> 00:13:38,040 And then you also received the C prime. 137 00:13:38,040 --> 00:13:48,520 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. 138 00:13:48,520 --> 00:13:54,180 And if your top level C is equal to the C that you expect then you're like, wow, this all verifies for me. 139 00:13:54,340 --> 00:13:57,920 So that is our core building block here. 140 00:13:58,140 --> 00:14:00,100 Before we move on, any questions? 141 00:14:00,100 --> 00:14:00,880 Votes? 142 00:14:07,200 --> 00:14:08,160 Alright. 143 00:14:09,880 --> 00:14:12,340 So I did skip some things. 144 00:14:12,360 --> 00:14:15,580 So, one thing that I skipped is how we actually get the X. 145 00:14:15,580 --> 00:14:20,500 I told you don't worry about it because all you need to know is it's not zero, that it's random. 146 00:14:20,600 --> 00:14:25,440 In practice, we use the Fiat-Humier heuristic to get these challenge scales. 147 00:14:25,500 --> 00:14:29,980 What we actually do is we bind the X to all of the things in the previous round. 148 00:14:29,980 --> 00:14:33,680 So that you only get this random X once you've come into everything before. 149 00:14:33,680 --> 00:14:35,880 So you can't actually maliciously choose this X. 150 00:14:35,880 --> 00:14:38,060 So that's something that I didn't talk too much about. 151 00:14:38,120 --> 00:14:40,360 If you're curious about it, I can explain more. 152 00:14:40,600 --> 00:14:45,360 I also didn't talk about how operations are actually over commitments over the plain values. 153 00:14:45,680 --> 00:15:02,080 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. 154 00:15:02,940 --> 00:15:05,200 And then the last one is just a performance thing. 155 00:15:05,360 --> 00:15:12,080 We use multi-exponentiation to have faster verification, but that's not fundamental to the math. 156 00:15:12,080 --> 00:15:14,360 It's just cool performance speedups. 157 00:15:15,100 --> 00:15:21,500 Alright, so we just covered the inner product building block, and now you might be wondering why do we even care? 158 00:15:21,500 --> 00:15:25,320 Why does it matter that C is the inner product of A and B? 159 00:15:25,560 --> 00:15:26,300 Whatever. 160 00:15:26,540 --> 00:15:40,740 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. 161 00:15:41,080 --> 00:15:52,840 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. 162 00:15:54,120 --> 00:15:56,840 But, let's look at the range proof first. 163 00:15:56,840 --> 00:16:01,180 So, here what we want to do is we want to start out with a statement of range. 164 00:16:01,180 --> 00:16:04,320 0 is less than or equal to v, which is less than 2 to the n. 165 00:16:04,320 --> 00:16:20,460 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. 166 00:16:21,180 --> 00:16:21,840 Cool. 167 00:16:21,840 --> 00:16:23,640 Is everyone on board with this solution? 168 00:16:23,760 --> 00:16:25,160 Any questions so far? 169 00:16:25,520 --> 00:16:29,460 Alright, so now we're just looking at this in-between math and computer science. 170 00:16:30,220 --> 00:16:34,680 Alright, so the first thing that we want to observe is really interesting. 171 00:16:34,680 --> 00:16:42,840 So , if v is in range from 0 to 2 to the n, then v must be a binary number of like n. 172 00:16:42,920 --> 00:16:50,420 So, in this example, if v is 3, v is definitely in range between 0 to 2 to the n if n is 4. 173 00:16:50,420 --> 00:16:55,140 So, you must be able to represent v as a binary number of like 4. 174 00:16:55,500 --> 00:16:56,280 Cool. 175 00:16:56,280 --> 00:17:06,820 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. 176 00:17:06,820 --> 00:17:13,420 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. 177 00:17:13,700 --> 00:17:14,060 Cool. 178 00:17:14,060 --> 00:17:16,460 So, by definition, binary numbers. 179 00:17:17,920 --> 00:17:20,300 So, I think this is pretty cool, first of all. 180 00:17:20,660 --> 00:17:22,120 Any questions so far? 181 00:17:23,400 --> 00:17:28,980 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. 182 00:17:30,040 --> 00:17:30,900 Don't be embarrassed. 183 00:17:31,240 --> 00:17:36,580 It took us at least a month to figure this out, so don't be embarrassed for covering it in like two minutes. 184 00:17:37,440 --> 00:17:38,300 Cool. 185 00:17:38,300 --> 00:17:46,540 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. 186 00:17:46,900 --> 00:17:55,700 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. 187 00:17:55,860 --> 00:18:00,620 And then we can say that v is the inner product of A sub L and 2 to the N. 188 00:18:00,620 --> 00:18:04,000 Remember, inner products can be of any two vectors that are the same length. 189 00:18:04,000 --> 00:18:08,400 So here we're actually representing v as an inner product. 190 00:18:09,180 --> 00:18:16,580 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. 191 00:18:16,580 --> 00:18:17,380 Are we done? 192 00:18:17,560 --> 00:18:18,400 I wish. 193 00:18:18,400 --> 00:18:19,480 That would be really nice. 194 00:18:20,160 --> 00:18:21,600 No, we're not done. 195 00:18:21,720 --> 00:18:27,600 And the reason for this is because if this is your only statement, you can actually do something malicious with your A sub L. 196 00:18:27,700 --> 00:18:40,280 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? 197 00:18:41,840 --> 00:18:42,900 Yes, exactly. 198 00:18:42,900 --> 00:18:50,280 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. 199 00:18:50,700 --> 00:18:58,720 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. 200 00:18:59,280 --> 00:19:01,280 So, what we want to do... 201 00:19:01,280 --> 00:19:03,580 Oops, I actually have slides to watch all of this. 202 00:19:03,580 --> 00:19:03,980 There we go. 203 00:19:03,980 --> 00:19:08,540 So, here's some examples of v. 204 00:19:08,680 --> 00:19:13,880 What we want to do is basically add another statement that A sub L has to be binary. 205 00:19:14,000 --> 00:19:16,720 And the way that we do this is we create an A sub R. 206 00:19:16,840 --> 00:19:19,700 A sub R is the bits of A sub L minus 1. 207 00:19:19,700 --> 00:19:24,100 So, if you have 0, 0, 1, 1, then A sub R is negative 1, negative 1, 0, 0. 208 00:19:24,380 --> 00:19:36,340 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. 209 00:19:36,880 --> 00:19:42,680 If A sub L is anything else, for example 100, then you'll get 100 times 99 and that's not a zero. 210 00:19:43,060 --> 00:19:49,780 So, this is actually a statement that makes sure that A sub L is comprised of bits. 211 00:19:50,000 --> 00:19:51,140 So, now we have three statements. 212 00:19:51,140 --> 00:19:55,160 One being the vector is actually A sub L times inner product of 2 to the N. 213 00:19:55,160 --> 00:19:58,940 The second one being A sub L times A sub R equals zeros. 214 00:19:59,200 --> 00:20:01,400 And the third being the definition of A sub R. 215 00:20:02,320 --> 00:20:03,040 Cool. 216 00:20:03,040 --> 00:20:04,460 So, how's everyone doing? 217 00:20:04,460 --> 00:20:05,300 Does this make sense? 218 00:20:05,300 --> 00:20:06,800 Why do we use A sub R? 219 00:20:07,140 --> 00:20:07,480 Cool. 220 00:20:07,480 --> 00:20:19,540 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. 221 00:20:19,540 --> 00:20:23,200 So, just trust me that you actually need to do all three of these things. 222 00:20:23,880 --> 00:20:24,220 Cool. 223 00:20:24,220 --> 00:20:27,260 So, now we have come up with these three statements. 224 00:20:27,260 --> 00:20:31,320 If they're true, then your original range statement is true. 225 00:20:32,660 --> 00:20:40,940 So, before moving on, I need to introduce another mathematical building block that allows you to combine statements. 226 00:20:41,180 --> 00:20:48,920 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. 227 00:20:48,920 --> 00:20:52,620 Let's not worry about how we get it, which is random and it's not zero. 228 00:20:52,940 --> 00:21:03,780 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. 229 00:21:03,780 --> 00:21:11,820 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. 230 00:21:11,960 --> 00:21:13,080 Does this make sense? 231 00:21:13,080 --> 00:21:13,860 Let's see. 232 00:21:14,580 --> 00:21:27,960 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? 233 00:21:29,320 --> 00:21:30,140 Zero. 234 00:21:30,960 --> 00:21:32,620 Yeah, that's true, yes. 235 00:21:32,620 --> 00:21:37,020 And also you can set X as equal to A divided by B. 236 00:21:37,120 --> 00:21:44,860 And that will also give you maliciously a way to circumvent this double combination step. 237 00:21:44,860 --> 00:21:54,680 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. 238 00:21:55,000 --> 00:22:00,300 And in practice, we sample X from 2 to the 255 minus 19, so we're fine. 239 00:22:00,300 --> 00:22:01,440 Don't worry about it. 240 00:22:02,100 --> 00:22:02,980 Cool. 241 00:22:03,700 --> 00:22:06,560 So, we can actually do this multiple times. 242 00:22:06,560 --> 00:22:07,120 Don't be scared. 243 00:22:07,120 --> 00:22:08,320 This is the same idea. 244 00:22:08,320 --> 00:22:23,120 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. 245 00:22:23,260 --> 00:22:31,760 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. 246 00:22:31,760 --> 00:22:42,840 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. 247 00:22:42,840 --> 00:22:47,380 So, it's a little bit weird syntax, but that's just how we write it. 248 00:22:47,700 --> 00:22:56,820 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. 249 00:22:57,200 --> 00:22:58,820 Alright, so this is our building block. 250 00:22:58,820 --> 00:23:10,960 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. 251 00:23:11,400 --> 00:23:19,840 So, remember how this whole journey is us trying to start with a range statement and ending up with an inner product? 252 00:23:19,860 --> 00:23:23,400 This is actually a tool that we'll use to get to that inner product. 253 00:23:24,920 --> 00:23:31,340 So , the way that we'll use this tool is that the verifier gives us a random form of scalar Y. 254 00:23:31,340 --> 00:23:33,360 So, this comes from somewhere. 255 00:23:33,360 --> 00:23:35,580 In practice, it comes from the Pyatchenko heuristic. 256 00:23:35,800 --> 00:23:45,020 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. 257 00:23:45,020 --> 00:23:52,860 But the second two statements, we use this Y to combine the statements together into inner product forms. 258 00:23:53,260 --> 00:24:01,860 So, once again, originally, the second statement, A sub L times A sub Y equals zero, a vector of zeros, is actually multiple statements. 259 00:24:01,860 --> 00:24:06,880 It's N statements, one statement for each index of A sub L and A sub R. 260 00:24:06,880 --> 00:24:13,640 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. 261 00:24:13,640 --> 00:24:16,460 And then, we're combining them in one inner product argument. 262 00:24:16,460 --> 00:24:21,660 So, this is just the format that we write it in once we combine it with Y. 263 00:24:21,660 --> 00:24:23,420 And then, we do the same for the second one. 264 00:24:24,100 --> 00:24:24,760 Cool. 265 00:24:24,760 --> 00:24:27,040 So, how are you feeling about that? 266 00:24:27,040 --> 00:24:33,120 We use this challenge scalar, do some crazy stuff, and three inner product arguments. 267 00:24:34,400 --> 00:24:35,120 Alright. 268 00:24:36,100 --> 00:24:38,080 And then, we do it again. 269 00:24:38,820 --> 00:24:51,100 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. 270 00:24:51,100 --> 00:24:52,960 So, we're doing the exact same thing here. 271 00:24:53,260 --> 00:25:07,520 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. 272 00:25:07,840 --> 00:25:15,200 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. 273 00:25:15,880 --> 00:25:17,740 And then, you end up with this statement. 274 00:25:18,400 --> 00:25:19,120 Cool. 275 00:25:19,120 --> 00:25:21,140 Now, you have one statement. 276 00:25:21,140 --> 00:25:25,680 Remember how our goal is to get one statement that is one inner product argument. 277 00:25:25,820 --> 00:25:26,720 So, we're really close. 278 00:25:26,720 --> 00:25:29,140 We have one statement that's three inner product arguments. 279 00:25:29,920 --> 00:25:37,140 And then, we do some math that I'm not going to bore you with that's basically just algebra. 280 00:25:37,140 --> 00:25:39,240 You just, like, take some things apart and rearrange them. 281 00:25:39,240 --> 00:25:45,060 And then, you end up with this inner product statement equals this thing on the right. 282 00:25:45,360 --> 00:25:49,940 So, if you're curious about what that math is, we wrote it up here. 283 00:25:49,940 --> 00:25:52,860 It's really not actually that interesting. 284 00:25:53,540 --> 00:25:55,880 But, look here on the right. 285 00:25:55,880 --> 00:25:57,800 This is exactly the format that we want. 286 00:25:57,800 --> 00:26:04,880 We want an inner product argument where the thing on the left, inner product of the thing on the right equals C. 287 00:26:05,040 --> 00:26:15,420 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. 288 00:26:16,440 --> 00:26:23,820 So, to recap we have or, sorry, LOR I forget the letters I used. 289 00:26:23,820 --> 00:26:25,280 But, to recap, this is our journey. 290 00:26:25,280 --> 00:26:27,120 We started with a range statement. 291 00:26:27,180 --> 00:26:33,780 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. 292 00:26:33,880 --> 00:26:41,820 And then we applied these, like, random challenge scalars such that we could rearrange all three of these into one inner product argument. 293 00:26:41,920 --> 00:26:44,400 And that is basically in the same format as what we wanted. 294 00:26:44,400 --> 00:26:46,560 T is the inner product of LOR. 295 00:26:46,860 --> 00:26:56,260 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. 296 00:26:56,260 --> 00:27:01,920 And we have a really efficient way in O of all N to prove that this inner product is true. 297 00:27:02,460 --> 00:27:04,200 Cool, so it comes full circle. 298 00:27:06,960 --> 00:27:11,020 Yeah, this is LOR of T of inner product. 299 00:27:11,020 --> 00:27:21,340 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. 300 00:27:21,980 --> 00:27:23,660 Anyone have questions? 301 00:27:23,960 --> 00:27:25,080 Yes. 302 00:27:26,920 --> 00:27:28,980 Yes, for sure. 303 00:27:30,920 --> 00:27:38,000 So, so the first part is we took this Y and we took the Y to rewrite each of these. 304 00:27:38,000 --> 00:27:45,120 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. 305 00:27:45,120 --> 00:27:49,760 But we want some way to somehow smush all of these three statements into one statement. 306 00:27:49,960 --> 00:28:03,600 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, 307 00:28:03,600 --> 00:28:18,680 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. 308 00:28:18,680 --> 00:28:20,540 So that's exactly what we're doing here. 309 00:28:20,540 --> 00:28:28,120 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. 310 00:28:29,100 --> 00:28:31,640 And then that gives us the equation on the right. 311 00:28:31,640 --> 00:28:35,620 And then we just move the Z to the end, just because it's pretty random. 312 00:28:36,560 --> 00:28:38,780 Cool, does that answer your question? 313 00:28:39,100 --> 00:28:40,360 Okay, so I have one on my hand. 314 00:28:40,360 --> 00:28:40,900 Yeah? 315 00:28:43,140 --> 00:28:45,000 Ooh, oh man. 316 00:28:45,420 --> 00:28:52,960 I was hoping that, you know, this delta represents all of the messy casements that we don't actually want to write out. 317 00:28:53,220 --> 00:29:05,960 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. 318 00:29:06,100 --> 00:29:09,960 So delta doesn't have anything that's secret in it. 319 00:29:09,960 --> 00:29:12,480 The proof and the verifier both know what's in delta. 320 00:29:12,480 --> 00:29:16,820 And that's why we can just abstract it into this delta nice thing. 321 00:29:17,460 --> 00:29:20,940 Because it doesn't contain anything too important or too secret. 322 00:29:21,420 --> 00:29:22,940 Cool, any other questions? 323 00:29:24,240 --> 00:29:45,180 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, 324 00:29:45,180 --> 00:29:46,880 I knew your secret, come on. 325 00:29:47,300 --> 00:29:49,500 So that's sort of silly. 326 00:29:50,220 --> 00:29:57,400 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. 327 00:29:57,660 --> 00:30:08,060 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. 328 00:30:08,620 --> 00:30:09,960 What does that look like? 329 00:30:10,760 --> 00:30:14,480 Maybe first I should, you know, review what commitments are. 330 00:30:14,480 --> 00:30:28,240 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. 331 00:30:28,400 --> 00:30:32,940 So then the commitment of A plus the commitment of B would be equal to the commitment of C plus the commitment of D. 332 00:30:33,180 --> 00:30:36,940 And then similarly, this also extends to multiplication by scaling. 333 00:30:37,260 --> 00:30:42,540 So if you have 2 times E equals F, then 2 times the commitment of E equals the commitment of F. 334 00:30:42,540 --> 00:30:46,660 So you don't have to worry about how this works, you can just sort of treat this as a black box. 335 00:30:46,840 --> 00:30:57,840 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, 336 00:30:57,840 --> 00:30:59,800 I'm also happy to dive into that more. 337 00:31:00,080 --> 00:31:11,960 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. 338 00:31:12,200 --> 00:31:21,260 And if the inner product of those commitments is true, then with extremely high probability, then the secrets inside those commitments are also true. 339 00:31:21,680 --> 00:31:26,880 So that's really nice, because that's sort of the magic of an additively homomorphic scheme. 340 00:31:28,200 --> 00:31:30,060 And in practice, that's what we do. 341 00:31:30,580 --> 00:31:34,980 So, as a recap, let's see... 342 00:31:34,980 --> 00:31:44,620 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. 343 00:31:44,700 --> 00:31:58,600 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. 344 00:31:58,600 --> 00:32:05,860 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. 345 00:32:06,420 --> 00:32:21,780 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. 346 00:32:21,780 --> 00:32:26,680 So if you were to patch, you can get multiple verifications in even less time. 347 00:32:26,680 --> 00:32:35,340 And so, yeah, that's our numbers, and I think that's all of the material that I've had for today. 348 00:32:36,020 --> 00:32:47,360 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. 349 00:32:47,360 --> 00:32:50,360 So maybe, um, let's start with some questions. 350 00:32:50,360 --> 00:32:51,480 Let's see if I have time. 351 00:32:52,000 --> 00:33:01,800 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. 352 00:33:03,180 --> 00:33:04,880 Any questions about the math? 353 00:33:04,980 --> 00:33:06,720 Anything that you guys are happy to do for me? 354 00:33:06,720 --> 00:33:07,380 Yes. 355 00:33:19,550 --> 00:33:20,430 Yes. 356 00:33:20,790 --> 00:33:21,770 Great question. 357 00:33:21,770 --> 00:33:38,270 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, 358 00:33:38,270 --> 00:33:42,730 uh, x inverse attached with b-low to cancel out the x in a-low. 359 00:33:42,910 --> 00:33:47,590 So, here, let me just, like, review how this works. 360 00:33:47,590 --> 00:33:59,410 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. 361 00:33:59,450 --> 00:34:04,850 And then here, the x inverse here cancels out with x here, and that gives you a-high inner product with b-high. 362 00:34:04,850 --> 00:34:08,330 And so that's just a nice sort of magic. 363 00:34:08,870 --> 00:34:16,170 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. 364 00:34:16,870 --> 00:34:18,190 So, good question. 365 00:34:18,190 --> 00:34:20,210 Um, that is really cool. 366 00:34:21,470 --> 00:34:22,390 Cool. 367 00:34:22,390 --> 00:34:26,510 Any other, um, questions about math? 368 00:34:26,850 --> 00:34:28,050 Yes, hi. 369 00:34:28,630 --> 00:34:46,090 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. 370 00:34:46,090 --> 00:34:49,370 It's darkintangle.org.rs slash bulletproofs. 371 00:34:49,370 --> 00:34:51,950 If you just go to that, you can navigate all the notes. 372 00:34:52,170 --> 00:34:56,190 Um, the distinction between I'm so sorry, I should make the URL bigger. 373 00:34:56,190 --> 00:35:12,450 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. 374 00:35:12,450 --> 00:35:14,330 We have, like, Rust documentation for many. 375 00:35:14,890 --> 00:35:16,250 Um, yeah. 376 00:35:16,250 --> 00:35:16,950 Awesome. 377 00:35:18,030 --> 00:35:20,950 Okay, uh, any other questions about the math? 378 00:35:20,950 --> 00:35:27,610 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. 379 00:35:27,610 --> 00:35:29,770 I can choices of, like, what I can talk about. 380 00:35:29,770 --> 00:35:38,790 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. 381 00:35:38,810 --> 00:35:43,750 Uh, I can talk about Cloak, which is how we build a confidential assets protocol using all of this. 382 00:35:43,750 --> 00:35:48,050 I can talk about CKBM, which is like a smart contract language that we built on top of all this. 383 00:35:48,530 --> 00:35:50,370 Anyone super excited about any of these things? 384 00:35:50,370 --> 00:35:50,970 Yes. 385 00:35:55,380 --> 00:35:56,320 Oh, definitely. 386 00:35:56,520 --> 00:35:58,020 Um, yeah, relatively cool. 387 00:35:58,200 --> 00:36:07,720 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. 388 00:36:07,720 --> 00:36:12,220 The verifier, like, does this random challenge sampling and then gives a challenge back. 389 00:36:12,360 --> 00:36:16,960 Um, in the paper, usually they say, like, this is an interactive coin protocol. 390 00:36:17,060 --> 00:36:21,760 We naively, like, obviously just use the fiat from your peers to make this non-interactive. 391 00:36:21,800 --> 00:36:24,120 And then as an implementer, you're like, what? 392 00:36:24,700 --> 00:36:25,700 Like, how? 393 00:36:25,840 --> 00:36:30,920 And so Mervin has basically a strobe-based transcript protocol that Henry made. 394 00:36:30,920 --> 00:36:33,740 Henry was one of my colleagues who helped with the Bulletproofs implementation. 395 00:36:33,800 --> 00:36:36,560 We were working on, like, how do we make this non-interactive? 396 00:36:36,580 --> 00:36:42,620 And he was like, this would be a really good use case for a library that takes care of all of that for you. 397 00:36:42,620 --> 00:36:49,800 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. 398 00:36:49,940 --> 00:36:54,720 You're like, we just hash this, and then we take the challenge from it, and then we use the challenge. 399 00:36:54,720 --> 00:36:57,380 So just, sorry, here's an example. 400 00:36:58,560 --> 00:37:03,280 If you wanted to take a challenge, like, here, for instance, x, like, where does this x come from? 401 00:37:03,300 --> 00:37:13,140 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. 402 00:37:13,140 --> 00:37:22,340 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. 403 00:37:22,420 --> 00:37:27,880 And so that's why Henry made Merlin, which is effectively a black box, where you're like, I put my randomness in here. 404 00:37:27,880 --> 00:37:39,360 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. 405 00:37:39,360 --> 00:37:43,820 So that's actually, and so that's where we get x from. 406 00:37:43,820 --> 00:37:50,360 We actually use the Merlin transcripts to get x, to get the y, to get the z for all of these random challenge scalars. 407 00:37:51,620 --> 00:37:52,220 Yeah. 408 00:37:52,840 --> 00:37:53,760 Anything else? 409 00:37:53,760 --> 00:37:56,040 Anyone want to hear about any other things? 410 00:37:56,040 --> 00:37:57,200 I could also be done. 411 00:37:59,380 --> 00:38:00,040 Way more. 412 00:38:00,040 --> 00:38:00,560 Okay. 413 00:38:01,260 --> 00:38:08,520 I think the coolest thing that we built on top of this is the cloak protocol. 414 00:38:08,520 --> 00:38:11,600 So let me just pull up my slides for that. 415 00:38:11,980 --> 00:38:12,780 Sorry. 416 00:38:12,940 --> 00:38:15,240 All right 417 00:38:26,110 --> 00:38:26,310 . 418 00:38:26,310 --> 00:38:46,650 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. 419 00:38:46,730 --> 00:38:54,770 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. 420 00:38:54,810 --> 00:39:00,130 They're really easily translatable from one to the next, but constraints are a little bit easier to talk about. 421 00:39:00,130 --> 00:39:09,250 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. 422 00:39:09,250 --> 00:39:15,550 And you also have a linear constraint, which is like some linear combination of secret variables with clear text weights. 423 00:39:15,550 --> 00:39:19,710 So these are like the tools that you have with which to build up this constraint system. 424 00:39:20,910 --> 00:39:26,350 And with a constraint system, you can actually represent anything that is efficiently verifiable. 425 00:39:26,350 --> 00:39:34,010 So by this, I mean any NP-complete program can be, you know, changed into or represented as a constraint system. 426 00:39:34,110 --> 00:39:35,670 So that's pretty nice . 427 00:39:36,570 --> 00:39:50,090 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. 428 00:39:50,090 --> 00:39:54,850 So like if you're a theory nerd, that's like free fun. 429 00:39:54,850 --> 00:39:56,970 But if you're not, it doesn't matter. 430 00:39:57,910 --> 00:40:02,630 So you can represent basically any program you want as a constraint system. 431 00:40:02,630 --> 00:40:06,630 So what we wanted to do was to make a confidential assets protocol. 432 00:40:06,790 --> 00:40:14,850 And confidential assets is a lot harder to make than a confidential transaction protocol because you want to keep the asset types secret. 433 00:40:15,350 --> 00:40:21,630 And so like, my idea is you're just like, I want to add together all the sums of all the different asset types. 434 00:40:21,630 --> 00:40:28,130 Then you have to specify which assets are the same, and that would reveal which assets are which over enough analysis. 435 00:40:28,490 --> 00:40:34,130 So you can't just sort of sum together things the same way that you do for confidential transactions with one asset type. 436 00:40:34,350 --> 00:40:39,870 So what we came up with was sort of multiple gadgets that we composed together. 437 00:40:40,130 --> 00:40:52,430 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. 438 00:40:52,930 --> 00:40:54,810 And then we add some new ones. 439 00:40:54,810 --> 00:41:03,290 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. 440 00:41:03,290 --> 00:41:05,950 So you can't just introduce a new input and introduce a new output. 441 00:41:05,950 --> 00:41:08,710 Then the shuffle gadget would fail. 442 00:41:08,850 --> 00:41:15,810 And then there's a merge gadget, which either merges two inputs into one, or just moves them without altering. 443 00:41:15,810 --> 00:41:16,690 Same with split. 444 00:41:16,690 --> 00:41:24,210 Split either splits one item into two, or it moves the two inputs into the two outputs without altering it at all. 445 00:41:24,490 --> 00:41:49,770 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. 446 00:41:50,030 --> 00:41:55,050 So this is really tricky because you can't actually reveal what asset groupings you have. 447 00:41:55,170 --> 00:41:59,610 So this is like a fine , it took us a while to come up with this solution. 448 00:41:59,690 --> 00:42:16,230 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. 449 00:42:16,610 --> 00:42:20,710 Let me walk you through why this is the case, or how you actually prove this. 450 00:42:21,130 --> 00:42:25,030 So suppose that your inputs are $5, 3 yen and $4. 451 00:42:25,070 --> 00:42:37,650 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. 452 00:42:37,650 --> 00:42:43,390 So you would use the shuffle to reorder this such that your dollar amounts are together and your yen is at the very end. 453 00:42:44,350 --> 00:42:49,630 Then you will merge your dollar amounts into one lump sum and you'll merge again. 454 00:42:49,630 --> 00:42:51,090 Well, you will, because you only have one. 455 00:42:51,410 --> 00:42:57,150 And then you shuffle it such that your non-zero values are at the very top of the shuffle for each asset type. 456 00:42:57,610 --> 00:43:05,030 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. 457 00:43:05,070 --> 00:43:11,290 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. 458 00:43:11,450 --> 00:43:12,810 And then you'll be able to go down the coast. 459 00:43:12,810 --> 00:43:14,050 It's just one output. 460 00:43:14,670 --> 00:43:18,770 And then, just to preserve the randomness of your output, you'll shuffle it one more time. 461 00:43:18,930 --> 00:43:23,890 You'll apply a range check to it to make sure that none of these are negative. 462 00:43:23,890 --> 00:43:25,310 And then you get your outputs. 463 00:43:25,610 --> 00:43:30,730 And so, if your outputs are valid, then you should be able to do this successfully. 464 00:43:30,950 --> 00:43:38,750 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. 465 00:43:38,750 --> 00:43:42,030 One of these guys would be like, wait, where did this extra money come from? 466 00:43:42,030 --> 00:43:44,370 Like, this is not a valid constraint of satisfaction. 467 00:43:44,670 --> 00:43:47,190 So this is the intuition for how it works. 468 00:43:47,390 --> 00:43:53,530 And then for a verifier, the verifier actually only receives these commitments to the input and commitments to the outputs. 469 00:43:53,670 --> 00:43:59,810 And it can't tell what happened within each of the gadgets because all of it are just like commitments to the verifier. 470 00:43:59,850 --> 00:44:04,730 But all it can do is verify that, yes indeed, this proof succeeded or this proof failed. 471 00:44:04,770 --> 00:44:07,210 And then, you know, valid and invalid transaction. 472 00:44:07,970 --> 00:44:10,570 So that's the intuition for Cloak. 473 00:44:10,590 --> 00:44:18,350 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. 474 00:44:18,350 --> 00:44:22,910 We just sort of made this by hand after figuring out what would make sense as a way to build it. 475 00:44:22,990 --> 00:44:27,250 And anyone else can basically make their own protocols and proofs as well. 476 00:44:27,490 --> 00:44:28,710 So that's cool. 477 00:44:28,710 --> 00:44:31,810 That's my little I think I'm out of time. 478 00:44:31,810 --> 00:44:33,550 Do I have time for questions maybe? 479 00:44:33,550 --> 00:44:34,050 Or should I just... 480 00:44:34,690 --> 00:44:37,090 Alright, any questions about the last bit? 481 00:44:37,790 --> 00:44:38,670 Yes. 482 00:44:44,690 --> 00:44:47,870 Yeah, so here at the very end we have a range check. 483 00:44:47,930 --> 00:44:53,810 And so basically the output of the third shuffle right here is 3 yen, 6 dollars and 3 dollars, right? 484 00:44:53,810 --> 00:44:59,390 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. 485 00:44:59,590 --> 00:45:13,010 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... 486 00:45:13,010 --> 00:45:14,650 negative 92, something... 487 00:45:14,650 --> 00:45:15,990 another negative number. 488 00:45:16,010 --> 00:45:17,510 But then that would fail the range check. 489 00:45:17,510 --> 00:45:21,010 So basically the range check makes sure that we can't make extra money. 490 00:45:21,010 --> 00:45:21,910 Sorry. 491 00:45:21,910 --> 00:45:23,550 You can ask more questions afterwards. 492 00:45:23,550 --> 00:45:24,270 I'm going to cut off. 493 00:45:24,270 --> 00:45:25,670 Thank you for all of your attention.