Özgür Armanc Yiğit - Elliptic Curves
EthereumZuri.ch 2024 · April 2024 · 14:49
Özgür Armanc Yiğit explains the mathematics behind zero-knowledge proofs, covering elliptic curves, finite fields, group operations and scalar multiplication. At EthereumZuri.ch 2024, the talk shows why these operations are used when calculating ZK proofs, how an elliptic curve and the field that restricts it are chosen, and how deep an aspiring zero-knowledge engineer needs to go into the underlying maths.
Speakers
Topics
From EthereumZuri.ch 2024, hosted by EthereumZuri.ch.
Transcript
so yeah AP curse uh yeah there is the QR code if you want to scan it and there's my gtop as well I'm I'm not too active right now but uh yeah we just started a new project we can chat it about it later uh it's a cool project as well um so yeah let's start AP curves so AP curse is a very important crypto cryptographic tool that we use when we calculate uh cryptographic things or calculations on cryptography uh because they provide you a group uh and discrete logorithm uh is very hard when you use these uh groups when you
calculate your uh when you do calculations so we rust form um is one of the most common forms that we use when we build our tic curves as you can see here there's a special formula for that um when you put uh numbers to A and B you will get different kind of eptic Curves but of course there's a one special case you you have to be careful about the the singularities because if you for example put uh zero to a and b you will get something we called as cusp or I don't know is it the correct way to spell it yeah cusp uh and this is uh this is something that we don't want
because there's a a a point that that has two same tangent lines uh I will talk about the tangent lines that why we are carrying this two much uh you will see uh in the next few slots uh the uh slides sorry uh and if you have a but the the something special that satisfies this function you will get that we call something that we call node and you will have a point that has two different tangent line uh directions and it's also that something that we don't want so you have to be careful about this and after eliptic curves we can talk about what we what is
field uh and field is very important because we are constructing our elliptic curve over the finite Fields so yeah finite field is a also very uh fundamental component that we use in cryptography um it's it has two binary operators addition and multiplication and for example field for for a good field example we can say real numbers R is a very good and if you restrict it in a mod modulus mod sorry you will get finite field uh then you can put your that equation uh your elliptic curve on this uh you can
restrict your elliptic curves with this finite field you will get something like this for example uh so this can be a little bit confusing at first but here is for example our mod is 19 and you can get at most 18 on an example elliptic curve so these points are your elements when you use this elliptic curve over this finite field if you increase your size for example this is 97 this is 27 mod uh you will get more and more points so this is something we want you have to choose very big uh mod to uh make your discrete logarithm harder or actually make the the try and find method little
bit harder so people can try these every number to find your secret or uh whatever calculated whatever you calculate it will be very easy that's why we have to pick very big number and you have to pick prime number because if you don't pick a prime number for this uh for example um in your field some numbers will have no multiplicative inverse so it's a bad thing we we we want every number to have multiplicative inverse in in our calculations for example if you have modul of 4 uh you won't have any multiplicative inverse for two that will be no solution for a equation so we don't want this um yeah these points are our results like our uh results on eptic
curve and we call if we pick them as a set we will uh get a group if it satisfies five these five facts uh these five properties we will call them as a group so what's a group yeah it has only one binary operator which we call addition uh and this addition have have has to satisfy the closure method the the closure which says that A and B are members of the set a plus b is also has to be in the set right associativity I don't know it's hard to spell uh a plus b plus C should be equal to a plus b plus C and identity we want an element
that we uh show as zero here A Plus 0 should equal to a and inverse says that you have to have inverse for every element that you when you add two of them you have to get uh identity element and commutativity says that a plus b should be B plus a so if you have a set and if your uh set um satisfies these five properties you will get a group it's a special type of set so yeah so these are for example p q uh are our results that when we restrict our elliptic curve we will get
some results I showed you if you remember with dots so for example p is a result and Q is a result of this or sorry point of this elliptic curve and if we want to add these two points we have to draw a line on the elliptic curve and the third intersection point will be our result but we have to take mirror like the uh negate of it on the Y AIS uh sorry x- axis so you you will sorry why yeah you you will have like minus r is your result so plus P plus plus Q is equal to minus r So This Is How We Do addition and what if you want to for example uh double your double
your point so Q Plus Q so you you have to take tangent of your uh point and just look for the the the intersection point and again you have to take the negate of it on the y- axis so Q + Q is equal to minus p So This Is How We Do Double operation or addition to itself and yeah there is there's a case if you want to add P to its negate which is you know minus P or we show it here as Q you will get zero there's no intersection point on this curve so we call it as zero point at Infinity so um here the the the the
fourth thing that you can do on elliptic curve is if if your p is point at Infinity which we call as zero um you can add P to p and you will get point at Infinity again so it will be zero yeah so yeah there is uh so we talked about for example Q + Q so or p + p is equal to 2 p right if you add one more P you will get 3 p one more P you will get 4 P so there is something uh like something more than P right you you have four five six you have some scholar numbers that we are talking about here and we have something
um um something some good algorithm to calculate this five piece 10 piece or I don't know millions of piece uh you can calculate it very easily we will call this scolar multiplication but technically it's just addition in a in a very good uh way in a good algorithm so for example if we want to add 11 P sorry calculate 11 P we have to convert our 11 to binaries and then if the the rightmost is one we say okay take your p and multip multiply it with 2 over Z then if your second one is one as well your second bit is one as well you say
okay take your p and double it and add to your P so you will get three p right and then you take your 2p and double it again you will get 4 P but the next bit is zero so we say no don't add this and for the next one you get you take your 4p and double it again you will get 8p and you can if you have one here we have one you can add to your 3p which you will get 11 P at the end and this uh scolar multiplication this scolar numbers gives us a new field which we call a scholar field and if the the this Fields modu is uh Prime Q we will we
call this as fq yeah is little bit messy but here's fq um yeah this add and double is very special algorithm you will see in every calculations in elliptic curves um so yeah let's talk about ZK proofs a little bit um so basically if you are attending to these events a lot you will see uh ZK you will hear ZK I think a lot um it's I will just mention it uh very briefly like it's say it's a proof that you don't have to give any information to your verifier uh actually you have to give but it's nothing compared to you
know your information it will be very little and uh verifier should shouldn't be able to uh get your Secret by given this uh uh given this uh variables or values so it it allows you to prove something without giving any data to your verifier it's a very cool method to do uh you can say that okay I know this the solution of this for example puzzle or circuit and the other one won't ask you the verifier won't ask you to for a result they will just believe you because of this proof without seeing any you know solution so yeah it's a very cool method it's little bit I think old now we can say
right uh compared to to the the field that we are in um but you will hear a lot about this so it has some um criterias that you have to satisfy for example completeness it says that if your input is valid uh your result be will be valid for 100% like not 100% but it's really really small chance to do something uh weird in these fields because the fields that we are inside is one over like think about 1 over two sorry 1 over 2 to the 256 so I guess it's like 10 to 80 something like that and I checked it I don't know if
it's that correct but I think in the universe it's the the same number very close numbers in the the the atom side atom numbers in our universe so it's it will be very hard to you to pick some random atom and say okay this is the uh this is your secret or this is your solution right it will be very hard for calculation so it's very important for the completeness if your input is valid the result will be uh valid as well it will always return true sness means that if you have inval input if you want to trick someone with your inval input you cannot create a valid proof right your uh your result always will be false but as I told it's theoretically impossible
because there's a little chance but it's yeah it's impossible to get I guess right now for zero knowledge means that you don't have to give any information so that what makes it zero knowledge um the verifier won't know your uh witness values so yeah what what is witness value so this is a kind of elements that we uh I think use in zero knowledge we call this as witness witness is your secret information that you don't want to share with your verifier so if verifier knows that um everyone knows your solution right so we call this as witness we have challenge uh you will hear this a lot I guess like in the the
crypto field there's always challenge if you are not using snarks or like you have to communicate with your uh verifier to get your challenge give them response back response is your response to this challenge challenge like a random number he will give that okay calculate this if you have the correct witness values you have to calculate correct result so he will give you several different challenges and he will check if you're or he or she will check your response uh and if it's correct uh then they they will accept it so this is the zero knowledge in a I think fast way to explain and thanks for listening I
guess yeah thank you very very much Ura um my duty is to ask the audience if you've got any questions um so far then I can walk up to you any questions on ZK thanks very much it was very nice um questions questions nobody dares to ask it was very complex but it was very important maybe I am very good you know explaining to okay everyone understand me sir um I think that that if you don't have or don't thereare to ask a question then you can reach usar outside any yeah we can talk about ZK ZK proofs calculations I'm okay to it I can tell tell about my
new project ZK Pro I'm okay with it yeah okay so let's give a round of applause toar and elliptic curve thanks very much