Ethereum Community Conference - Room Pain Levé
ETHCC 1 · 8 Mar 2018 · 50:52
Matthew Di Ferrante presents cryptographic approaches to smart contract privacy and scalability, using a ring signature voting contract on Ethereum as the running example. After a primer on elliptic curves and bilinear pairings, the talk shows why fully private on-chain voting is costly in gas and data size while fully scalable designs give up privacy, then sketches a hybrid approach that keeps much of both. It closes with audience questions on Sybil resistance, off-chain computation and BLS signature compaction for DAO style voting.
Speakers
Topics
From ETHCC 1, hosted by Ethereum France.
Transcript
Okay. Hello? Testing testing? Hey! Time to for the talk to start. Everybody be quiet. Alright. Cool. Thanks for coming to uh this talk. This one uh it's cryptographic. I think this was in the uh privacy track, but I've also mixed in some scalability stuff as well. Um it's it's a bit crypto heavy.
I mean uh some somewhat math heavy, so uh I'll try to go slowly through those examples and uh if you don't if you start to zone out, uh just really listen to the points where I say just listen to this point, because there's only a few important bits that you have to lock on to to actually get the most out of this, really. Um but yeah, so that's the that's the yeah, topic and basically I'll walk through a very simple example of doing a uh a ring signature uh contract on Ethereum for voting and show why even though there's a little bit of a trade-off between if you want it to be true uh 100% private, it's quite hard to make it scalable. If you wanted to make it 100% scalable, then you kind of lose some privacy.
So we uh I'll show a few different approaches and then uh come up with like kind of a hybrid uh model that where you can kind of get the best of the worlds. Anyway, uh it's oh, and if by the way, if you want to know the about me, I always forget about this part. It's uh so I'm Matthew DiFrante, I uh I do some security and cryptography at the Ethereum Foundation, um help on some of the protocol stuff, and besides that, I also run my own firm, ZK Labs, which you can see the site in the domain, the email domain there, which is uh a smart contract uh auditing firm, and also I do some crypto development there as well. Cool.
So the overview. Um we'll go through the motivation, you know, what what uh sort of brought me to this talk, uh what brought brings me to this kind of research in general. Um I'll go I'll a big part of this talk is gonna be uh elliptic curve refresher and a slight overview of bilinear pairings, because without that it doesn't make sense. I mean, the rest of the talk is what would mostly be just statements. So and then we go through a naive on-chain voting scheme, you know, say uh you know, if we're ever gonna do e-voting on the blockchain or we're not all those other blockchains that like to do on-chain governments or whatever, you know, uh like uh projects like Aragon, who uh have company governance on the blockchain, you know, you ever they all kind of need this on-chain voting these on-chain voting schemes, and so I'll I'll go through like a uh an attempt to make those voting schemes somewhat private, such that if I vote for an outcome, you don't know that I voted for the outcome, but you know that someone eligible to vote voted, right?
Um and I'll show you know, I'll show the bottom line if you run into that, and then we'll all uh go into a very very high-level overview. Well, I mean it's high-level and a little over the same time, but you know, we'll go through it uh on how to make that a bit more scalable. So some of the uh the motivations for the for the talk and just research in general is Ethereum is great for trustless applications, but if you do things naively, uh saying like uh if you just write a normal smart contract, if you don't uh if you're not really aware of the cryptographic primitives are at offer, um it's the privacy is not great, I mean pretty much non-existent, and uh the gas cost is is astronomical if you were thinking about uh like if you ever wanted to do a blockchain uh like um state-al voting on the blockchain, like for an election, right?
Those are usually millions of people. Can you if you can imagine that uh uh normal elliptic curve signatures are 64 bytes per signature, you multiply that by the amount of it at the very least, right? Without even including the message, if you multiply that by 64 million for just one million uh an election with one million people, that's 64 yeah, 64 megabytes on the blockchain for each electron, and that doesn't really scale well. Um especially because that's the absolute lowest point if you're not even telling people what you're signing for at the uh you know it's actually probably uh 10 times that. So it's like gigabytes per election, and it does it wouldn't really work out.
Uh but so you know, we we the we can go through a scheme and leveraging some crypto primitives, we can alleviate some of the problems of of privacy and scalability. And also, yeah, obviously uh mostly I guess most electrons, most uh uh sensitive voting uh protocols don't want don't want to reveal the voters' preferences, right? So uh that as well, you know, you don't you don't want to do it absolutely naively because even though that might be easy to program, it's definitely not desirable. Okay, great.
Cool, works down. So um hope you can see that a bit uh it's cut off on the left there, but so I'll go through the elliptic curve primer because it's uh some of the stuff is necessary to understand the uh stuff later on. But uh elliptic curves have some special properties that are useful for general crypto systems, and if you're not aware of elliptic curves, uh I mean I I guess most people at blockchain conference should be aware of them by now, but um if you only know of them by name, basically elliptic curves are the uh modern uh version of RSA, right? They are a public key crypto system, um which has uh yeah, you know, has it's it's it's asymmetric where the key to encrypt is not the same as the key to decrypt and and so vice versa.
Uh so you know the when you make an Ethereum address and you sign a transaction, that's that's done through elliptic curves. You know, uh Bitcoin, Ethereum, and most of the cryptocurrencies use elliptic curves. Um, you know, most of them use this this one specific curve, which is uh sec P256K1, uh, you know, Bitcoin's original curve. And it's I it's also kind of one of the things that made uh blockchains possible in the first place. I mean, besides the uh public key crypto system stuff, um, if you wanted to use RSA for the blockchain for private public key signatures, it would be ridiculous. They uh the key sizes for RSA for the same level of security are something like 20 to 40 times larger, right?
So we already have scaling problems with the quite efficient EC schemes that we have now, RSA would probably may have made this unworkable, other than much, much slower. So, anyways, the uh history aside, the elliptic curves have uh these properties which mean we can perform additions and multiplications on the public key without it's destroying its relation to the private key, right? So remember that public and private keys are really just two numbers. I mean, the private key is a number, the public key is two numbers, it's a cur it's a coordinated point, but you know you can create a morphism that maintains the group structure, and that's kind of what uh you know gives rise to all these nice zero knowledge proofs. Uh the more the extensions that with bilinear pairings gives rise to ZK SNARCs and you know there's so on and so forth.
You can do some cool stuff. Um so uh I'll just read this out. The EC security crash course, um the security in RSA is based on hardness of factoring large numbers, but the security in elliptic curves is based on the discrete logarithm problem. And so what is the discrete logarithm problem? Um it means so given given y, that is the result of a computation g to the x, right? So if g is, for example, two and x is four, that uh two to the two to the fourth power would be you know sixteen, right? And so you given sixteen 16, you say, okay, what uh what to the power of x base 2?
So sorry, taking giving taking 2, what is the exponent that gives me sixteen, right? And so on normal, uh the on the normal real number line, that's quite easy because uh exponents have an inverse. Um but on modular fields, which is you know in an RSA and elliptic curves and and fields, discrete fields in general, the definition of discrete fields, you can't inverse this because there isn't there is just not an inversion that one-to-one inversion operation, right? So in both in RSA and elliptic curves, we deal with integers on modular groups, and meaning the operations wrap around like in a clock, right? So clock arithmetic is modular arithmetic.
If I if it's 2 p.m. and I say let's meet in uh 12 hours, uh, we're not gonna meet at you know 26 p.m. at 26 whatever. We we're meeting at 2 a.m. I guess. Um yeah, and this this is basically what's uh being illustrated there in that uh simple calculation. But in uh uh in uh cryptography, these numbers are obviously gigantic. Uh they usually deal with numbers on the order of two to the two fifty-six or larger, which is you know you know, much much bigger than what your clock can keep track of. But here's uh an example in terms of uh um the like of real numbers, uh it's much smaller though.
So private keys are scalars, integers from the underlying field. And you know, here's uh I guess it's a uh it's not super uh like uh it's not a it's not a point that you'll come across as a non-cryptographer, but it it means it'll make things a little easier to understand in the later slides. The elliptic curves there are a group that is created from an underlying field, right? So you you it's kind of like uh the group, the curve or the group that uh substantiates a curve is really an emergent property of the underlying finite field. Um and so from one field you can actually make create many different elliptic curves depending on how you construct a curve, right?
Uh and you know, as I said before, you know, uh elliptic curves are uh crypto is much more uh efficient than RSA, 256-bit elliptic curve key gives you 36 3072 bit RST key security. And you know, here's uh the fun tidbit on the homomorphism or the cumulative properties. You know, if you have a private key, um x and a public key, g to the x, then the private key of the public key times the a constant k to the power of x is x times k. I mean, I know that's a bit hard to follow, just uh in spoken word, but uh it's a this is this little trick is often used for vanity generation, uh vanity address regeneration.
Like if I want a uh an Ethereum address that starts with you know one, two, three, four, five, six, seven, eight, nine, and I don't want to do the computation myself, but at the same time, if I let somebody else do that computation for me, naively, again, then they'll know my private key, right? And I I definitely don't want that. So what I can do is I can create I can take a X, right? This is this is mine and remains always secret, and I create the G to DX. And then I uh switches pub, right? And I give the public key, G dx, to an external party, and I say, um, you know, uh compute an address that has g to the x as its component um with you know one, two, three, four, five, six, seven, and every nine at the beginning.
And so he'll find uh these this third party, they will find a constant k that uh that you know um uh five like uh this should be y a bit more. Let's say k k to the y because if it's a third party, it's a different one. But uh they will find the con uh a constant k to the y that you know hashes to address one, two, three, four, five, whatever, and they won't be able to use it because they don't have the primary component, g to the x, but if they give it to me, then I can combine uh you know k to the x and g to the x together and create uh you know my my vanity address. Um so it's kind of a nice it's a nice way to outsource this specific type of computation.
Um so let's go through a concrete example of elliptic curves in the application, which is the simp this is probably the simplest uh signature scheme with elliptic curves, and it's not the one that's most used because uh this uh specific way to do it was patented. Uh the patent only expired recently, maybe I think uh now it's been maybe like a year or two. Um but you know, we we almost always use EC DSA, Ethereum uses the EC DSA, and so there's a bitcoin and so on. But this one's much easier, and now that it's not now that the patent is expired, you know, you can actually use this.
So uh the Schnorr signature provides zero knowledge proof of knowledge of the exponent. So it's a mouthful, but that's the sort of uh very precise definition. The private key is an exponent, right? As we said, as we went over before in the elliptic curve primer. Uh and uh uh the six Schnorr signature is a zero knowledge proof that I know the exponent without giving you the exponent because obviously then you know I'm giving you away the secret and use the uh that's this breaks the public key thing. Um so this means that a signature, uh a Schnorr signature is really reveals nothing at all about the private key. It does not provide any in in attacker any information but for brute force besides what they would uh be able to do with just a you know full state space search.
Um okay. And here's sort of a protocol example that says the interactive version of Schnorr. Uh the non-interactive version of Schnorr uh just has like a hash in here somewhere, but the interactive version is just a bit uh easier to follow in your head. Um so uh I'm Bob, uh the prover. I I want to prove to a you know a third party that I have the private key X, and uh Alice is the verifier, again, some sort of some third party, uh the public, whatever. And I create a witness value uh W, and I uh take my the G, uh this sort of the G in uh this is standard notation of the curves.
G is basically just uh the base, the the group generator, it's uh it's a number that's like hardcore in all software. Um so you know, we all know G is public by default. So I take a G and I and I take it to the power of W and I get a big W. So I send, and that's the blinder value, and I send Alice the larger W. And Alice already has my public key, right? So g to the X is my public key, and that's also public information. So she this was I don't know, she got it from a mailing list or something. Um so Alex uh because this is interact, this is the interactive version of uh Schnorr, Alex take picks a random number, C is just a random integer, and sends me that integer. Uh and then I so to prove that I really do have x and I'm not just generating fake proofs, I take the uh the primer for the blinded value, so the the generator for the witness, and I subtract uh c, the challenge, times x, uh modulo the the field uh well, the field modulus, and I get the response R.
And then uh Alice the quickly verifies this is a proper signature scheme, it's you know secure as as elliptic curve as anything else you're using elliptic curves. Uh Alice can check that g to the power of r times g to the power um pub the public key to the power of c is the larger value w. And what is that, why does that work? This is a here's an algebraic proof with a bit of easier to follow, perhaps uh uh uh line by line. So you can say if you remember your you uh remember uh one thing that to keep in mind when you're reading this stuff is uh elliptic curves are really can really just be abstracted away as um algebraic fields or so algebraic groups, which means that you the laws of exponentiation and multiplication addition apply just as they applied in elementary mathematics, right?
So if you expand this stuff, um you can say look, g to the r times uh pub pub public key to the power of c equals w. If you uh uh if you like uh you know um substitute the the terms, you get you know g to the w minus uh xc times g to the xc equals g to the w, right? And if you, you know, in because of the log of exponents, these two uh the x c here and the x c here cancels out, and you're basically just left with g to the w, right? Um and so that's the way the signature works if only this specific one works only if you follow this protocol in order, right?
Because if you again if you if you're spend a bit uh thinking about this, if you don't, if I'm not forced to pick the small w before I get the challenge, C, then I can pick uh I can just pick any random W to make this work, right? Like these two these two cancel out. Um so you it if you really if you plug in and pretty much any any combination of numbers here, it'll work as if you're not forced to uh do could do the commit beforehand. And you know, again, this is the non-director version, which is more what people are used to in terms of signatures.
Uh when I create a signature, I can just uh publish it to the world without having to be involved in every verification. You just use the hash to force wc casality, uh causality, because you cannot get see the result of the hash before knowing w, right? Because that's that's kind of the security that we all assume from hashes. Um I mean that's so that's this is the the simplest possible version of carriers. So we can uh we can move on now. Um so on bilinear pairings.
So the bilinear pairings um is perhaps you've read about them or or you know seen them mentioned just by name, but uh we we got uh on the Ethereum virtual machine, we manage we put in uh support and opcodes for bilinear pairing checks and operations um uh late last year, and they allow for um some interesting extensions to elliptic curves, right? And the extension being that normal elliptic curves, you can only you can if you have two elliptic curve points, you can only add the elliptic curve points together, um, but you can't multiply them. You can take a scalar, an integer, and uh raise it to an exponent.
Uh you can take you can take a point and raise it to an exponent that is a scalar, but you can't, and you can multiply obviously two scalars together, or you can multiply a point by a scalar, but you can't multiply a point by the point. Um and this kind of extends that group to make it fully complete the ultimate multiplication as well. Um yeah, as I said, it allows one extra operations, uh, the multiplication of like the curve points. It's not normally possible on non-pairing curves. And uh the reason it's not possible is that if you if you did it on the same group, then it breaks uh discrete logarithm problem, well, where this it breaks the disc uh discrete Liffie Hellman problem, which is decisional defying problem, which is kind of like why signatures work. But if if you do it in a very specific way, it allows you to do ZK snarks without breaking uh normal signatures.
So here's an example of uh uh BLS signature. So given a private key, X, message M, a hash function H, uh the signature is you know, sigma is uh the hash message run through the hash function, which is a number, right? Uh remember like always just numbers. Um actually sorry, this is uh this is hash or elliptic curve point. So you hash to a number, convert to that to elliptic curve point, and then you raise that to the X, which here's your private key, and you get a signature, right? And the verification of the signature is simply um uh you take the this is kind of a way to encode bilinear pairings points because uh kind of maybe how you can tell from the word bilinear by uh linear two, two lines, uh they are uh a bilinear curve is kind of a a pairing of two curves, right?
It's a grouping, a combination of the curves. So you take the uh bilinear point, you have you know a point from the group one, another point from the group two, and you can do this special operation that allows you to shuffle exponents outside from inside these little uh parentheses to the outside. So if we remember that um uh the signature here is just h to the mx, and I like I can see as I sort of show here, I can take uh the h to the mx and and instead of instead of keeping the x inside, I can take it outside of the parentheses, right? I can't move the x from here to here, but I can take it from so from the h to the m to the g, but I can take it outside.
And again, since um since this is uh basically the same, but the x is just on the other term, I can move it outside the parentheses and check for equivalence. And this is kind of the very, very basic first step of why it's the case narcs work and a whole bunch of other stuff. But the sh the short uh without getting into the math of why this works, um pairings pairings curves allow you to shuffle around the exponents to check for equivalences, something that could not be done on a normal elliptic curves, because if you could do this on a normal elliptic curve, then you could take the X out into a uh a base that you know the um like a factor of and and you know uh take a you know get the get the barkeeper. So here's uh I'll go through an example of uh normal uh ring signatures on normal elliptic curves, and uh and then I'll show how they differ on bilinear pairings.
Well the the the properties of this signature, um you know, the some of the some nice benefits, some not so nice, and then I'll go through a uh a version on that uh uses the properties of bilinear pairings. Anyways, so elliptic curve example, uh ring signatures, uh the uh what are they exactly? So the con uh scepter was first introduced in a paper titled How to Leak a Secret by uh some of the RSA authors. It concerns you these keys in a group instead of using them individually to prove you have a private key from the group as opposed to proving ownership of a specific key, right? If I uh if I sign normally from an Ethereum address, I'm saying you know, Ethereum address one, two, three, blah blah blah, uh it's mine, or you know, whoever signed it at that moment has has ownership of it, and here's a proof of the signature, and you know, this allows me to transact or whatever.
Uh this one is if I have a set of public keys or you know, a larger group, I can prove that I am from the group, but not prove exactly which key I correspond to. Um so you know, uh kind of like uh why they were introduced in the first place, they're useful for whistleblowing. Uh if each public key, for example, belongs to a government official, the official can leak some classified data proving that they are indeed a government official without outing um themselves uh as individually as the whistleblower. Um so you know, uh if yeah, if you're in a government party of a hundred people and and we're in some advanced government that has learned how to use computers um and you know they actually have they understand cryptography finally you know you can say it's some something dodgy is going on and in uh you know someone uh some lobbying or corruption you can say hey look uh here's a signature from one of the par parties that would be privy to this but without immediately getting themselves assassinated right because they now with n would now they know exactly who leaked it but it's just somebody from within politics right that would be a nice thing um so again the ring signatures are just one type of zero knowledge proof they prove X and only Xero knowledge proofs allow you to prove um knowledge of a secret without revealing anything about the secret so the the nice analogy I have for this class of uh properties is say if I choose a card from a deck of cards and I want to be you prove to you that it's a red card if I just show you the card it reveals more than the color it reveals the suit and number and so on basically you know everything.
And I don't want to reveal everything I just want to reel that one bit of information which is the color. But if on the other hand I just take my card aside from the deck and you know you assume that this is a deck with 24 black cards and 24 red cards and I haven't messed with the deck and if I if I take all the black cards of the outside if I take all the black cards out of the deck and I flip them up and there's no more black cards in the deck I prove that this card I set aside in red right perhaps you you unpacked the deck and so you know that I haven't thrown any random cards in. So specifically the zero knowledge proof and rigorous signatures is called a zero knowledge proof of set membership.
So let's take this primitive and try to do something uh useful, practical with it. And so we can create private voting rounds with linkable ring signatures by requiring each user submit their public key to the contract, you know, uh a public key that they want to be uh they so um in this case you would probably have a setup step. Um if uh anybody is aware of, for example, the Estonian government, they give out I have one of the Estonian EID, e-residency things, and the the Estonian uh residency card has a chip in it, you know, a smart chip, um, and that smart chip can be plugged into a smart card reader, and uh if you mess with the pin, I mean the the software, you can create signatures from it. And the signatures uh can derive a public key, which then you can go check against the embassy's website or you know, some some uh server they run that says, look, yes, I I cert I have a certificate where I signed for this public key, right?
So uh all public keys, you know that all signatures from this public key uh are very likely from me, Matt DiFrante, because the only way to get that uh uh card with the key in it, and you can't extract the key, you know. Well, assuming that the that the heart smart card is safe, uh the only way to get that card is to be me and go to the embassy and uh you know get the well, show my passport at the embassy, right? I mean, uh and if I lose the card, you still can't sign as me because you need the pin, and again, you can't reset the pin unless you're me. So, you know, for example, uh the the public key submitted to the contract could be something from uh one of these uh uh e-identities that Switzerland and Estonia now have, uh government issued or some one time thing where you know that you're not gonna get Sybil attacked.
And so say that you know we're uh there's a group of a hundred people that need to sign, and uh they uh you know, they we have we deployed a smart contract saying, you know, wait until you get uh 100 public keys uh that commit to signing, and great. And now once they have all joined, uh each user is entitled to one and only one private vote, right? And through the some extensions of rig signatures, we can make sure that even though you when I sign, you don't know that I, Matt have signed, you know that if I sign two times, you can detect that I tried to double sign, but you just don't know who. So you can prune all double votes.
The smart contract can do it automatically. Um but you just you just you still don't know who signed, but you know it was just it must have been one of the uh one of the people from the set of committed public keys. So like here's a uh little visual representation of that. So uh you can see uh if we were using this for, for example, anonymous the the ring signature can be used for anonymous payments or or voting or whatever. Um the you can see that the no, like the green key if we imagine identities here as keys, the green key, uh the yellow key and the red key, I mean this is these are still the same colors, I think it's a but yeah, the they are still the same on this side, right? Except for the way that the signature is constructed, uh the signature contains a component from each key.
So if this person commits some funds and a key, this person commits some funds and a key and so on, um, then only the person who has the private key can then withdraw from this, right? As a again, for example, a ring mixer, and the signature it reveals no information besides the fact that it's a signature from this group, right? So you know that if I put money in, no one can steal my money, but at the same time, when I withdraw the money, no one can know that I, you know, like no one can know that the first withdrawal was me, or that the last withdrawal was me, right? So it makes sense.
I think that's not too difficult. Uh just some crypto magic, but you know, take it as truth. So there's there's a problem here, you know, if you wanted to use this for um just if you wanted to use naively again for larger scale stuff, um the wrong th though through normal ring signatures, we have indistinguishability between participants. Uh you know, I can't tell the first and the last sign they're apart. I I don't know who they are, but there's an obvious scaling problem. So a vote from a thousand people require a thousand individual signatures that are one thousand uh like uh six-size bytes each.
And for this specific implementation, at least the one that I um I I did myself, it's a large, it's quite large. I think it's it's like a more than a hundred bytes per signature per individual signature component. So again, this would be a thousand uh times a hundred uh times a thousand, which is yeah, ridiculous it's a ridiculous size. And uh I think you you if you even if you do it with the with the the best opcodes right now, the most uh optimized EBM assembly, um you hit a limit about at a ring of 10 people, 10 to 15 people. So if you wanted you know uh a mixed type network like you have in Monero or in Zcash where the cloud of uh of you of anonymous users is very large, uh that's just not possible.
Um at least not if you program it this way. But there is a uh there's some hope uh if you use instead uh bilinear pairings. And so I'm gonna get ready for the next slide because I didn't really have time to make the pictures pretty, so there's just a bunch of math on there. Um so uh consider the uh simple setting in which several signers all wish to sign the same message M, right? Um so for example, if somebody makes a proposal on the mainnet saying, you know, where we want to upgrade the smart contract, um, you know, it's a token contract, and and the token holders are eligible to uh to vote on whether it can be upgraded or not, and uh, you know, if they sign, then great. If they don't sign, then you know it just it's just taken as an implicit no.
Um and the message, you know, again would be just be to upgrade. And so imagine that we have a threshold aggregate n of n. So this is a simple aggregate n of n meaning that it's not a yeah, it's so so it's uh yeah, it's just an aggregate n of n not a threshold m of n. Um so saying, you know, say that there's I don't know, a thousand users and and I want 700 to say yes, right? If we don't get that 700 number, nothing happens. Um so you know, again, yeah, consider that the message is the same, just a smart contract hash, for example. Uh the signers um uh uh the uh uh signer i, their secret key is x to the xi, and the public key is you know y sub i, whatever, that's uh g to the x sub i.
Um the and then the signature uh is created a bit differently than we were doing it in the uh schnor example. So uh the the signature here um uh for each signer is the one that we went over here, right, from BLS. So uh we take our public key, sorry, we take our private key, the exponent X, and we uh uh raise that uh raise the um hash curve point to the power of that, right? So uh our signature is the BLS signature, so it's not the Schmort signature.
And remember, yeah, remember these little these properties where I can shuffle the the exponents out of the curve, out of the parentheses, to check to do like you know, simple uh computation shortcuts uh and check equivalences. Um right, so now we know that each individual signers sigma signature is created by HM to the over X. This uh if uh if you don't have the mathematical background, it's just this uh power it's the product sign, meaning that the aggregate signature is simply all of the individual signatures from each participant multiplied together, right? Remember we couldn't do this.
I if I take a signature on the mainnet for you know some Ethereum transaction and another signature from the mainnet, I can't multiply those together. That's j you just can't do that on normal ellip the curves. But because we're on a bilinear pairing um curve, we can do that. So the final signature, you know, the n of n signature, um, is simply the signature from each participant multiplied together. Um so yeah, in other words, you know, you have uh you have um yeah, each individual um signature is just uh uh H of Mation uh the to the individual's uh um private key. So the aggregated signature is just you know uh basically what we did over there.
And uh for verifying in the smart contract, we we just we only need to we uh we can accept uh if and only if um the uh the elliptic curve, the bilinear check G over the aggregate signature is equal to um the product of all individual signatures um you know for each individual uh public key uh over the message, right? And it's I know it's a bit hard to visualize this uh without having you know a few pages a few more pages of math, but uh basically this just says it's basically saying the same thing as this here, right?
Um we take each individual signature and multiply it. Um so we have say that we had uh 10 uh 10 signers, we'd say uh sigma zero times sigma one times sigma two times sigma three and so on, and that's uh sigma complete, right? Or or sigma whatever total, which is uh the aggregate. And so this one would be, you know, we take the elliptic curve point, uh the pairings point y zero, um, which I mean remember it's just g to the x zero because that's what the that's what this is right um over hm and then we multiply that by you know e y one and so on and e y two and that because of the properties of bilinear bearings we can make sure that it is the same as that without anybody losing any of the underneath well without anybody losing the private keys right but there is a there is one thing if uh anybody managed to catch to follow the rambling uh is that you don't you lose the privacy here right because um for each uh if you if you're sort of looking at the uh if you're if you pay attention to the this to the definition um the each signature is I um self-sufficient so it's it's you can test each signature independently even if they don't if you don't have the n of n right and I can tell that uh yeah you know public key one voted for this message and I can tell public key two never voted so they didn't want the it to upgrade.
So what we can do instead is we can if we wanted to have the best world again for the nice indistinguishability from the normal at the curve and the scalability to be able to do the check on chain without uh you know spending a million dollars you can do this process um well yeah actually, you can do this process first off-chain and get the result all you know with you because you can do uh I guess you can say like that the bilinear pairings are backwards compatible, right? So you can use bilinear pairing curves for normal elliptic curve stuff, but you can't use elliptic curve groups for bilinear pairing, uh non-bilinear pairing groups for bilinear pairing stuff, right?
So you can you can use one part of the key to do this process and get the tr get the initial sort of vote distribution, and then uh a third party can come in with the uh well, a third party or or a multi-party process or whatever, can come in with the uh uh through through this process and create an aggregate key. I mean, there's and then there's another, there's a bit of another version of this one which is threshold signatures a bit more efficient, but requires more uh previous setups, and and uh then there's uh you know, well, I'll go in the side extra, I think. So uh with all that, assuming the public keys are have already been registered on chain for other purposes, we reduce the voting uh step data cost from a thousand times a thousand times the size of the signature to really just the size of the signature because uh again, we can we have to assume that the public keys have to be on chain anyway, because you know, um like otherwise you can't you can't the participants must register the vote at one point or another.
Um there are ways to limit the amount of stuff you put on chain, but you're kind of always limited by the initial step. But if you kind of if you assume that uh eventually we all have um uh EIDs that can interact with the blockchain or or something of the sort, then once you put your idea on the blockchain for one purpose, then any smart contract can curve refer to it, right? So it's like a one-time storage cost and just many time reads cost. So and there's not there's other extensions here that have further setup steps where it's possible to reduce this even further such that uh M of any M of n creates the same signature, uh threshold signature. So for example, um if you have like a seven of ten threshold signature, uh any seven uh keys in the 10 uh in the set of ten keys signing will create the exact same signature output, right?
Uh so whether it's the first seven or the last seven, different keys, different key sets, they'll still create the same signature, and this is yeah, again, uh through cancellation and bilinear pairings, which is only possible in the pairings. And the threshold signature is uh used by one of the other projects that I think is presenting here this week, definitely they use it in their consensus algorithm. Um for even more setup costs, initial setup costs and a bit more exotic math, you can create a constant size proof, or basically really like um uh you can kind of see it as a smart hash uh that can hold verifications for practically a limited amount of um events, which is uh called a set accumulator. Uh set accumulators again is basically like just cut just kind of like a hash can uh hold a fingerprint for an arbitrarily large size file.
A set accumulator index can hold um can be a verification for like an arbitrary large amount of events, arbitrarily large amounts of events. Um you know, there's always a limit, which is like log n uh verification time, but that's uh more computation theory thing. Um cool. And yeah, so that's uh that was a bit of a foray into sort of the some of the trade-offs and uh uh uh how you would go about constructing the stuff and and uh you know, even if you think that Ethereum is not scalable now, blockchains are not scalable now, a lot of people whine about this, um, you know, especially in the media, uh the you know, the further away you get from the understanding the more alarming the articles get. Um, but you know, the it's not.
It's like it's just because you know, we're it's a pretty nascent industry. Cryptography itself is not liked by many people. I mean, sure it's fancy, everybody like likes to talk about the magic, but nobody very few people like the right cryptography code. Uh so you know this progress is slowly, but it doesn't mean that it's impossible, right? Again, it's just uh uh you know, we've only been around for a few years. Um cool. So any questions? Yes, just revisiting that uh should I get a mic or uh yeah? Yeah, so just about the um the threshold BLS thing.
Yep. Uh about the the threshold signature, just that if it's Lagrange interpolation based, like aren't aren't most threshold signature schemes based around a Lagrange interpolation? So you would get this property that the same sets uh or different sets of of uh signature shares lead to the same underlying signature on the same value? Uh or is it just that like there's no random witness data in the uh or random uh commitment data in the signature? Well, I mean, surely if you have random commitment data, you probably come up with different um outputs.
Um I I yeah, you're right that most threshold signatures are based on Lagrange interpolation or or similar things where they come up with the same. I mean the one that I showed is the aggregate signature, right, which is not threshold. And so obviously you have different well, I mean there's only one output anyway, right? But it's just there's not an MMN. Um I I think that there may be ones that are based not on Lagrange interpolation, um, but it's you know, I wouldn't be able to name it to you. It's fuzzy stuff that I've just gone through in research. But yeah, I mean like the m vast majority are just based on basic yeah, what you said. So uh just why is the the pairing necessary then for this uniqueness property?
Uh I mean if if the Lagrange interpolation is enough to give you the unique signature on the same value regardless of the the key sets used. Um I mean it's well like it does it doesn't work on I think yeah there's like a I guess it depends on it depends on uh uh what you're exactly trying to use it for and and you know the way that you are setting up the group. I mean for um for like um key share setups, I think you do need bilinear pairings. Um but you know for example, yeah, like uh you're right that you can do ECDSA in a key share way uh with uh Lagrange interpolation as well.
Um I I think it just kind of depends on whether you use it you're using it at just like that one standalone event um where once it comes together you know, you will have that you need to have that uh interaction process every time it comes together, or you just whether you do want that first DKG setup and then from then on you want the non-interactiveness, right? So it yeah, it depends on the on the use case. All right, thanks. Cool. Any other questions? Yep. Give that uh Stephon to all over there in the back.
Uh thank you. I have a few questions, in fact. So my first question is about uh the ring the ring signature when you were talking about the voting uh process. Well, it's it solves a sort of problem that you don't really reveal the identity of the person. But what about Sybil attacks? How can we um solve such a problem and make sure that people do not generate multiple um public keys uh to have multiple identities to be able to vote? So that's the same thing. Yeah, I mean so I feel uh I went over that briefly before basically yeah again if you if it's like a governmental election, for example, right? You can only use the you can only use the key to sign that the government has signed off of on, right?
And um like in the payments example, right, to make sure that you know somebody doesn't uh you know withdraw more than they to put in as well. I mean nothing prevents them from being more than one participant, but every time they put in they try to be more than one, it costs them more money, right? So there's economic incentives, there are permission incentives. Um yeah, the Sybil problem is a problem in um uh pr environments where there's no economic penalty for trying to be multiple people, but it it's not I mean civil the civil problem is not really a cryptography problem. Again, it's a economically extensive problem.
So it the solution there depends on the use case, right? So like using security check or some uh security deposits or something. Yeah, yeah. Or again, yeah, or or like having some sort of in-person verification step before you're allowed to, you know, sign. Okay. And my second question is about uh scalability issues and uh when you use uh for example secret uh sharing protocols and you do any sort of multiplication or whatever you want off-chain to solve scalability issues and then verification you do it uh on-chain so for example like I was uh thinking of the the other day of how to do for example shamir secret sharing verification on chain and then you have to do uh interpolation function would we use a smart contract for that or how we do that like on-chain um I mean that's yeah it's a very broad question I it's it very much depends on the UK you know um some use cases are um are okay with or more or more accepting or of of like massive off-chain computation and on-chain checkpoints right uh if you can use something like that then you know true bit scheme type stuff works well um you know or you know maybe we can you where something like iPlasma similarly right it's a lot of off-chain sidechain stuff and then uh eventual settlement if somebody tries to settle a wrong stake then somebody create a conflicting proof uh I mean it's the the yeah the the solutions there vary the massively depending on on what you're trying to do.
It's uh it's always a uh equation between how much overhead you want right because uh an off-chain network takes overhead versus how much uh how much of it do you want to be non-interactive and just you know immediately on-chain thank you thanks uh really interesting Matthew as usual um So the the other one, um, you know, for the BLS compactification, I probably the version would not have privacy, but again for for on-chain voting, like DAO type stuff, right? Um soon, perhaps.
I mean it's not that complex. I'm I'm uh sort of in talks. Me and Dean work at working via DK Labs. Uh we're gonna talk to Aragon about it, and you know we have some yeah, some stuff in the partnership. But soon probably hopefully maybe like this month. I don't know. Thank you very much. Uh any other questions. All right. No more questions then. Cool, thanks.
Related talks
- J1 PAIN 04 Matthew Di Ferrante Cryptographic Approaches to Smart Contract Privacy & Scalability
- DAPPCON 2025: Real-World Encrypted Dapps With Shutter API - Luis Bezzenberger
- Maclane WILKINSON - DECENTRALISED KEY MANAGEMENT
- 'Beating the Flash Boys with Fully Homomorphic Encryption' - Ravital Solomon
- Beyond the Johnson Bound: A Path to Smaller Post-Quantum SNARKs
- Hiding Network Metadata: Introduction to Mixnets
- Challenges of Quantum-Safe Privacy on Ethereum
- An update on Local Mixing (iO)
- Lattice-based Post-Quantum Stealth Address Protocol