start	end	text
0	3440	Hello, everybody. Welcome to the last day at the Manara Village.
3440	12600	If you are just wandering in here, you arrived just in time for a talk by the world-famous Cathy Heung,
12600	17220	who is going to give us a deep dive into bulletproofs.
17220	21180	Now, if you are a swimmer, you may be familiar with diving deep.
21400	25180	Diving into mathematics is a lot... it's a lot different.
25180	29280	And you come out just as exhausted, but it's a different form of exhaustion.
29280	34540	So Cathy here is going to very gently, gently take us through bulletproofs.
34880	40200	And I hope you all come out the other side smarter, because all of this is going to go over my head.
40200	43580	Cathy, please... please be gentle.
44440	46280	Oh, he's my lapel.
48080	56140	Hi, I'm Cathy. For some context, I worked on an implementation of bulletproofs in Rust,
56140	62080	both at Canon and Gstellar, and we have the fastest implementation in existence.
62080	67220	And so I feel like maybe that makes me qualified to just tell you a little bit about how bulletproofs works.
67320	71220	So maybe before I begin, there's a lot of stuff that I didn't cover.
71480	76320	And what I cover is largely determined by what you guys want to hear.
76340	81800	So what I submitted to this talk was, let's go really deep into the math of bulletproofs.
81800	87800	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,
87800	92960	what other people can use it for, maybe proposals of what Monero might want to do.
93100	99140	So maybe by a show of hands, how many people are here because they really want to just get into the math?
99560	101400	Oh, okay, cool. Let's do that.
101400	106760	And then if we have extra time afterwards, I'm happy to talk about other exceptions over that.
107160	107840	Awesome.
109480	113640	So the motivation of why we care about bulletproofs.
113640	116420	First, I guess we should talk about why we care about zero-knowledge proofs.
116420	122460	So for some of you, this might be redundant, but I'll just cover some basic ground first.
122580	132160	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.
132160	134640	So that might be a little confusing and abstract.
134640	137400	One example of a zero-knowledge proof is a range proof.
137400	143460	So a range proof is a proof that a certain number is in a range, usually like 0 to 2 to the n,
143460	148900	and you can show that this proof is true without revealing what your number is.
148900	151400	So instead of revealing your number, you're revealing it as your secret,
151400	155520	you make a commitment to that number, and that commitment is binding, hiding,
155520	159200	and you can show that commitment to someone without revealing your secret.
159420	163540	So we'll talk a little bit more about range proofs, actually a lot more about range proofs,
163540	165640	so don't be too intimidated yet.
165640	171680	So probably a lot of things you're familiar with, but in a blockchain transaction,
171680	173640	it's not confidential, this is what it looks like.
173640	179660	And an important thing for validity of this transaction is that your inputs sum to the number that's equal to your outputs.
179660	186400	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.
186860	191020	And if you wanted to make this confidential, there's many ways to do this,
191020	198340	but one proposed way is just called confidential transaction, proposed for Bitcoin,
198340	203900	and a broken way to do this would be to use an additively homomorphic commitment,
203900	207660	and just say, well now we're just going to do A, B, C, and D,
207660	211220	which are the blinding and hiding for our secret values.
211220	214400	And then you just check that A plus B equals C plus D,
214400	217240	and this will be true with very high probability,
217240	221800	if and only if your interior secret values actually sum up to the same value.
222720	225080	Now, can anyone tell me why this is broken?
226760	227640	Anyone?
229280	230300	What's that?
231240	231980	Yes?
233980	237940	That is true, there's a very small chance that this can be incorrect,
237940	241080	and this is because of the way that you have your commitment scheme,
241080	245520	but that's like such small probabilities that that's actually not something that we're going to worry about.
245520	246340	What about you?
249870	252610	Exactly, yeah, so like this works with everything,
252610	256830	but if you have a negative number, this also still works.
256850	259190	And so this is still like technically correct,
259190	263710	but definitely not correct in the context of a blockchain financial transaction.
263710	266450	So we don't want this to be possible.
267550	271110	And for those of you who want to like understand the math better,
271110	276710	when I say a negative number, it's actually a negative number mod P,
276710	282510	and so what this is basically equivalent to is an extremely large number in your prime order group,
282510	284910	and so those two statements are equivalent.
284910	287610	So you could be allowing someone to spend negative $1,
287610	291770	or you could be allowing them to spend just like P-1, where P is very large.
292090	295130	So that's just to be technically correct here.
295370	299110	So what we want to do is to insert a range proof
299110	302970	that all your secret values are in a certain range.
302970	310330	So as long as your range proof is from zero to a number that's still smaller than your prime order group P,
310810	315290	then this will make sure that you don't add any like negative weird numbers.
315810	321150	So yeah, that's one example of how zero-knowledge proofs are useful in the blockchain context.
321150	323330	Obviously, there's many other ways to use them,
323330	326890	and there's also many ways to use zero-knowledge proofs outside of blockchains too,
326890	329810	but you're probably interested in the blockchain applications.
329930	331530	And what do we care about bullet proofs?
331530	333890	So bullet proofs is a pretty cool paper.
333890	336030	It came out in 2017 from Stanford.
336110	340750	And it gives us a lot of properties that we really want in a blockchain context.
341230	344810	So what we really want is a constrained proof size
344810	348810	because all the nodes have to receive a proof and verify them.
348810	352450	And bullet proofs provides a pretty constrained proof size O of log N,
352450	354410	where N is the number of multipliers.
355150	357270	It also gives us really fast verification.
357270	362530	So that's important because, once again, you have to have all nodes sync up.
362570	366870	And bullet proofs provides fast verification that also allows you to batch,
366870	370710	which means that you can verify multiple proofs in parallel more efficiently,
371090	375230	and aggregate, which means you can combine multiple proofs into one proof
375230	377170	that they are all correct.
377410	379710	And then lastly, this is a really nice property
379710	383310	and sort of a big differentiator from ZK-Smart, for instance.
383310	386550	You can have ad hoc logic that doesn't require trusted subtle.
386550	389810	So if you wanted to create a custom smart contract, for instance,
389810	393750	you don't have to have a trusted reference string that requires your setup string.
393950	398970	So that is a big thing that is appealing about bullet proofs
398970	401610	and a big pain point of using ZK-Smart.
401610	405790	And I know a lot of more recent zero-knowledge proof protocols,
405790	409170	such as Ksharks, which is great, H is for hybrid,
409170	412150	actually gives you a hybrid mode between bullet proofs
412150	416230	not requiring trusted setup and ZK-Smarts requiring trusted setup.
416230	418970	So that's just like a fun side note.
419470	422910	But basically, at the time, when we were looking to implement zero-knowledge proofs,
422910	425990	bullet proofs was the thing that definitely made the most sense.
426110	429470	So what we wanted to do was, well, first of all, understand the paper
429470	431650	so we don't just blindly implement it,
431650	433750	and then second, once we understood,
433750	436630	then, you know, implement it using really best practices
436630	438770	and existing libraries and Rust,
438770	440290	and then make it a good performer.
441230	443970	So you're all here to hopefully understand the paper,
443970	445270	so let's dive right in.
445270	447510	This is what it feels like to read the paper.
447630	450250	We have some assumptions, for example,
450250	452810	like we would like to prove that E is in range,
452810	456470	and then it just gives us this massive multiscalar multiplication,
456470	458550	and you're like, what is going on? Oh my gosh.
458590	463590	So I would like to hopefully give you a path between step one and step two.
463930	466990	And when we tried to figure that out,
466990	468550	it took us actually like a month or two
468550	471110	of just like whiteboarding out possible hypotheses
471110	473330	of how we get from step one to step two
473330	475190	and being like, no, that's wrong.
475850	477290	No, that's still wrong.
477370	479070	Okay, we actually like came up with something,
479070	481430	and then we wrote up all of our notes online.
481450	483090	So if you listen to this talk,
483090	485230	you want more information, or maybe you see this talk
485230	487110	and you're confused about some points,
487110	489490	we actually have all of the notes for this online
489490	492030	at docu-channel.alabic.rs.
493210	495490	Also, I will post the slides online too,
495490	497770	so don't worry about finding all the URLs.
498870	501330	And then, oh, the last thing is that after we understood
501330	504150	all of the math, Oleg came in with his graphic genius
504150	505410	and made a cyberpunk
506090	508530	visual of how all the math works.
508650	509710	And so hopefully when you come back
509710	511270	to the slide at the very end, you'll be like,
511270	513290	oh, I understand all these transitions.
513710	515670	That would be really great. Well, most of them.
516130	517410	Cool, so the most
517410	519910	fundamental building block of bulletproofs
519910	521590	is this inner product algorithm.
521810	523950	So this is actually not unique to bulletproofs.
523950	525350	This was introduced by
525510	527330	a previous paper out of UCL,
527330	529890	and bulletproofs just made this three times more efficient.
530470	532710	So, what is an inner product?
532810	534110	An inner product,
534110	536250	for instance, C is an inner product of A and B
536250	538730	is the sum
538730	540230	of entry-wise multiplications
540230	542290	of vectors A and B.
542370	544230	So for some syntax
544230	546110	in this slide and in the bulletproof
546110	548090	paper, bolded
549090	549610	letters
549610	551950	represent vectors. So here
551950	553790	C is the inner product of vector A
553790	556170	and vector B. So,
556170	557970	naively, if you wanted to prove to me
557970	560250	that C was equal to the inner product of
560250	562550	A and B, and you had A and B,
562550	563890	how could you do that?
563970	566170	Just shout out some ideas,
566170	567250	super naively.
570210	571990	How would you do this in O of N
571990	573350	space?
574890	575610	Yeah,
575610	577890	you could just send vector A, vector B
577890	579550	and scalar C to B, and then
579550	581530	I as the verifier could do
581530	583650	the multiplication. So obviously this
583650	585050	proof would be O of N
586050	587230	space, because
587230	589250	N is the length of A and B.
589710	590890	The thing that
591350	593350	boldproof introduces is a way to do this in O of
593350	594330	N space.
596370	597330	So what this looks
597330	599410	like is first you start out with vectors A and B
599410	601410	and your scalar C.
601470	603190	Then you split A and B into
603190	605550	two halves. Then you take
605550	607350	this random scalar
607350	609390	X, and right now you don't
609390	611230	have to worry about where X comes from.
611230	613190	All you have to know is that it's not zero,
613190	614990	because if it's zero then you're screwed.
614990	616690	And it's totally random.
616690	618650	You cannot predict it ahead of time.
618650	620770	So you take this random scalar
620770	622990	X and you multiply it by
622990	624370	the first half of A
624370	627130	and you multiply the inverse by the second half of A
627130	628810	sorry, the second half of A
628810	631030	and then you get this A prime
631030	633090	and then you do a split between with B prime
633090	635150	and A prime and B prime
635150	636490	are now half the length
636490	638190	of A and B.
638610	639810	And then you
640890	643290	get this big mess for C prime
643770	645410	But, actually watch this
645410	647330	it's sort of magic. Because of the way
647330	649510	that we selected the inverse and not inverse
649510	651550	for A prime and B prime for X
651550	653490	we can actually simplify
653490	655730	this mess of C prime to be equal to
655730	657550	the inner product of A low and B low
657550	659370	plus the inner product of A high and B high
659370	661010	plus like some garbage.
661770	663710	And, wait for it...
663710	665770	This, the inner product of A low and B low
665770	667650	plus the inner product of A high and B high
667650	669810	is, by definition of inner product proof
669810	671430	the same thing as the inner product
671430	673450	of A and B. So, do you see
673450	675150	what's going on here?
675150	677410	That line is actually the same thing as C
677410	679430	above. Wow!
680610	681490	Okay,
681490	683150	can you raise your hand if you
683150	685530	understood that. If you don't, I can repeat
685530	688230	because I feel like this is a really critical part of understanding.
688550	689530	Okay, cool.
690210	691390	Sort of, sort of.
691390	693590	Okay, so, yeah.
699120	699700	Good,
699700	701480	I'm getting to that. So, first
701480	703780	we appreciate that the math works
703780	705540	here so that you actually have C
705540	708520	in your representation of C prime. And then you have this garbage.
708700	709400	So, this garbage
709400	711500	you have to just commit to it.
711500	714040	So, let's call the thing underlined
714040	715780	in green L and the thing underlined
715780	717880	in red R. And then we send
717880	719100	those two, so there are two
719620	721580	points, we send those two points
721580	723760	to the verifier.
723940	725660	And you just say C prime is equal to
725660	726940	the C from the previous round
726940	729020	plus X squared times L
729020	731560	plus X negative 2
731560	732840	times R.
734440	736480	So, in summary,
736480	737720	this is one round.
737720	739460	And in one round, what we have achieved
739460	741640	is that we have half the size of A,
741640	743740	half the size of B, and committed to
743740	746060	two points. That's a constant number of points.
746060	747760	So, from, like, theory
747760	749600	of computation, if you do
750080	751480	a happy every step
751480	753700	and every step you do a constant number
753700	755500	of commitments,
755500	757600	then you have a protocol
757600	759760	that takes O of N,
759760	761260	O of log N space.
761600	763420	So I'm going to follow along so far.
764460	765940	Okay, cool, so this is actually
765940	767900	like the core nugget of what makes
767900	769620	bullet proofs so efficient.
769620	771920	Now you can, for very long vectors
771920	773860	A and B, be able to
773860	775680	make a proof that C is
775680	777300	the inner product of A and B
777840	779700	in O of log N space.
779700	781440	Instead of before the only options
781440	783580	are O of N space or something like on that
783580	785760	order of code performance.
787140	787840	Oh, and then at the
787840	789680	very basic case, we have
789680	791920	you know, A prime and B prime are just
791920	794900	single scalars.
794900	795840	And you send, you know,
795840	797720	the single A prime to B prime
797720	799900	and the prover, the verifier checks
799900	802020	that that's equal to your basic case C prime.
802360	804140	Cool, so yeah, that's
804140	806000	sort of inner product.
806220	808920	And then just sort of like, as a recap,
808920	810420	if you are the prover,
810420	812140	now you have received one L
812140	813560	and one R point
813560	815480	for every one of these steps.
815480	818040	And then you also received the C prime.
818040	819440	So you effectively like reverse
819440	821100	this process and you build up
821100	823240	what every higher C is
823240	824840	using the L and R from that
825540	827460	previous step until you get to the
827460	829540	top level C. And if your top level C
829540	831560	is equal to the C that you expect
831560	833240	then you're like, wow, this all verifies
833240	835680	for me. So that is
835680	837920	our core building block here.
838140	840100	Before we move on, any questions?
840100	840880	Votes?
847200	848160	Alright.
849880	850360	So
850360	852340	I did skip some things.
852360	854240	So, one thing that I skipped is
854240	856220	how we actually get the X. I told you don't
856220	858360	worry about it because all you need to know
858360	860500	is it's not zero, that it's random.
860600	862300	In practice, we
862300	864220	use the Fiat-Humier heuristic to get
864220	866280	these challenge scales. What we actually
866280	868160	do is we bind the X to all
868160	869980	of the things in the previous round.
869980	871980	So that you only get this random X
871980	874140	once you've come into everything before. So you can't
874140	875880	actually maliciously choose this X.
875880	878060	So that's something that I didn't talk too much about.
878120	880360	If you're curious about it, I can explain more.
880600	882160	I also didn't talk about how
882160	884000	operations are actually over commitments
884000	886040	over the plain values. In all
886040	887960	of these examples, I just used a plain
887960	890120	A and B, but we actually are operating
890120	892280	over additively homomorphic commitments
892280	893720	in the exact same way that
893720	896040	in our earlier example for our confidential
896040	898000	transaction, we're actually operating
898000	899800	over additively homomorphic commitments
899800	902080	when we check that they add to the same else.
902940	904040	And then the last one
904040	905200	is just a performance thing.
905360	907900	We use multi-exponentiation to have faster
907900	909960	verification, but that's
910700	912080	not fundamental to the math.
912080	914360	It's just cool performance speedups.
915100	915900	Alright, so
915900	917640	we just covered the inner product
917640	920220	building block, and now you might be wondering
920220	921500	why do we even care?
921500	924180	Why does it matter that C is the inner product
924180	926300	of A and B? Whatever.
926540	928540	And the reason that it's actually really cool
928540	930420	or why we care about this form
930420	931940	is because we can actually
931940	934460	by applying math and cryptography
934460	936060	to a statement
936060	938020	we can represent effectively any
938020	940740	statement as an inner product.
941080	942000	If you don't believe me,
942000	943800	I'll show you with this range proof,
943800	945400	and then I can also show you with
946100	948300	our generalized constraint system
948300	950100	proof, which
950100	952840	therefore reduces from any statement.
954120	956300	But, let's look at the range proof
956300	958140	first. So, here what we want
958140	960080	to do is we want to start out with
960240	962440	a statement of range. 0 is less than or equal to
962440	964320	v, which is less than 2 to the n.
964320	966180	We want to do some things to it
966180	968460	tbd, until it's in the form
968460	970340	of C equals inner product of A and B
970340	971700	such that
971700	975120	if C is equal
975120	976580	to the inner product of A and B
976580	978560	then with very high probability
978560	980460	v is in range.
981180	982240	Cool. Is everyone
982240	984280	on board with this solution? Any questions
984280	986200	so far? Alright, so now
986200	988220	we're just looking at this in-between math and
988220	989460	computer science.
990220	992120	Alright, so the first thing that we want to
992120	994680	observe is really interesting.
994680	995780	So, if
996360	998320	v is in range from 0 to
998320	1000140	2 to the n, then v
1000140	1002840	must be a binary number of like n.
1002920	1004160	So, in this example,
1004160	1006320	if v is 3, v is
1006320	1007920	definitely in range between 0 to
1008420	1010420	2 to the n if n is 4.
1010420	1012000	So, you must be able to represent
1012000	1014180	v as a binary number of
1014180	1016280	like 4. Cool.
1016280	1018300	So, as a mental exercise
1018300	1020400	you can try
1020400	1022600	this with any value
1022600	1024160	between 0 and 2 to the 4
1024160	1026820	and you'll see that yes, indeed, it does work.
1026820	1028540	And if you try to represent something larger
1028540	1030440	so 2 to the 4 plus 1
1030440	1032260	you'll see that you cannot actually fit everything
1032260	1034400	in these boxes. Cool. So,
1034400	1036460	by definition, binary numbers.
1037920	1038480	So, I think this is
1038480	1040300	pretty cool, first of all.
1040660	1042120	Any questions so far?
1043400	1044360	If you
1044360	1046720	don't follow this, you'll be lost with the rest of this
1046720	1048980	explanation, so I want to make sure it's on board.
1050040	1050900	Don't be embarrassed.
1051240	1052800	It took us at least a month
1052800	1054500	to figure this out, so don't be embarrassed
1054500	1056580	for covering it in like two minutes.
1057440	1059740	Cool. So,
1059740	1060340	we now have
1060340	1062520	v of 3, this is our secret
1062520	1064680	value, and we want to prove that it's between
1064680	1066540	0 and 2 to the 4.
1066900	1067980	What we do
1068960	1070780	is we call the binary representation
1070780	1072440	of v, A sub L
1072440	1074600	and this is what the paper uses, so I'm just
1074600	1076660	trying to be consistent. And then we can say
1076660	1078760	that v is the inner product of
1078760	1080620	A sub L and 2 to the N.
1080620	1082480	Remember, inner products can be of any two
1082480	1084560	vectors that are the same length. So here we're
1084560	1085440	actually representing
1086420	1088400	v as an inner product.
1089180	1090660	So, maybe some of you
1090660	1092260	are thinking like, whoa, we've actually
1092260	1094600	jumped from this v in
1094600	1096580	range all the way to the inner product statement.
1096580	1098400	Are we done? I wish.
1098400	1099480	That would be really nice.
1100160	1101600	No, we're not done.
1101720	1103700	And the reason for this is because if this is your
1103700	1105680	only statement, you can actually do something malicious
1106140	1107600	with your A sub L.
1107700	1109600	Does anyone have any guesses as to what you
1109600	1111920	can do with this selection of A sub L
1111920	1113680	that would be malicious, that would
1113680	1115640	allow you to make a value
1115640	1117720	that's outside of the range, but for whom
1117720	1120280	this inner product argument is actually true?
1121840	1123980	Yes, exactly. A sub L,
1123980	1125600	nothing about the statement v equals
1125600	1127360	the inner product of A sub L and 2 to the N
1127940	1129540	requires that A sub L is actually just
1129540	1131460	binary. So, if we have
1131980	1133700	last digit or the first digit
1133700	1135440	is 100, then v would be a huge
1135440	1137560	number, but this inner product statement
1137560	1138720	would still be true.
1139280	1141280	So, what we want to do...
1141280	1143580	Oops, I actually have slides to watch all of this.
1143580	1144600	There we go. So, here's
1145520	1147460	some examples of
1147460	1149520	v. What we want to do
1149520	1151540	is basically add another statement that
1151540	1153880	A sub L has to be binary.
1154000	1155620	And the way that we do this is we create
1155620	1157720	an A sub R. A sub R is
1157720	1159700	the bits of A sub L minus 1.
1159700	1161560	So, if you have 0, 0, 1, 1, then
1161560	1164100	A sub R is negative 1, negative 1, 0, 0.
1164380	1165540	So, this has a really
1166040	1167800	neat property where if you multiply
1167800	1169500	every bit of A sub L
1169500	1172220	with the corresponding bit of A sub R,
1172220	1173940	then if A sub L
1173940	1176340	is only bits, then you'll get a vector of zeros.
1176880	1177640	If A sub L
1177640	1179840	is anything else, for example 100,
1179840	1181500	then you'll get 100 times 99
1181500	1183860	and that's not a zero. So, this is actually
1183980	1185840	a statement that makes sure
1186680	1187880	that A sub L
1187880	1189780	is comprised of bits.
1190000	1191600	So, now we have three statements. One being
1191600	1193420	the vector is actually A sub L times
1193420	1195880	inner product of 2 to the N. The second one
1195880	1197940	being A sub L times A sub R
1197940	1199560	equals zeros. And the third
1199560	1201400	being the definition of A sub R.
1202320	1203840	Cool. So,
1203840	1205600	how's everyone doing? Does this make sense? Why do we
1205600	1207880	use A sub R? Cool. And obviously
1207880	1209780	you can combine steps 2 and 3
1209780	1211540	into just one statement without
1211540	1213180	defining A sub R, but
1213180	1215480	we tried to do that and then
1215480	1217180	realized that that breaks the protocol
1217180	1219540	because you have to separately make a commitment to A sub R.
1219540	1221540	So, just trust me that you actually need to
1221540	1223200	do all three of these things.
1223880	1224960	Cool. So, now we
1225540	1227260	have come up with these three statements.
1227260	1229380	If they're true, then
1229380	1231320	your original range statement is true.
1232660	1233580	So,
1233580	1235380	before moving on,
1235380	1237280	I need to introduce another
1237280	1239280	mathematical building block that
1239280	1240940	allows you to combine statements.
1241180	1243220	So, the same way that we got
1243400	1244860	a challenge scalar last time,
1244860	1247180	previously in the inner product group, here
1247180	1249180	let's just pretend we have a challenge scalar. Let's not
1249180	1251200	worry about how we get it, which is
1251200	1252620	random and it's not zero.
1252940	1255180	If A equals zero, if B equals
1255180	1257140	zero, then you can actually combine these
1257140	1259300	two statements together into one statement
1259300	1261060	using this random challenge
1261060	1263780	by saying A plus B equals zero.
1263780	1265240	And as long as X is random,
1265240	1267580	then with extremely high probability,
1267580	1269360	this last statement will be true
1269360	1271820	if and only if A equals zero and B equals zero.
1271960	1273860	Does this make sense? Let's see.
1274580	1275720	And if you want to be
1275720	1277500	malicious, and also to check
1277500	1279580	your understanding, can someone tell me what
1279580	1280800	X has to be in order to
1281700	1283700	maliciously make an X
1283700	1285460	such that A plus BX equals zero
1285460	1287960	even if A and B do not equal zero?
1289320	1290140	Zero.
1290960	1293420	Yeah, that's true, yes. And also
1293420	1295540	you can set X as equal to
1295540	1297020	A divided by B.
1297120	1298940	And that will also give you maliciously
1299160	1301620	a way to circumvent
1301620	1302860	this double
1303440	1304860	combination step.
1304860	1307220	So we just have to check X is not equal to zero
1307220	1309180	and sample X in such a large space
1309180	1311080	that the probability that it's equal
1311080	1313160	to A divided by B is so small
1313160	1314680	that we don't even worry about it.
1315000	1316800	And in practice, we sample X from
1317300	1319500	2 to the 255 minus 19,
1319500	1321440	so we're fine. Don't worry about it.
1322100	1322980	Cool.
1323700	1324900	So, we can actually
1324900	1327120	do this multiple times. Don't be scared.
1327120	1328800	This is the same idea. We can do this
1328800	1330900	multiple times, but instead of
1330900	1333120	using X once, we can multiply
1333120	1335060	the first one by nothing, the second one by
1335060	1336820	well, here our conuscular is Y
1336820	1339700	by Y, our third one by Y squared,
1339700	1340900	so on and so forth, and
1340900	1343120	everyone has a different exponent of Y.
1343260	1344940	And the reason that we'll have to do this is
1344940	1347040	because if Y is random, then taking
1347040	1349120	Y to a certain exponent is also going to give you
1349120	1351760	something that is random in that space.
1351760	1353600	And so,
1353600	1355660	the way that we
1355660	1357820	write this combination is
1357820	1359840	the inner product of A and B
1359840	1361480	times the vector of Y to the N
1361480	1363640	equals 0. So, it's a little bit
1363640	1365740	weird syntax,
1365740	1367380	but that's just how we write it.
1367700	1369840	And so, since the prover can't predict Y,
1369840	1371740	the latter statement, this inner
1371740	1373760	product of A and B times Y to the
1373760	1375740	N equals 0 is true with very
1375740	1377760	high probability. Alright, so this
1377760	1379820	is our building block. I'm just showing
1379820	1382020	you how you can use random calendars to combine
1382140	1383900	a bunch of statements together, and hopefully
1383900	1385920	you'll also have a little inkling of
1385920	1387700	like, hmm, this is interesting, because
1387700	1390000	this last statement is actually an inner
1390000	1391780	product statement. So,
1391780	1393980	remember how this whole journey
1393980	1396140	is us trying to start with a
1397440	1398320	range statement
1398320	1400300	and ending up with an inner product?
1400300	1402160	This is actually a tool that we'll use
1402160	1405360	to get to that inner product.
1405360	1406200	So,
1406200	1407860	the way that we'll use this tool is that
1407860	1409920	the verifier gives us a random
1409920	1412020	form of scalar Y. So,
1412020	1413860	this comes from somewhere. In practice, it
1413860	1415580	comes from the Pyatchenko heuristic.
1415800	1417960	Then, we rewrite the second two
1417960	1419620	statements, because the first statement is already
1419620	1421860	in the inner product proof form,
1421860	1423500	so we're already pretty
1423500	1425540	well along there. But the second
1425540	1427540	two statements, we use this Y
1427540	1429660	to combine the statements
1429660	1431720	together into inner
1431720	1433700	product forms. So, once
1433700	1435940	again, originally,
1435940	1438160	the second statement, A sub L times A sub Y
1438160	1439960	equals zero, a vector of zeros,
1439960	1441860	is actually multiple statements.
1441860	1443820	It's N statements, one
1443820	1445880	statement for each index of A sub L
1445880	1447900	and A sub R. And what we actually do
1447900	1449780	is we're combining all of those statements
1449780	1451900	by multiplying each of those
1451900	1453640	statements by a different power of Y.
1453640	1456460	And then, we're combining them in one inner product argument.
1456460	1457680	So, this is just the format
1457680	1459980	that we write it in
1459980	1461660	once we combine it with Y.
1461660	1463420	And then, we do the same for the second one.
1464100	1465420	Cool. So,
1465420	1467040	how are you feeling about that?
1467040	1468580	We use this challenge scalar,
1468580	1470480	do some crazy stuff, and
1471300	1473120	three inner product arguments.
1474400	1475120	Alright.
1476100	1478080	And then, we do it again.
1478820	1479720	Now, we take
1479900	1481600	a random talent scalar, Z,
1481600	1483420	and our
1483960	1485400	argument, remember how I was saying
1485400	1487700	if A equals zero and B equals zero,
1487700	1489540	then, like, A plus B times
1489680	1491100	a challenge scalar X equals zero.
1491100	1492960	So, we're doing the exact same thing here.
1493260	1494220	Here, we have
1495180	1496840	B equals A sub L
1496840	1499020	inner product of two to the N, which you
1499020	1500060	can actually rewrite as
1500980	1501860	zero equals
1504340	1505500	A sub L
1505500	1507520	inner product of two to the N minus B.
1507840	1509100	And what you do is you just
1509100	1511060	multiply that by Z squared,
1511060	1512900	multiply the second thing by Z,
1512900	1515200	multiply the third thing by C to the zero.
1515880	1517080	And then, you end up with this
1517080	1519120	statement. Cool.
1519120	1521140	Now, you have one statement.
1521140	1523220	Remember how our goal is to get one statement
1523220	1525680	that is one inner product argument.
1525820	1527100	So, we're really close. We have one
1527100	1529140	statement that's three inner product arguments.
1529920	1531240	And then,
1531240	1533300	we do some
1533300	1535220	math that I'm not going to bore you
1535220	1537140	with that's basically just algebra.
1537140	1539240	You just, like, take some things apart and rearrange them.
1539240	1541240	And then, you end up with this
1541700	1542800	inner product statement
1542800	1545060	equals this thing on the right.
1545360	1547080	So, if you're curious about
1547080	1548580	what that math is,
1548580	1550620	we wrote it up here. It's really not
1550620	1552860	actually that interesting.
1553540	1555020	But, look here
1555020	1556920	on the right. This is exactly the format
1556920	1559060	that we want. We want an inner product
1559060	1561100	argument where the thing
1561100	1562880	on the left, inner product of the thing
1562880	1564880	on the right equals C.
1565040	1566900	So, we can essentially represent
1567520	1568840	we can think of
1568840	1571120	the thing before the comma as A
1571120	1573100	and the thing after the comma as B
1573100	1575420	and the thing after the equals as C.
1576440	1578040	So, to recap
1578820	1579700	we have
1579700	1580900	or, sorry, LOR
1580900	1583820	I forget the letters I used.
1583820	1585500	But, to recap, this is our journey. We started
1585500	1587680	with a range statement. We broke
1587680	1589480	it up into three separate statements that
1589480	1591580	must all be true if this range is actually
1591580	1593780	if the values are actually in range.
1593880	1595360	And then we applied these, like, random
1595360	1597700	challenge scalars such that we
1597700	1599760	could rearrange all three of these
1599760	1601820	into one inner product argument.
1601920	1603420	And that is basically in the same format
1603420	1605540	as what we wanted. T is the inner product
1605540	1607200	of LOR. And
1608020	1609540	going all the way back to the
1609540	1611220	beginning, now that it's in this inner product
1611220	1613420	argument, if and only if this
1613420	1615360	inner product is true, then the B
1615360	1617620	is in range. And we have a really efficient
1617620	1619320	way in O of all N to
1619320	1621920	prove that this inner product is true.
1622460	1623180	Cool, so it comes
1623180	1624200	full circle.
1626960	1627480	Yeah,
1627480	1629300	this is LOR of T
1629760	1631020	of inner product.
1631020	1632560	So,
1632560	1634920	before I move on to how
1634920	1636880	this is actually kind of
1636880	1638620	oversimplifying it, I want to make sure that
1638620	1641340	the simplification makes sense to everyone.
1641980	1643660	Anyone have questions?
1643960	1645080	Yes.
1646920	1648040	Yes,
1648040	1648980	for sure.
1650920	1652040	So,
1652040	1653100	so the first part
1653100	1655220	is we took this Y
1655220	1656860	and we took the Y to rewrite
1656860	1658780	each of these. So now we have
1658780	1660740	here on the right hand side,
1660740	1662640	here on the left hand side, we now have
1662640	1665120	three statements, and these three statements have to be true.
1665120	1666740	But we want some way to somehow
1666740	1668740	smush all of these three statements into
1668740	1670780	one statement. So if we're
1670780	1672920	not looking at all the annoying math,
1672920	1674440	but we just have three statements that are like
1674440	1677060	A equals 0, B equals 0, C equals 0,
1677060	1678540	and you want to represent that as just
1678540	1680600	one statement, what you can do is you can
1680600	1682500	take a random number, Z
1682500	1684260	in this case, and you can say
1685240	1686800	if A plus
1686800	1688960	B times Z plus C
1688960	1690880	times Z squared equals 0,
1690880	1692800	then with extremely high probability,
1692800	1694620	we know that all our
1694620	1696960	three individual statements, A equals 0, B equals 0,
1696960	1698680	C equals 0, those are all true.
1698680	1700540	So that's exactly what we're doing here.
1700540	1703520	We're multiplying the first thing by Z squared,
1703520	1705180	multiply the second thing by Z,
1705180	1706620	multiply the third thing by
1706620	1708120	Z to the 0, or nothing.
1709100	1710680	And then that gives us
1710680	1712680	the equation on the right. And then we just move
1712680	1714600	the Z to the end, just because
1714600	1715620	it's pretty random.
1716560	1718780	Cool, does that answer your question?
1719100	1720360	Okay, so I have one on my hand.
1720360	1720900	Yeah?
1723140	1725000	Ooh, oh man.
1725420	1726940	I was hoping that, you know,
1728140	1728940	this delta
1728940	1730520	represents all of the messy
1730520	1732960	casements that we don't actually want to write out.
1733220	1733940	And I think
1734500	1736800	if we go on to the next slide,
1736800	1738800	the same way that in the previous slide
1738800	1740780	I was like, these are things that I'm not diving into
1740780	1742620	even deeper, that's one of the things
1742620	1744420	is that delta just represents everything
1744420	1746620	that is a public knowledge. So delta
1747940	1748880	doesn't have anything
1748880	1750540	that's secret in it. The proof and the
1750540	1752480	verifier both know what's in delta.
1752480	1754420	And that's why we can just abstract it into this delta
1754420	1756820	nice thing.
1757460	1758400	Because it doesn't
1758400	1760940	contain anything too important or too secret.
1761420	1762940	Cool, any other questions?
1764240	1764700	Alright,
1764700	1767560	so that's a good segue into the next section,
1767560	1768560	which is that
1770040	1770860	as you might
1770860	1772780	notice, A sub L
1772780	1774320	minus Z on the
1775300	1777260	left-hand side of the product,
1777260	1778820	if you were just to send it to the
1780860	1781660	verifier,
1781660	1782880	the verifier would just learn
1782880	1784860	when your A sub L is, and then be like
1784860	1786880	oh, I knew your secret, come on.
1787300	1789500	So that's sort of silly.
1790220	1790740	And so
1790740	1792600	what we actually do in practice
1792600	1794940	is we make a commitment to
1794940	1797400	what's on the left and the right of the inner product.
1797660	1799020	And then really nice,
1799020	1800860	and then also, so like
1800860	1803020	these are things that we actually want to make commitments
1803020	1804740	to, and we will send over the
1804740	1806720	commitments instead of sending over the plain
1806720	1808060	secrets.
1808620	1809960	What does that look like?
1810760	1812640	Maybe first I should, you know,
1812640	1814480	review what commitments are.
1814480	1816840	So if you have an additively homomorphic
1816840	1819540	commitment, like I mentioned way at the beginning of the talk,
1819540	1820900	then if you have
1820900	1823320	some secrets, A plus B equals C plus C,
1823320	1824780	then your commitments will
1824780	1827100	also maintain the additive property
1827100	1829160	of those secrets. So then the commitment
1829160	1831060	of A plus the commitment of B would be equal to the
1831060	1832940	commitment of C plus the commitment of D.
1833180	1835020	And then similarly, this also extends
1835020	1836940	to multiplication by scaling.
1837260	1839980	So if you have 2 times E equals F,
1839980	1841100	then 2 times the commitment of
1841100	1842540	E equals the commitment of F.
1842540	1845000	So you don't have to worry about how this works, you can just
1845000	1846660	sort of treat this as a black box.
1846840	1848980	If you do want to learn about how this works, it's really
1848980	1850940	just a Peterson commitment, and it's really
1850940	1853000	straightforward, you're just multiplying by a group element
1853000	1855080	and adding a blind factor times
1855080	1857180	another group element that's orthogonal, it's not
1857180	1859060	that crazy, I'm also happy to dive into that
1859060	1861140	more. But if you want to
1861140	1863360	treat this as a black box, then basically
1863980	1865300	all you do is you start out
1865300	1867420	with the thing on the left of the inner product,
1867420	1869180	the thing on the right of the inner product, and the thing
1869180	1871120	on the side, and you just make commitments
1871120	1872920	to them. And if
1872920	1875120	the inner product of those
1875120	1877060	commitments is true, then
1877060	1879040	with extremely high probability, then the
1879040	1881260	secrets inside those commitments are also true.
1881680	1883200	So that's really nice,
1883200	1885260	because that's sort of the magic of an additively
1885260	1886880	homomorphic scheme.
1888200	1889200	And in practice, that's
1889200	1891200	what we do. So,
1891200	1892580	as a recap,
1894020	1894980	let's see...
1894980	1897220	Yeah, so, as a recap,
1898240	1899140	this sort of takes us
1899140	1901060	full circle, we can send over this inner
1901060	1902980	product argument without fearing that
1902980	1905080	we're revealing any secrets. So things
1905080	1906720	that I omitted are how the column
1906720	1908780	scalars are generated, how
1908780	1911080	the commitments work in detail, once again
1911080	1913080	there are some commitments, and
1913080	1915060	I also skipped over how the
1915060	1917080	values are blinded, that's
1917080	1919200	part of how the commitments work. So if you want
1919360	1921060	a deeper dive into that, I'm also happy to
1921060	1923060	talk about that, but it's okay just treating it as
1923140	1925060	a black box and being like, yes, that's
1925060	1927020	how it works. So the
1927020	1929580	end result of, you know,
1929580	1931280	we understood the paper, we implemented
1931280	1933120	it, and then
1933120	1934980	sort of, oh, I forgot to
1934980	1936880	include that it's less than one millisecond per
1937320	1939540	64-bit input verification,
1939540	1941780	and that's even without patching.
1941780	1943620	So if you were to patch, you can get multiple
1943620	1946680	verifications in even less time.
1946680	1947740	And so, yeah, that's
1947740	1948860	our numbers,
1950060	1951680	and I think that's
1951680	1953640	all of the material
1953640	1955340	that I've had for today.
1956020	1957540	I'm also happy to talk
1957540	1959580	about, you know, how we
1959580	1961360	use this and other ways to
1961360	1963800	abstract, you know, bullet groups over
1963800	1965600	arbitrary statements instead of
1965600	1967360	only over range groups.
1967360	1969260	So maybe, um, let's start with
1969260	1971480	some questions. Let's see if I have time.
1972000	1973320	Let's start with some questions
1973320	1974920	about the actual, like, math
1974920	1977220	part of this talk, and then maybe after that
1977220	1979340	I'll just take requests for
1979340	1981800	other things that we want to hear about.
1983180	1983880	Any questions
1983880	1985320	about the math? Anything
1985320	1987380	that you guys are happy to do for me? Yes.
1999550	2000430	Yes.
2000790	2002350	Great question. So the reason
2002350	2004370	that we do this, um,
2004370	2005930	well, we, meaning really, like, Benedict
2005930	2008130	who wrote the paper, um, the reason that he does this
2008130	2010470	is because then you have some really cool property
2010470	2012410	where, um,
2012410	2014030	here, you actually get
2014030	2015870	the x of the b-low
2015870	2018670	to, uh, sorry, the x that is, uh,
2018670	2020590	x inverse attached with b-low
2020590	2022730	to cancel out the x in a-low.
2022910	2024410	So, here,
2024410	2026410	let me just, like, review
2026410	2028310	how this works. So,
2028310	2030250	if you have the inner product of this
2030250	2032270	with this, what you're actually doing
2032270	2034410	is you're taking this and multiplying it
2034410	2036330	by this, and that gives you a-low
2036330	2038110	times b-low, or any a-low
2038110	2040110	product with b-low. And then here,
2040110	2042130	the x inverse here cancels out with x here,
2042130	2044850	and that gives you a-high inner product with b-high.
2044850	2046270	And so that's just a nice
2046270	2048330	sort of magic.
2048870	2050330	Um, and if you didn't have that, like,
2050330	2052370	canceling out the property, the axiom wouldn't be able to
2052930	2053730	reconstruct c
2054310	2056170	from, um, c prime.
2056870	2058190	So, good question.
2058190	2060210	Um, that is really cool.
2061470	2062390	Cool.
2062390	2064400	Any other, um,
2065030	2066510	questions about math?
2066850	2068050	Yes, hi.
2068630	2074670	Oh, yes, um,
2074670	2076890	ladies at this, so you're also
2076890	2078550	kind of blonde, but
2079190	2081210	it's, um,
2081210	2082930	sorry, I also have these slides
2082930	2085250	online if you want to just, like,
2085250	2086350	review the slides. It's
2086350	2087950	darkintangle.org.rs
2087950	2089970	slash bulletproofs. If you just go to
2089970	2091950	that, you can navigate all the notes.
2092170	2093870	Um, the distinction between
2093870	2096190	I'm so sorry, I should make the URL bigger.
2096190	2097690	Um, the distinction between doc internal
2097690	2099710	and doc, like, external,
2099710	2102270	is that the doc.doc.rs
2102270	2104030	actually gives you the API and all
2104030	2106330	the documentation for the API for how to use this,
2106330	2107990	whereas doc internal gives you an internal look
2107990	2110010	of the math, and this is a really nice thing
2110010	2111930	that we have because we made everything
2111930	2114330	in Rust. We have, like, Rust documentation for many.
2114890	2116250	Um, yeah.
2116250	2116950	Awesome.
2118030	2120130	Okay, uh, any other questions about
2120130	2122130	the math? And if not,
2122130	2124210	uh, I can take requests for things
2124210	2126010	that you would like to hear about that
2126010	2127770	are sort of above and beyond this. I can
2127770	2130250	choices of, like, what I can talk about. I have
2130250	2132310	uh, we worked a lot on constraint systems,
2132310	2134090	which is basically how to
2134090	2135990	build an arbitrary
2136450	2138150	statement and then make proof about
2138150	2140230	it. Uh, I can talk about Cloak, which is
2140230	2142070	how we build a confidential assets protocol
2142590	2144210	using all of this. I can talk about
2144210	2146310	CKBM, which is like a smart contract language
2146310	2148050	that we built on top of all this.
2148530	2150370	Anyone super excited about any of these things?
2150370	2150970	Yes.
2155380	2157180	Oh, definitely. Um, yeah, relatively
2157180	2159000	cool. Um, I don't
2159000	2160700	might have slides for it, but basically
2161260	2162740	um, the idea is
2162740	2164960	when you have a paper that says
2164960	2166940	like, the prover gives something to the
2166940	2168880	verifier. The verifier, like, does
2168880	2170840	this random challenge sampling and then gives
2171100	2172980	a challenge back. Um,
2172980	2174780	in the paper, usually they say, like,
2174780	2176960	this is an interactive coin protocol.
2177060	2178860	We naively, like, obviously just
2178860	2180620	use the fiat from your peers to make this
2180620	2182400	non-interactive. And then as an
2182400	2184120	implementer, you're like, what?
2184700	2186540	Like, how? And so Mervin
2186540	2188540	has basically a strobe-based
2188540	2190920	transcript protocol that Henry made.
2190920	2192500	Henry was one of my colleagues who helped with the
2192500	2194780	Bulletproofs implementation. We were working on, like,
2194780	2196560	how do we make this non-interactive?
2196580	2198060	And he was like, this would be a really good
2198960	2200300	use case for a library
2200300	2202620	that takes care of all of that for you.
2202620	2204500	In practice, for papers, when you
2204500	2206640	implement the fiat from your peers thing,
2206640	2208420	a lot of times people just hash the things that the
2208420	2210600	prover gives to the verifier. You're like, we just
2210600	2212640	hash this, and then we take the challenge
2212640	2214720	from it, and then we use the challenge.
2214720	2216580	So just, sorry, here's
2216580	2217380	an example.
2218560	2221020	If you wanted to take a challenge, like, here,
2221020	2222660	for instance, x, like, where does this x come
2222660	2224260	from? And a lot of times,
2224760	2226760	a lot of the time people just, like, take,
2226760	2228860	for example, the vector a
2228860	2230640	and hash it into the vector b and hash it
2230640	2233140	into the vector y somehow, and get the challenge x.
2233140	2234400	But this is sort of
2234860	2236560	easy to misuse, or
2236560	2238440	easy to get a little bit wrong,
2238440	2240320	and also really complicated
2240320	2242340	if you're doing multiple rounds of this.
2242420	2244660	And so that's why Henry made Merlin, which is
2245060	2246660	effectively a black box, where you're like,
2246660	2248560	I put my randomness in here. I don't have to worry
2248560	2250540	about the clouds behind the scenes, and I get some
2250540	2252300	randomness back that I have guarantees
2252300	2254760	about that it's actually fully random,
2254760	2256360	that it's domain separated,
2256360	2258560	you don't have, like, hash collisions,
2258560	2259360	things like that.
2259360	2262400	So that's actually,
2262400	2264320	and so that's where we get x from. We actually use
2264320	2266520	the Merlin transcripts
2266520	2268300	to get x, to get the y, to get the z
2268300	2270360	for all of these random challenge scalars.
2271620	2272220	Yeah.
2272840	2274420	Anything else? Anyone want
2274420	2276500	to hear about any other things? I could also be
2276500	2277200	done.
2279380	2280560	Way more. Okay.
2281260	2282000	I think the
2282700	2283460	coolest thing
2284480	2286440	that we built on top of this
2286440	2288520	is the cloak protocol.
2288520	2290400	So let me just pull up my slides
2290400	2292780	for that. Sorry.
2292940	2306310	All right.
2306310	2306490	So
2307490	2311350	I guess maybe to back up,
2311350	2311510	so
2311510	2313550	Bulletproof is not just a
2313550	2316150	range-proof protocol, it's
2316150	2317390	a, they call it in the paper,
2317390	2319590	they call it circuit-proof protocol
2319590	2322030	as well, where you can take any arbitrary
2322030	2323690	arithmetic circuit and then make a proof
2323690	2325150	that it is correct over some inputs while
2325150	2326650	keeping those inputs secret.
2326730	2329350	It turns out that coding up arithmetic circuits
2329350	2331090	is like a huge pain,
2331090	2332810	and so we actually just changed the representation
2332810	2334770	to a constraint system.
2334810	2336710	They're really easily translatable
2336710	2339090	from one to the next, but constraints are a little
2339090	2341070	bit easier to talk about. So you have a multiplicative
2341070	2342810	constraint, which is you have
2342810	2344850	three variables, and you have
2344850	2347010	the additional constraint that x times y
2347010	2349250	equals z for each of those secret variables.
2349250	2350850	And you also have a linear constraint,
2350850	2352890	which is like some linear combination
2352890	2355550	of secret variables with clear text weights.
2355550	2356850	So these are like the tools
2356850	2358710	that you have with which to build up this constraint
2358710	2359710	system.
2360910	2362790	And with a constraint system,
2362790	2364870	you can actually represent anything that is
2364870	2366890	efficiently verifiable. So by this,
2366890	2368710	I mean any NP-complete program
2368710	2370270	can be, you know,
2370890	2373010	changed into or represented as a
2373010	2375110	constraint system. So that's pretty
2375110	2376950	nice.
2376950	2379090	Fun side note is that the extension
2379090	2380690	that my colleague, Oleg, made over
2380690	2382010	this constraint system protocol
2383690	2384810	actually broadens
2384810	2385950	the things that you can represent
2386690	2388630	from NP-complete to
2389210	2390730	PSPACE. So like if
2390730	2392610	you're a theory
2392610	2394850	nerd, that's like free fun.
2394850	2396970	But if you're not, it doesn't matter.
2397910	2398470	So
2398470	2400630	you can represent basically any program
2400630	2402630	you want as a constraint system.
2402630	2404770	So what we wanted to do was to make
2404910	2406630	a confidential assets protocol.
2406790	2408570	And confidential assets is
2409290	2410730	a lot harder to make than a confidential
2410730	2412490	transaction protocol because you want to keep
2412490	2414850	the asset types secret.
2415350	2416450	And so like, my idea
2416450	2418390	is you're just like, I want to add together
2418390	2420630	all the sums of all the different
2420630	2422610	asset types. Then you have to specify
2422610	2424490	which assets are the same, and that would reveal
2424490	2426010	which assets are which
2426590	2428130	over enough analysis.
2428490	2430470	So you can't just sort of sum together things
2430470	2432770	the same way that you do for confidential transactions
2432770	2434130	with one asset type.
2434350	2436550	So what we came up with was
2436550	2438570	sort of multiple gadgets that we
2438570	2440430	composed together. So
2440430	2442910	on the right hand side we have a
2442910	2444990	range gadget, that's what we call it,
2444990	2447070	which is a collection of constraints
2447070	2449370	that basically make sure that the variables
2449370	2450760	in the constraint system
2451110	2453130	are in range.
2453130	2455010	And then we add some new ones.
2455750	2456790	So a shuffle gadget
2456790	2458820	is basically a collection of constraints
2459210	2460890	that make sure that the inputs
2460890	2463430	and the outputs are validly ordering over each other.
2463430	2464770	So you can't just introduce a new input
2464770	2466870	and introduce a new output. Then the shuffle
2466870	2468710	gadget would fail.
2468850	2470690	And then there's a merge gadget, which
2470690	2472790	either merges two inputs into
2472790	2474650	one, or just moves them without
2474650	2476690	altering. Same with split.
2476690	2478730	Split either splits one item
2478730	2481010	into two, or it moves
2481010	2482650	the two inputs into the two outputs without
2482650	2484210	altering it at all.
2484490	2486930	So, I guess
2486930	2488750	before I jump into
2488750	2491090	how this is all assembled,
2491090	2492690	intuitively, if you're dealing
2492690	2494330	with multiple assets and you want
2494330	2496230	to have some way to prove that
2496230	2497990	your input to this protocol
2497990	2500430	and your output to this protocol are valid,
2500430	2502430	you want to prove that your inputs have been
2502430	2504250	rearranged in such a way that
2504250	2505630	the asset types are preserved
2506910	2508110	but without creating
2508110	2509770	or destroying value.
2510030	2512090	So this is really tricky because you can't
2512090	2514130	actually reveal what asset groupings
2514130	2516450	you have. So this is like a
2516450	2518150	fine, it took us a while
2518150	2520090	to come up with this solution. But what it
2520090	2521010	does is basically
2521010	2524050	we group these gadgets together
2524050	2525390	such that any
2526090	2527990	output reordering is a valid
2527990	2529930	actual transaction
2529930	2531590	output reordering that
2531590	2533910	of the inputs should be able to
2533910	2536230	satisfy this collection of gadgets.
2536610	2537930	Let me walk you through why
2537930	2540710	this is the case, or how you actually prove this.
2541130	2542050	So suppose
2542050	2544050	that your inputs are $5, 3 yen
2544050	2545890	and $4. What you
2545890	2547790	as a prover would do, since you have
2547870	2549530	a lot of secrets, you would
2549530	2551770	look at this and be like, okay, well I know that
2551770	2553730	I have to group all of my
2553730	2555850	assets of the same kind together
2555850	2557650	into the same chunks.
2557650	2559690	So you would use the shuffle to reorder this
2559690	2561790	such that your dollar amounts are together and your
2561790	2563390	yen is at the very end.
2564350	2565770	Then you will merge
2565770	2567770	your dollar amounts into one lump sum
2568170	2569630	and you'll merge again.
2569630	2571090	Well, you will, because you only have one.
2571410	2573450	And then you shuffle it such that your
2573450	2575590	non-zero values are at the very top of the shuffle
2575590	2577150	for each asset type.
2577610	2579610	And then, this is the part that's like, hopefully
2579610	2581650	the intuition, is that you're going to split
2581650	2583470	your lump sum into whatever
2583470	2585470	your target amounts are. So here
2585470	2587450	I offer target amounts of 3 yen, 6 dollars
2587450	2589650	and 3 dollars, so you'll take your 9 dollars and split it
2589650	2591290	into 6 dollars and 3 dollars.
2591450	2594050	And then you'll be able to go down the coast. It's just one output.
2594670	2595630	And then, just to
2595630	2597610	preserve the randomness of your output, you'll shuffle
2597610	2599590	it one more time. You'll apply
2599870	2601570	a range check
2601570	2603890	to it to make sure that none of these are negative.
2603890	2605310	And then you get your outputs.
2605610	2607910	And so, if your
2607910	2609870	outputs are valid, then you should be able to do this
2609870	2611830	successfully. If your outputs are not
2611830	2613750	valid, suppose that one of your outputs you wanted to
2613750	2615810	make it 100 dollars, you would
2615810	2617890	not actually be able to correctly satisfy
2617890	2620150	all these guys. One of these guys would be like,
2620150	2622030	wait, where did this extra money come from?
2622030	2624370	Like, this is not a valid constraint of satisfaction.
2624670	2625970	So this is the intuition
2625970	2627710	for how it works. And then
2627710	2630030	for a verifier, the verifier actually
2630030	2632030	only receives these commitments to the input
2632030	2633990	and commitments to the outputs. And it
2633990	2636150	can't tell what happened within
2636150	2637830	each of the gadgets because all of it are just
2637830	2640110	like commitments to the verifier. But all
2640110	2642030	it can do is verify that, yes indeed,
2642030	2643850	this proof succeeded or this proof
2643850	2645710	failed. And then, you know,
2645710	2647210	valid and invalid transaction.
2647970	2650570	So that's the intuition for Cloak.
2650590	2652130	And I think the important
2652130	2654050	thing to illustrate here is that this is just one
2654050	2655810	of many uses for the
2655810	2658350	Bulletproof Constraint System API that you can come up with.
2658350	2659910	We just sort of made this by hand after
2659910	2662030	figuring out what would make sense as a way
2662030	2663770	to build it. And anyone else can
2663770	2665830	basically make their own protocols and
2665830	2667990	proofs as well. So that's
2667990	2669350	cool. That's my little
2669350	2671990	I think I'm out of time. Do I
2671990	2674050	have time for questions maybe? Or should I just...
2674690	2675930	Alright, any questions about
2675930	2677090	the last bit?
2677790	2678670	Yes.
2684690	2686390	Yeah, so here at the very end
2686390	2688530	we have a range check. And so basically
2688530	2690070	the output of the third shuffle
2690070	2692430	right here is 3 yen, 6 dollars
2692430	2694470	and 3 dollars, right? And we just want to
2694470	2696590	add a range check that all of those values
2696590	2698490	are between 0 and 2 to the n for some
2698490	2700570	large amount. For example, if we wanted
2700570	2702410	to maliciously make a $100
2702410	2704470	output, then we
2704470	2706410	would basically end up with shuffle 3 and
2706410	2708310	we'd want to somehow make $100
2708310	2710490	as one of the outputs and then
2711530	2713010	negative... math is hard...
2713010	2714650	negative 92, something...
2714650	2716450	another negative number. But then
2716450	2718350	that would fail the range check. So basically the range check
2718350	2721010	makes sure that we can't make extra money.
2721010	2723550	Sorry. You can ask more questions afterwards.
2723550	2725250	I'm going to cut off. Thank you for all of your
2725250	2725670	attention.
