How to stop your wallet from collecting your personal data: Enabling the Nym Mixnet with Metamask
ETHDenver 2023 · February 2023 · 21:35
Routing MetaMask traffic through the Nym Mixnet is the focus of this ETHDenver 2023 talk on curbing the personal data a wallet leaks just by being used. It treats everyday transaction and connection metadata as a quiet privacy gap in typical Ethereum use, then walks through mixnet integration as a way to close it without switching to a new client. The approach adds privacy protection on top of wallet infrastructure people already run rather than asking them to adopt something new.
Speakers
Topics
From ETHDenver 2023, hosted by ETH Denver.
Transcript
Most of you, everyone. What are you doing here if you don't? Um How many people here were upset when they discovered that MetaMask and Infura were monitoring them? Okay, so we're going to tell you how to stop that. So, basically the the the larger problem is that Ethereum was never designed with privacy in mind. Effectively you know, when you use the original web, you're being monitored all the time. And people assumed that in the web 3, there would be this sort of self-sovereign movement where you would control your own data and you would pay for things and not be spied on. BUT IN FACT, WHAT WE'RE seeing
is that the reverse is true. That actually blockchain infrastructure is enabling companies to surveil their users. And this was kind of not particularly well-known until it came out that MetaMask leaks the IP address and all of the transaction data to your RPC provider. So, when you're using MetaMask on your browser as an extension, as most people are, or an app you're talking to an RPC provider. And then that talks to rest of the Ethereum network. And effectively what happened is that ConsenSys changed the
um terms and conditions such that Infura will collect your IP address and your Ethereum wallet address whenever you send a transaction. And that pissed a lot of people off. Like I was LIKE I WOKE UP and I was like [ __ ] ConsenSys, that's [ __ ] ridiculous. Like why are like I just want to send a transaction around. I'm not consenting to being some part of some data gathering experiment to have my IP address and my transaction data sold. You guys just raised 90 million or whatever from Sequoia, use that money. Don't sell my data, don't capture my data. So, what we did here is we've been working on this problem for many years over at Nym. Nym is a
Binance A16 Polychain whatever funded startup, and we come from a line of research called mixnets. Has anyone here heard of A MIXNET? OH, WOW, that's more than most. So, I'll describe what it does in a second, but the way you want to think about it is that no existing solution can defend against mass surveillance, including, not surprisingly, Tor. If I look at the data coming in to Tor and the data coming out of Tor, I can correlate it. Same with Signal, same with MetaMask, everyone can do this. No existing solution, except a mixnet, can defend against an adversary that's
watching your kind of all your network connections with a sort of god's-eye view. So, what the a mixnet does, just to explain, is that traffic goes through multiple hops, similar to Tor or peer-to-peer network. It also, if no one's using the network or not enough people use the network, Nym creates fake traffic, and it adds that fake traffic to the network stream. So, someone who's observing the network can't tell if it's real traffic or fake traffic.
What happens like with mixing is that at each node in the mix network, the packets, imagine the packets are like a deck of cards, they're mixed, they're shuffled at each node. So, So, they come out not in a first-in, first-out order, but in a different order. And when you have more demand, you just add more mix nodes. So, this is a little illustration. Whenever you use a VPN, you obscure your IP address, you might be able to like download Netflix in a country that you're not supposed to, but the fact of the matter is all of your trust is inside that VPN provider.
Tor makes it a little bit better, but not much better, because Tor just sends you through a decentralized network of three hops, but if the adversary is watching, let me just I guess I Nice if I could walk around. If the adversary is watching the input and the output of the Tor or any sort of decentralized VPN, then they can automatically tell what you're doing. You're not really obfuscating your IP address, your who you are. What the Nym mixnet does, see the packets are like a different sizes and shapes. These packets provide a sort of digital fingerprint, and these packets, when they go through the mixnet, they're mixed at every hop, and they're made to
be the same size using something called the Sphinx packet format, which also Lightning uses, if you use Lightning. And then the packets, you can come out, you can see that they're anonymized. So, the question is, can we use this technique to defeat an adversary like ConsenSys? And the answer is yes, you can. Um you know, we have integration components that are all open source. You can download them, you can use them. A local client, that's the thing that kind of takes your packets and makes them all the same size.
We have the service provider, which is like the exit node, and a gateway, which is the entry node. And then to integrate against an app, it's pretty simple. If you're using If you have a web app or a browser plugin, you can just use WebSockets, right? So, WebSockets let you open a TCP I stream inside of arbitrary web origins, if you're allowed to. We also our entire code base is built in Rust. So, we we compile the Rust down to web assembly and you can use web assembly and JavaScript and work with them. That's actually what we do with MetaMask.
Furthermore, if anything that integrates against Tor or any program in general, you can use what's called SOCKS5 to make a local proxy on your machine and send all of that traffic via SOCKS5. So, again, the steps, I'll just outline what happens when you use them. You first say, "WHERE ARE THE [ __ ] MIX NODES?" And you find their keys. And then you basically register with an entry node, the gateways, you authenticate.
You may want to If someone sent you some messages, you download those messages. If you want to send some messages, you create these kind of onion encrypted Sphinx packets. You send the Sphinx packets through the network and the network mixes them. It looks more or less like this. You're that little space alien-looking guy. You're sending the TCP or UDP packets into your machine. The machine makes them all the same size, sends them into this mix node. You know, there's about 500 mix nodes right now. If somehow you want to send a lot of traffic, more will appear.
Uh and then the packets come out anonymized. And then they go to whatever, like an RPC provider or a full node or signal, whatever app you want. The nice thing about Nym is that Nym works with any application, not just Ethereum. Actually, it works with anything. You can use Signal with it. You can use Telegram with it. You can use Bitcoin with it. We don't care. If it speaks internet, we can anonymize it even against the NSA. That's a pretty big [ __ ] deal. So, again, you get SOCKS5 is fairly standard.
You just run it on your computer. It's a binary. Everything just goes right through it. And anything that works on tour will work on NIM because of this technique. That being said, Sorry, we'll skip that. Web sockets is pretty useful if you want to send JSON or other binary encoded messages inside of certain kind of environments like web browsers. Finally, we do web assembly as well. We have an SDK. We allow you to use Sphinx in the browser. And this is stuff that you can't even do with tour, right? So, right now I can't open a particular website like a like WikiLeaks and send a
leak through it. That would be impossible. It's a website, right? But we let you open these connections inside of a web browser, and you can anonymize web browser traffic, which is very useful for MetaMask. We have a token, as everyone else does, but unlike most other tokens, our token isn't completely [ __ ] useless. It's not just yet another defi token with a fruit or something attached, right? We basically if you want to run a mix node, and you want to mix people's packets, that that's a computer. That computer costs money to run, costs upkeep costs. So, you just basically run a mix node just like you could run a
Bitcoin miner, but rather than solving a fairly useless hash puzzle, you're actually using that computational power of your server to provide privacy for other people by mixing packets. So, it's like mixing rather than mining. And as more and more people use the network, you get more and more NIM tokens given if that you know, if your token is your mix node is working properly. And if you're too lazy to run your own mix node, you can use delegated staking on top of the mix nodes to delegate stake to the mixes.
And you know, everyone basically makes some money out of this. The user can give them tokens to accelerate their Mix nodes get the the mix the NIM in proportional to the amount of packets they're mixing. Validators ensure that everyone's paid properly. And most importantly, computer if I want to like use them, I want to make sure all of my traffic goes through NIM. I run a service provider. I run for example, like I'm the Brave browser. Brave or Signal can just buy NIM up front and make their service free to use NIM for all their users.
So, we have a blockchain, which is essentially like the Tor directory authority. That's who you talk to when you need to discover where the mix nodes are and how to send traffic through the mixnet. That's built with Cosmos. If you're interested in the blockchain, we're having a discussion of it tonight at the Cosmos on top session on top session, some sort of pub thing. But effectively, we run everything via CosmWasm. And while Tor has only a dozen servers, we have over 30 Cosmos servers running uh the NIM the NIM blockchain and making sure that that peer-to-peer broadcast can reach people even in countries which are censored, such as China and Iran, which I think we'll hear about next.
Uh so anyways, when we heard all that [ __ ] about consensus spying on everyone, then I woke up and before I even I said, "Oh man, we should fix this. So easy." The community, random people we didn't even know, already started using the NIM mixnet to prevent Infura from basically capturing their IP address and other information about them. If you want to do it, this is pretty simple method here. However, the problem is that rather than going through Infura, you're trusting these people. And I don't even know who these people are. They they seem very nice, but would I trust them?
So, if you don't trust these no trust verify people, you might want to set up your own proxy, right? You can easily run your own Nym proxy. In fact, one of our VCs, Eden Block, made software called Spook. You can set Spook up, and then Spook basically runs the entire thing yourself. So, you set your own entry node, you set up your own exit node. You don't have to trust anyone but yourself and a bunch of random mix nodes. And the By the way the system is designed, the mix nodes can't know anything about you. That's the entire point of a mixnet.
And if you don't IF YOU DON'T EVEN TRUST anyone's RPC node, A16 made this software called Helios. Now, we know everyone hates A16, but nonetheless, this is a useful piece of [ __ ] software right here. So, this software lets you run your own RPC node trustlessly. And you can con- you can use Nym to talk to that RPC node yourself. Because remember, Nym doesn't just hide you from the RPC node, it hides you from anyone watching the RPC node. So, it's bad enough that Infura is collecting your IP address, but it would be trivial for organizations like the NSA or Chainalysis just to sit there and watch all the traffic coming in and out
of Infura. So, if you don't trust even you know, even if you run your own RPC node, you still run that risk. And this software lets you basically de-risk yourself even from yourself, from anyone watching your own RPC node. So, anyways, we have this all working. And if I have time, which I think I do, uh I I'm going to show you it live Maybe not live. I'll show the video. Okay. So, anyways, this is basically Nym being working with MetaMask. It looks just like MetaMask. You turn it on as you are want to do.
And then what you do, you can see you're running this is your broadcasting node, which is kind of your exit node. You set that up. You type in your MetaMask password. You know, we'll go use Görli cuz we're cheap. And uh you basically what's happening over here is this is the sort of um let's say what's happening underneath the hood. They're about to go They're going to send some money to another account. Shouldn't be that hard.
Give it 1 second. Demos are always a little bit boring cuz it's always the boring stuff that happens in the first minute or two. Da da da da da da. Okay, okay, come on. Sorry, this was all done last night. Okay, the transaction actually went through MetaMask. Now, what you'll see happening over here in a second. Okay, come on. MetaMask is a bit slow. It's very ancient JavaScript. Confirm. Okay.
Okay. Now, we just started the Nym WebAssembly client. And it sent the I It sent the packets from MetaMask into our WebAssembly client and anonymously communicated. Wow, that went by really quick. The uh the the message all the way to the RPC node. So, it actually works. Again, it's not theoretical. You can easily do this. Is there anyone from ConsenSys here or you know someone from ConsenSys? WE ARE TRYING TO TALK to them to enable privacy as a default option for MetaMask users. So, Francesco Angelini, who is here? Anyone? Anyways, we keep trying to talk to them. Maybe they're not interested, but if you know anyone from ConsenSys, it would be nice for them to not become the Google of
Web3 because giant data collection factory, but instead enabling them by default. And now I want Oops, sorry about that. I want to mention one more thing. It just finished. The traffic just went through. Uh anyways, so we have all that working. Again, very simple just in case you didn't understand, ETH transaction payload just goes in them, makes the Sphinx packet, sends it to the ETH RPC even in Infura. This is a very honestly not complicated uh flow of data, but it
should be enabled by default. And that's what we're hoping to eventually have happen. However, there's other problems with Ethereum. One big problem you may have heard is called validator privacy. In Ethereum 2.0, the leader selection protocol is deterministic and public. So, what this means is that let's say I can figure out who's going to be selected as the leader, and if I was malicious, I would then DDoS the [ __ ] out of that next person and take out their validator node, and I could do all sorts of very clever financial attacks to make sure that I get the money or my friends get the money and not them.
Right? DDoS attacks are real problem on the internet. And Ethereum 2 is currently vulnerable to these kinds of DDoS attacks. Not a good thing. So, we've teamed up with ChainSafe. Uh there's some people I hope from ChainSpace and there they are. There's ChainSafe in the audience. So, ChainSafe provides the validator consensus clients and works on them with lots for lot over like 500k different nodes. So, what we're hoping to do is that we're going to create with the help of ChainSafe cuz I'm not actually an Ethereum expert, we're going to create a libp2p NIM module.
This will basically mean that any validator should be able to hide its IP address and still participate in the Ethereum proof-of-stake consensus algorithm without fear of being DDoS'd or tracked down or revealing their identity. We think this is actually a huge deal and it will be done in a few months and we'll announce it and we really do hope if anyone Does anyone here run an ETH 2 validator? Okay, there's a few of you. Well, I we would love it if you tried this out. I mean, you will lose a few a little bit of latency, but we're going to time it so that you lose the minimum amount of latency possible to maintain your privacy. So, if you have any questions,
I think I ended about a minute ahead of time. I'm the CEO. I'll be here all week. Uh on Sunday, we're giving a talk with the Universal Privacy Alliance. I'll be there discussing about what happens to activists in certain countries when they use uh cryptocurrency technologies. I think that's at 4:00 p.m. or so on Saturday. So, please do come to that. Uh you can send me questions over email, Telegram, Twitter, or just join our Telegram and ask any question you want there. So, I have 1 minute.
Uh so, do we have any uh other Do we have any questions? No questions? Okay, there's a question. Go for it. I don't know. I don't know. No, he he he he he the guy that guy. Hey, um is there any uh latency issues with using NIM? Not issues, but like does it increase the latency? Yeah, it adds latency. And is that possibly why ConsenSys is like hesitant to integrate it into MetaMask? Is like they're just trying to be as performing as possible?
Well, depends what you mean by I mean if you're performing, you wouldn't use such old JavaScript. But yes, uh fair. I do I do think that, you know, anytime you do any privacy-enhancing technology using a VPN, Tor, or Nym, you will add latency. However, what Nym lets you do is Nym lets you tune that latency down. So, we've seen significant privacy gains with latencies of only a few seconds increase. This is honestly not that bad compared to how like slow the rest of the process is. It's barely noticeable for most end users.
Fair. Okay, thank you. If you really really want to be private, you need to be slower. So, people that are like super paranoid, they can wait like a minute. And we let you set that in the client yourself. Or you could wait 5 minutes or an hour, whatever you want. Any other questions? Okay, there you go. When you use a MetaMask with multiple accounts connected to it at the same time, it'll refresh your balances in the same TCP request, and so it will correlate all of your addresses at once in the same request. I don't think Nym solves this, so I think like that's on MetaMask to fix. So, if anyone at ConsenSys else is listening to this, please also fix this problem cuz otherwise the mixnet alone, I don't
think helps. we we can't solve problems that are inside MetaMask due to bad design choices ConsenSys makes. However, I do want to correct something. Tor, when you use Tor or VPN, you're saying about bidirectional synchronous stream of packets, like TCP/IP. When you use Nym, we actually route each packet through the network individually. So, that means that no packet can be correlated with any other packet at least on the packet level. Now the application data has like an ID for you in it. There's nothing we can really do about that. But on the packet level, which is what matters particularly when
you're concerned about third-party adversaries, the packets should be basically each anonymous in their own special way because every packet is sacred. Okay, so that's it and I'll grab you afterwards. Take care everyone.