ZKV presents Privacy in Cosmos: Nym Showcase
5 Jul 2021 · 13:37
Recorded at ZKValidator's Privacy in Cosmos event in June 2021, Dave Hrycyszyn presents a project showcase of Nym. The talk covers what Nym is building and how it fits into the event's broader look at privacy technology and zero-knowledge tooling within the Cosmos ecosystem.
Speakers
Topics
Transcript
i'll give a quick run through of nem then thank you very much uh yeah so i'm the cto of nim and i'm in charge of building this beast um and i'll just try to give a quick overview of what it is that we're what we're doing um so to recap kind of what harry left us with the internet was originally designed for friends it has really no when it was originally built that had no kind of privacy or security technologies and we've been just sort of bolting on these security features since the 1970s so let's let's go um over the goals of nim in in the context of that kind of background um the three goals of nem i would say are network privacy um and what that means is that your network communications should not be
observable because we want to make it such that it can't be figured out who who's talking to who within the system we're also interested in transactional privacy that is the stuff that you actually do online um you want to be able to hide the effects of that the side effects of that whenever whenever you're doing them too and we also want to enable scalability uh so here are the technologies that we use for each of those parts of the stack um we have a mixnet which i'll go into in a moment and that that's the network privacy there if you want to think about it really simplistically it's kind of like um it fulfills the same functions that people want from tor that's the simple simplest way of thinking about it we have coconut which
is a credential scheme which i'll also talk about for transactional privacy when we talk about transactional privacy um you know these and and network privacy for that matter nim can be used for blockchain systems and it's worth understanding that that's kind of our first place that we're going but uh we're thinking of this as a general purpose system so we're trying to build technologies that can be used in blockchains but then we'll also be um able to be rolled out into other areas basically so like the wider internet the last of these three technologies is the nim token which provides incentives for scaling the system up and down so i'll talk about each each of these three technologies in succession here so a mixnet what is it the goal of a mixnet
is to make it impossible for your adversary whoever is trying to figure you know um figure things out about what you're doing make it impossible for them to say who's communicating with who so when we think about encryption it's easy to think well you know i can send um i can send people messages in fact this this whole stream is going out over ssl you know it's it's it's encrypted what's the problem well the problem is that all of us who are connected if uh if there's a sufficiently powerful adversary or even just maybe someone who's locally powerful um can actually maybe not tell um the content well they certainly can't tell the content of our communications unless somebody has really screwed up but what they can do is they can all see that we've connected to the system that we're
you know viewing this video through for example and that's true of all of your communications on the network and the reason for that is because it goes back to that first slide that i had basically um the internet has just had these kind of privacy technologies bolted onto it so where we've ended up so far is that despite the fact that the content of your communication is encrypted and hidden from any adversaries the metadata that gets your content there is actually not encrypted so that's kind of what we need to fix with the mixnet one of the ways that we do that or the main way is that we have a technology called the sphinx packet the sphinx packet is actually used in the lightning network but we use it for quite a
different purpose than than uh than lightning as you'll see in a second so a sphinx packet is a nested um packet format with a bunch of nested editor headers that can that have encrypted routing information um and you can think of them kind of like russian dolls like they're you know assuming that all of these dolls were the same size they have exactly the same kind of design um painted on the outside you can't really distinguish them from each other just by looking at them you can't say what's inside them you don't know where it's going right um so the mixnet here's the simplest version of it we have two people one on each side the happy faces and they want to communicate with each other so we have a system of network nodes in between them and each of these
people can send sphinx packets back and forth to each other and bounce them potentially through different jurisdictions all over the world and um at each one of these hops so let's say the the happy face on the left sends uh sends one of the sphinx packets um that will let's say go through the top the the top row all the way through to the to the to the recipient um at each hop uh the that that russian doll basically gets unwrapped by the by the mix node the mix node then gets one piece of information which is where should i send this thing next and then so in in our case it's the second um mixing it on top and that one gets another russian doll unwraps that and finds out well where
can i where should i send this next and the o and the answer is let's say the one on the bottom right so then that packet um gets the routing information and says where should i send this next and it should be delivered to that final person basically um this is kind of the essence of the mixnet and how it works but this is not good enough if you have a sufficiently powerful adversary uh basically as harry was saying earlier if you can keep track of the order that packets enter and leave these nodes you can see which one goes where and you can actually and there are adversaries in fact who either locally or globally can uh basically record the entirety of like much of the internet's traffic stream so
this is like not some kind of science fiction thing um yeah so you just you can see what goes where and at that in that case if you're the adversary you win and of course we lose so we introduce mixing and mixing is only possible in a crowd that is if you only have one person or two people using this mixnet mixing actually doesn't make any sense unless you introduce huge amounts of what we call cover traffic so let's let's take the uh this this example that i have here first you can see that we have people on both sides of this thing and actually if they're all sending these russian dolls through the through the network and they all get unwrapped at each at each uh hop well okay that's really interesting
because it's actually getting harder to tell um which which doll is ending up where or the message let's say inside the last um the last one of those russian dolls each each one where it's ended up the other thing that we actually do is we do what's called mixing so let's say the first three people on the left there they they all send their packets in um you know to the first couple of nodes instead of just then emitting that instead of those emitting the packets in the exact same order they actually shuffle them up like a deck of cards inside the mix node and they're emitted in a different order um so at that point once you do a few hops statistically it's very very difficult to tell
um which of those messages originated with which of the which people and who which which message has been delivered to who basically and you can tune the parameters to to change the kind of degree of um of anonymity and privacy that you can get from that so um yeah that's that's that's the basics of a mixnet so we have that running right now and i'll i'll talk a bit about uh where we're at at the end of the presentation the second technology we have is the one that deals with transaction privacy so we have a credential system called coconut and if you know it's not a jwt but the easiest thing in kind of web technology that you could think of a coconut credential as being like is sort of like a json web token so i don't know if anybody who's ever
programmed like um with json web tokens it's basically a bearer token you have key value pairs inside it and maybe you have a credential that looks something like this that would give you some access fictionally to uh some some aspects of github let's say so this is kind of like there's there's keys and values uh and there's a signature at the end so that that the token can be verified basically and whoever has this credential can present it to some system and they can do something as a result of having that um what does coconut add on top of uh or how does it differ from an earlier technology like a json web token well the first thing that we have is blind signing so it's not possible
so you can actually um ask for a signature from your signature authorities and that you're actually blinding the content of what you're asking for with a zero knowledge proof um such that they they actually are not really quite sure what it is that you're actually specifically asking for but you can you they can still verify that what you're asking for is cool and kosher for them to give you um the the other thing we can another thing we can do is re-randomization so you can get back this bearer token which says i don't know it could say something like uh harry owes me 50 bitcoin something like that and um i could get that token from the signing authorities that could tell that could verify in fact that harry had this money in his account and he can
give me the token now if i then present the token this this this bearer token to somebody um they're gonna they can they can look at it and say well harry gave dave that one it must be dave who's presenting this thing but with re-randomization what we can do is we can call a method on the token and basically um make an entirely new token that nobody has ever seen before which is state still valid for the same underlying message so it's actually really magic when you see it working it's uh it's it's pretty cool another thing we can do is uh selective revelation of attributes which is a fancy way of saying uh we could get rid of we could say blot out the name for example on there and just present this other
the other parts of the the thing that says i have access to a specific uh repository let's say um so that that's another privacy supporting technology and the one thing that um you know all of these things were always possible to do before these these first three uh were always possible but this last one uh it was never possible to to have a a credential scheme like this before kind of the advance of coconut is that we have these decentralized signing authorities able to um produce the to produce the tokens in a in a cooperative way so that's kind of the big advance of um of coconut on earlier signing schemes um yeah so uh what kind of use what could you use this for
well it's a bear token like a jwt you could use it for privacy friendly you could anonymize currencies you could anonymize data access voting electronic governance on on chain off chain um you could you could make private nf keys you could do kyc with it so you could say i have the right to participate in token sale x cool give me a give me a credential for that and then you could participate in that token sale perhaps without revealing who you actually are because maybe that would be useful to you in some way basically coconut is good for anything where you want to prove a right to use instead of who you are most of our security systems these days are based on i'm dave therefore i can do this um coconut kind of inverts that
relationship and says cool uh a test please please mr validator or please mr issuing authority um a test that i can do something and then after that people don't need to know who i am they just need to know he's allowed to do it or the the whoever presents this vera token says is is allowed to do this thing um lastly uh the last technology is that we have the nim token that what the token does is it solves uh some of our some problems that earlier privacy systems have had with scalability so uh tor for example which is the most useful general purpose privacy system on the planet today has about six seven thousand nodes and they've had six
or seven thousand nodes uh for many years and the and as far as where they're probably gonna have seven thousand nodes next week and the week after and the week after even if demand for their service goes up they don't really have a way of incentivizing anybody to scale the system up or importantly scale it down when uh there's less demand for that and people don't need to be like wasting resources by running nodes so uh this is what the nim token basically does for our uh system is provide those incentives and we can say uh it works so we are currently running about 8 500 mix nodes uh we have 25 cosmos validators that hold the uh directory of which mix nodes are in
which mix nodes are out um so despite the fact that the system actually doesn't work incredibly well right now uh one one thing we can say is that we've proved uh an experiment which is incentives can work for getting people to run privacy infrastructure so that's uh that's one thing that we can say for sure which was definitely not clear uh when we started the project um the coconut library so we have this uh quite large network we're currently um we've just released the coconut library code that's available in go and rust so that's that's just come out it's happily the the implementation is interoperable between both of those languages and um we're currently at the present
time building that coconut into the nem system right now and we have plans for a cosmos module once we get it working in our own system so that's the basic state of play with nim right now