New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Scroll Technical Workshop - Wisdom Ogwu

Web3BridgeWed, Oct 9, 2024, 12:00 AM

Transcript

okay guys um my name is wisdom I am a senior ZK engineer at scroll um working on the Next Generation PR for scroll um today I'm going to be talking about secret sharing and we're going to use this as a way to explore the power of polom it's going to be very simple po interactive not too complex so don't worry about it um so we'll start with the problem and then we'll try and solve this problem and through that we're going to learn a lot of things about polinomial and how we can do some really interesting stuff with them so um just you know if you guys are tired just wake up a bit and then um let's pay some attention okay cool I remember you guys from yesterday so we have seven individuals seven seven guys living in the same house then we have a single deposit box so every morning each of them they save let's say ,000 every morning okay so this is like a community pool of cash then the question is how should they spend this money how would they coordinate on spending this money um they have a requirement M which is basically that in order to withdraw from this box you need to imput a code so once you put in the code the Box will open you can pull out money and you can spend it or whatever now the desired situation is that four of them have to agree in order to spend from that box okay so one person cannot just go and say oh let me go and pull out all the money I want to go and buy pizza or something it has to be something that the group as a whole has agreed that okay this is what spending money on so at least four people must agree before a withdrawal can occur does the problem make sense so the question is how can this be done does anyone have any idea on how this could potentially be done set it down okay so something similar to Mor yeah exactly yeah NPC something similar to NPC so you guys have said some of the applications of what I'm about to talk about which is like this is more like a foundational um element and then it was buil on top of that so someone could assume that this could be a potential solution right you give everybody the code to the withdrawal box but obviously this doesn't work right because of anybody can just go to the box and put in the code and then carry everything exactly so this does not this doesn't work so the problem with this is that it doesn't stop the minority from being able to withdraw from the box but obviously if four people go there one person has the code right so they can open it so the happy part is good but the um minority part is is not good so what's another solution we could break up the code into um different parts yeah so let's say the code was 1 2 3 4 5 6 7 8 we could give the first person 1 3 then 27 5 6 481 5 2 6 37 so a single person doesn't have enough to open the box but then let's assume that 1 2 3 and four come together now one is there two is there three is there four is there 5 6 7 8 right so they have enough to reconstruct the secret and open up the box does this make sense okay cool now we can also see 4 5 6 7 8 they have 1 2 3 4 5 6 7 and eight so they can still open it this makes sense but now what if we had 2 3 4 and five coming together we'll notice a problem we have one we have two but we have no three okay we have four five 6 7 and8 so this solution kind of works but it's not like complete but there's even a bigger problem here I'm sure that you can come up with an algorithm that can efficiently like send or set the shares so that every combination of four will always have something but one thing you can notice is what if one two three came together they're not four right they are three if they came together they will start to see like the partial Secret so 1 2 3 there's no four 5 6 7 there's no eight so all they missing is just two slots now they can Brute Force those two values in order to get the code that will actually open it so the work is easier when three people come together but what we want is we don't want a situation whereby if you're not complete you should not learn anything about the secrets basically so if one person is there and if three people are there the people that the ones that have three should not have any advantage over the person that has one or over the person that has none okay so um you should not it should not be easy to Brute Force the more people are together so um some some of them would not have um when in this example when we combine three 2 3 4 5 they couldn't get the secret so that's the first problem then the second problem is that it leaks information about the secret basically making it easy to attack by a strong enough minority does this make sense so far cool so now let's look at points and curves so this is this is where where we're going to find the solution essentially so I don't know if you guys have done graphs I think everybody here should have done graphs at least but even though um we'll go over it so this is the x axis this is the y axis now this is a point 0a three so 0 represents X that's here and three represents y That's here okay so that's how we specify this point here 0a 3 then the question is how many straight lines can we pass through this point is it just one is it just two so um yes we can pass one straight line right but then we can also pass another straight line the point didn't change right still same point two straight lines are passing them but then we can pass the third one we can pass as many as we want right so through that straight line we can pass an infinite number of through that single point we can pass an infinite number of straight lines okay so that means that a single point is not enough to specify a particular straight line right this is not enough information for us to pick a particular straight line now let us add another Point okay so we have 03 and we have 25 how many straight lines can pass through this now yes it must pass through both points just one so that's a straight line can we pass another straight line through those two point no exactly why because of in order to these two points are fixed if you move this line slightly left or right it's going to unfix that other point right so because of we had two points and the line is passing through both of them it's just impossible to move the line so what does this tell us it tells us that two points are enough to uniquely specify a straight line so you can think of a straight line as having a name right and you can call that straight line by its name so the way to call the straight line by its name is by calling two points that that straight line passes through so every time anybody hears those two points they know that oh it's this particular straight line that we're talking about as opposed to before where we had just one point and there are a lot of straight line that share that maybe first name or share that name or something so everything makes sense now on this same straight line this is the exact same straight line we had before we have a series of points on it an infinite number of points on it the cool thing is that we can pick any other two and it will still specify this particular straight line so a unique straight line has multiple names essentially right but then only it shares that name those names does that make sense so now I'm picking two more points from it minus 2 comma 1 and 1A 4 from the same straight line now if I start with this two points I can draw a straight line through it this straight line is the same straight line as the other one one we got from 03 and 25 okay so we have been able to get the same straight line from two different points so basically the straight line has two different names that we could have that we used to call it and I'm showing you now that 03 and um 25 still stays on that same straight line just to prove that is exactly the same straight line so what have we learned every straight line is unique okay is unique it's it's they don't share two straight lines are not the same and then um to identify a straight line we need at least two points okay so given those two points we can uniquely identify that straight line and um giving any two points on that line we can draw back that same straight line does this make sense cool so let's use this to share a secret like let's try and apply this to share a secret so let's reduce the problem a bit now asum we have four individuals in the house we still have one deposit box and the withdrawal code is 2356 but then we want two individuals in the house to agree before you can spend okay does the problem makes sense cool so how do we do this using the straight line does anyone have any idea like we have all the ingredients needed to construct a way to share it do you have one okay uhuh M mhm yeah exactly so you are on the right track so let's let's see how to do this so we want to give four shares right to four individuals and if two individuals come with their shares we should be able to get back this 2 3 5 six that is the goal so how do we do this the first step is to encode the secret which is the code as a point on the graph so our code is 2356 we encode it this way so we we put a0 comma 2356 so this is our secret now we have the requirement that two persons must be present before we can get it and what line and is a line basically that requires two points in order to construct it so a line fits this problem really well so what we do is that we just draw a random line through that point any line essentially just draw a random line to that point so we can imagine that this is the this is the random line that I drew through the point now we want to generate four shares so from this line we're going to pick four other points that rest on this line because of Any to will be able to reconstruct this line so the only the only requirement is that you don't give the secrets right it doesn't make sense to give someone like 0 comma 2356 because you're are basically giving the code so you need to give everything other than that particular point exactly so we can imagine that um the first person gets that second person gets this next person gets this and next person gets this except for the secrets so the secret is still hidden so these are the shares first person gets the minus 3,000 blah blah blah then that's the fourth person on so now a single person here cannot reconstruct the line right on their own because of they just have a point and we show that there are a lot of straight lines that can pass through that point so there's no way that they will be able to get that exact straight line that has that secret there but then if any two come together they have two points in order to construct one straight line and then you can now check okay that line what is it value at zero so when you check the value at zero you get the secret so that is how any two persons can come together to basically get the secret to withdraw any question so far cool that means everybody's understanding okay so to recover the the secret we need to make sure that two Shares are present then we draw the exact same straight line through those two points and then we evaluate the straight line at zero and that basically gives us the the secret so does that make sense so we know how to share a secret such that any two persons can recover it but then what if we wanted three persons to recover it not just two right you know in our original example we needed four not um not two but let's build three and then I will generalize it so that we can see um how to do it for a larger domain so um we use a straight line a straight line had this unique property that it can be uniquely defined with two points so the next thing we want is a curve that has a unique propery that it can be uniquely defined with three points that's the idea that curve is basically a quadratic curve okay so if you see this curve I'm only using two points right now here and here I want to show you that two points are not enough to uniquely describe a quadratic curve two points were enough to describe a straight line but they are not enough to describe a quadratic C and the way I show that is by showing another quadratic curve that passes through those two points can you see this so this is another curve that passes through those two points so it's here and here so does that make sense it's like the straight line being able we had an infinite number of straight lines that could pass through one point we have an infinite number of quadratic curves that can pass through two points so to make it unique we need to specify three points so this is now the general formula for how we do like secret sharing so we determine how many shares need to be present okay so 3 4 seven whatever and then given that we identify a polinomial that requires those number of shares in order to um be uniquely defined then we set the secrets to be zero comma secret on the graph we then draw a random version of that polom you know in the initial case case we draw a random straight line we could draw a random quadratic curve we could draw a random cubic curve all depends on the threshold then once we have done that we can now pick as many shares as we need from that polinomial and then give it out to the different parties so when the required number come together then they can reconstruct the curve and you just check the value at zero and that's basically your secret doesn't make sense any questions cool so a very interesting application of this is imagine you had your private key right normally you store your private key somewhere safe maybe you write it down or you store it in a hardware wallet but usually your private key is usually in one one location right you're storing your secret in one point of failure so if someone should get access to where you have stored your secrets they basically have access to your your private key what you could do is you could convert your private key into shares the same way we converted that code into shares you convert your private key into shares multiple shares maybe like five shares or six shares your private key or seat phrase yes so you could do either but this is a general method for splitting up some information all right so you split it up into five different shares and then there's this really cool thing you could do where you could um store information in pictures I don't know if you guys have heard of this like there is a way to store information into pictures so one really nice thing you could do is you could take your private key split it into five shares then convert each of those shares into your picture so you have your picture you combine it in there and then you could literally just post it on like social media or something like you could post on Twitter you could you could send it to your friend you could do whatever and then you have your threshold right like as long as you can recover three pictures or two pictures you can extract the share from it and then you can draw the line and basically get your Original Seed phrase from there so this is now like converting a secret this is converting a secret into making a secret open essentially like your secret is literally hiding in play side and you can do some really crazy things with this because of you could add a password like right now you know we put our secret at Zer comma secret everybody knows is at zero comma secret so if someone knows you're doing this they'll pull your pictures they will construct the straight line and then go and evaluate at zero but who says it has to be at zero right you could literally put your secret at any value of x how would they know which value of x you put it there so that serves as a password kind of right you just choose a random value let's say 1,648 comma secret and then nobody is going to know that the only way they're going to be able to know that is if they like Brute Force but as they brute forcing how would they know which one is valid which one is the seed phrase so this is like something really interesting that one could do with this um another thing that could be explored is like creating shares that worth more than others so you could have like a that house scenario where you have seven people and then you needed four there might be someone that contributes a lot more right so you want that person's share to have a lot more power than other people so that person only needs one other person other people need four so you could have something similar so these are really interesting directions that any curious folks here can decide to explore I'm always on the lookout for like really smart people so please reach out to me if um things like this sound really interesting to you um we also have like so I don't know you saw Francis today where I was talking about ZK so it is me and Francis that are running that ZK story group and um if if you guys are interested in things like this we go really in depth like hardcore stuff writing code reading papers but in a you see what we did today was not that difficult right if you hear ZK you think that oh ZK is crazy ZK is too hard no we will break it down for you we'll make sure that it is really understandable and um if you are if if you haven't joined yet just just please join and um it was um yeah I think that's the end all right thank you guys that's at the beginning any questions so you can reach out to me on telegram or Twitter

Automatic transcript — names and jargon may be misspelled.