mirror of
https://github.com/vacp2p/research.logos.co.git
synced 2026-04-03 03:01:03 -04:00
1 line
34 KiB
JavaScript
1 line
34 KiB
JavaScript
"use strict";(self.webpackChunkresearch_logos_co=self.webpackChunkresearch_logos_co||[]).push([[2731],{1293:e=>{e.exports=JSON.parse('{"permalink":"/rlog/building-privacy-protecting-infrastructure","source":"@site/rlog/2022-11-04-building-privacy-protecting-infrastructure.mdx","title":"Building Privacy-Protecting Infrastructure","description":"What is privacy-protecting infrastructure? Why do we need it and how we can build it? We\'ll look at Waku, the communication layer for Web3. We\'ll see how it uses ZKPs to incentivize and protect the Waku network. We\'ll also look at Zerokit, a library that makes it easier to use ZKPs in different environments. After reading this, I hope you\'ll better understand the importance of privacy-protecting infrastructure and how we can build it.","date":"2022-11-04T12:00:00.000Z","tags":[],"readingTime":18.62,"hasTruncateMarker":true,"authors":[{"name":"Oskar","twitter":"oskarth","github":"oskarth","key":"oskarth","page":null}],"frontMatter":{"layout":"post","name":"Building Privacy-Protecting Infrastructure","title":"Building Privacy-Protecting Infrastructure","date":"2022-11-04T12:00:00.000Z","authors":"oskarth","published":true,"slug":"building-privacy-protecting-infrastructure","categories":"research","image":"/img/building_private_infra_intro.png","discuss":"https://forum.research.logos.co/t/discussion-building-privacy-protecting-infrastructure/161"},"unlisted":false,"prevItem":{"title":"Waku for All Decentralized Applications and Infrastructures","permalink":"/rlog/waku-for-all"},"nextItem":{"title":"Waku Privacy and Anonymity Analysis Part I: Definitions and Waku Relay","permalink":"/rlog/wakuv2-relay-anon"}}')},4722:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_zk-61dc3331f70705c672242b894bc35ab8.png"},15635:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_vote-a5992b54f4076642acc8e20ac716c750.png"},19690:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_servicecred-b022d763d66e89fb610d8d4552355e3c.png"},25839:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/web3_holy_trinity-fd2023ba2271927950dc70bb56f3c615.png"},28453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var i=t(96540);const r={},a=i.createContext(r);function s(e){const n=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),i.createElement(a.Provider,{value:n},e.children)}},42733:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_network-43aa536967aee45b44a1e2a6673b6941.png"},46589:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_adaptive-69974a7e087e209572e1c2faf162e5d5.png"},55800:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var i=t(1293),r=t(74848),a=t(28453);const s={layout:"post",name:"Building Privacy-Protecting Infrastructure",title:"Building Privacy-Protecting Infrastructure",date:new Date("2022-11-04T12:00:00.000Z"),authors:"oskarth",published:!0,slug:"building-privacy-protecting-infrastructure",categories:"research",image:"/img/building_private_infra_intro.png",discuss:"https://forum.research.logos.co/t/discussion-building-privacy-protecting-infrastructure/161"},o=void 0,l={authorsImageUrls:[void 0]},c=[{value:"Intro",id:"intro",level:3},{value:"About",id:"about",level:3},{value:"Why build privacy-protecting infrastructure?",id:"why-build-privacy-protecting-infrastructure",level:3},{value:"Web3 infrastructure",id:"web3-infrastructure",level:3},{value:"ZK for privacy-protecting infrastructure",id:"zk-for-privacy-protecting-infrastructure",level:3},{value:"Waku",id:"waku",level:3},{value:"Waku - adaptive nodes",id:"waku---adaptive-nodes",level:3},{value:"Waku - protocol interactions",id:"waku---protocol-interactions",level:3},{value:"Waku - Network",id:"waku---network",level:3},{value:"Dealing with network spam and RLN Relay",id:"dealing-with-network-spam-and-rln-relay",level:3},{value:"RLN - Overview and Flow",id:"rln---overview-and-flow",level:3},{value:"RLN - Circuit",id:"rln---circuit",level:3},{value:"RLN - Shamir's secret sharing",id:"rln---shamirs-secret-sharing",level:3},{value:"RLN Relay",id:"rln-relay",level:3},{value:"RLN Relay cross-client testnet",id:"rln-relay-cross-client-testnet",level:3},{value:"Private settlement / Service credentials",id:"private-settlement--service-credentials",level:3},{value:"Zerokit",id:"zerokit",level:3},{value:"Other research",id:"other-research",level:3},{value:"Summary",id:"summary",level:3}];function h(e){const n={a:"a",code:"code",em:"em",h3:"h3",img:"img",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.p,{children:"What is privacy-protecting infrastructure? Why do we need it and how we can build it? We'll look at Waku, the communication layer for Web3. We'll see how it uses ZKPs to incentivize and protect the Waku network. We'll also look at Zerokit, a library that makes it easier to use ZKPs in different environments. After reading this, I hope you'll better understand the importance of privacy-protecting infrastructure and how we can build it."}),"\n","\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.em,{children:["This write-up is based on a talk given at DevCon 6 in Bogota, a video can be found ",(0,r.jsx)(n.a,{href:"https://www.youtube.com/watch?v=CW1DYJifdhs",children:"here"})]})}),"\n",(0,r.jsx)(n.h3,{id:"intro",children:"Intro"}),"\n",(0,r.jsx)(n.p,{children:"In this write-up, we are going to talk about building privacy-protecting\ninfrastructure. What is it, why do we need it and how can we build it?"}),"\n",(0,r.jsx)(n.p,{children:"We'll look at Waku, the communication layer for Web3. We'll look at how we are\nusing Zero Knowledge (ZK) technology to incentivize and protect the Waku\nnetwork. We'll also look at Zerokit, a library we are writing to make ZKP easier\nto use in different environments."}),"\n",(0,r.jsx)(n.p,{children:"At the end of this write-up, I hope you'll come away with an understanding of\nthe importance of privacy-protecting infrastructure and how we can build it."}),"\n",(0,r.jsx)(n.h3,{id:"about",children:"About"}),"\n",(0,r.jsx)(n.p,{children:"First, briefly about Vac. We build public good protocols for the decentralized\nweb, with a focus on privacy and communication. We do applied research based on\nwhich we build protocols, libraries and publications. We are also the custodians\nof protocols that reflect a set of principles."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Principles",src:t(72944).A+"",width:"1204",height:"356"})}),"\n",(0,r.jsxs)(n.p,{children:["It has its origins in the ",(0,r.jsx)(n.a,{href:"https://status.im/",children:"Status app"})," and trying to improve\nthe underlying protocols and infrastructure. We build ",(0,r.jsx)(n.a,{href:"https://waku.org/",children:"Waku"}),",\namong other things."]}),"\n",(0,r.jsx)(n.h3,{id:"why-build-privacy-protecting-infrastructure",children:"Why build privacy-protecting infrastructure?"}),"\n",(0,r.jsx)(n.p,{children:"Privacy is the power to selectively reveal yourself. It is a requirement for\nfreedom and self-determination."}),"\n",(0,r.jsx)(n.p,{children:"Just like you need decentralization in order to get censorship-resistance, you\nneed privacy to enable freedom of expression."}),"\n",(0,r.jsx)(n.p,{children:"To build applications that are decentralized and privacy-protecting, you need\nthe base layer, the infrastructure itself, to have those properties."}),"\n",(0,r.jsx)(n.p,{children:"We see this a lot. It is easier to make trade-offs at the application layer than\ndoing them at the base layer. You can build custodial solutions on top of a\ndecentralized and non-custodial network where participants control their own\nkeys, but you can't do the opposite."}),"\n",(0,r.jsx)(n.p,{children:"If you think about it, buildings can be seen as a form of privacy-protecting\ninfrastructure. It is completely normal and obvious in many ways, but when it\ncomes to the digital realm our mental models and way of speaking about it hasn't\ncaught up yet for most people."}),"\n",(0,r.jsx)(n.p,{children:"I'm not going too much more into the need for privacy or what happens when you\ndon't have it, but suffice to say it is an important property for any open\nsociety."}),"\n",(0,r.jsx)(n.p,{children:"When we have conversations, true peer-to-peer offline conversations, we can talk\nprivately. If we use cash to buy things we can do commerce privately."}),"\n",(0,r.jsx)(n.p,{children:"On the Internet, great as it is, there are a lot of forces that makes this\nnatural state of things not the default. Big Tech has turned users into a\ncommodity, a product, and monetized user's attention for advertising. To\noptimize for your attention they need to surveil your habits and activities, and\nhence breach your privacy. As opposed to more old-fashioned models, where\nsomeone is buying a useful service from a company and the incentives are more\naligned."}),"\n",(0,r.jsx)(n.p,{children:"We need to build credibly neutral infrastructure that protects your privacy at\nthe base layer, in order to truly enable applications that are\ncensorship-resistant and encourage meaningful freedom of expression."}),"\n",(0,r.jsx)(n.h3,{id:"web3-infrastructure",children:"Web3 infrastructure"}),"\n",(0,r.jsxs)(n.p,{children:["Infrastructure is what lies underneath. Many ways of looking at this but I'll\nkeep it simple as per the original Web3 vision. You had Ethereum for\ncompute/consensus, Swarm for storage, and Whisper for messaging. Waku has taken\nover the mantle from Whisper and is a lot more\n",(0,r.jsx)(n.a,{href:"https://research.logos.co/fixing-whisper-with-waku",children:"usable"})," today than Whisper ever was,\nfor many reasons."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Web3 Infrastructure",src:t(25839).A+"",width:"1408",height:"826"})}),"\n",(0,r.jsx)(n.p,{children:'On the privacy-front, we see how Ethereum is struggling. It is a big UX problem,\nespecially when you try to add privacy back "on top". It takes a lot of effort\nand it is easier to censor. We see this with recent action around Tornado Cash.\nCompare this with something like Zcash or Monero, where privacy is there by\ndefault.'}),"\n",(0,r.jsx)(n.p,{children:"There are also problems when it comes to the p2p networking side of things, for\nexample with Ethereum validator privacy and hostile actors and jurisdictions. If\nsomeone can easily find out where a certain validator is physically located,\nthat's a problem in many parts of the world. Being able to have stronger\nprivacy-protection guarantees would be very useful for high-value targets."}),"\n",(0,r.jsx)(n.p,{children:'This doesn\'t begin to touch on the so called "dapps" that make a lot of\nsacrifices in how they function, from the way domains work, to how websites are\nhosted and the reliance on centralized services for communication. We see this\ntime and time again, where centralized, single points of failure systems work\nfor a while, but then eventually fail.'}),"\n",(0,r.jsx)(n.p,{children:"In many cases an individual user might not care enough though, and for platforms\nthe lure to take shortcuts is strong. That is why it is important to be\nprincipled, but also pragmatic in terms of the trade-offs that you allow on top.\nWe'll touch more on this in the design goals around modularity that Waku has."}),"\n",(0,r.jsx)(n.h3,{id:"zk-for-privacy-protecting-infrastructure",children:"ZK for privacy-protecting infrastructure"}),"\n",(0,r.jsx)(n.p,{children:"ZKPs are a wonderful new tool. Just like smart contracts enables programmable\nmoney, ZKPs allow us to express fundamentally new things. In line with the great\ntradition of trust-minimization, we can prove statement while revealing the\nabsolute minimum information necessary. This fits the definition of privacy, the\npower to selectively reveal yourself, perfectly. I'm sure I don't need to tell\nanyone reading this but this is truly revolutionary. The technology is advancing\nextremely fast and often it is our imagination that is the limit."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Zero knowledge",src:t(4722).A+"",width:"1412",height:"930"})}),"\n",(0,r.jsx)(n.h3,{id:"waku",children:"Waku"}),"\n",(0,r.jsx)(n.p,{children:"What is Waku? It is a set of modular protocols for p2p communication. It has a\nfocus on privacy, security and being able to run anywhere. It is the spiritual\nsuccess to Whisper."}),"\n",(0,r.jsx)(n.p,{children:"By modular we mean that you can pick and choose protocols and how you use them\ndepending on constraints and trade-offs. For example, bandwidth usage vs\nprivacy."}),"\n",(0,r.jsx)(n.p,{children:"It is designed to work in resource restricted environments, such as mobile\nphones and in web browsers. It is important that infrastructure meets users\nwhere they are and supports their real-world use cases. Just like you don't need\nyour own army and a castle to have your own private bathroom, you shouldn't need\nto have a powerful always-on node to get reasonable privacy and\ncensorship-resistance. We might call this self-sovereignty."}),"\n",(0,r.jsx)(n.h3,{id:"waku---adaptive-nodes",children:"Waku - adaptive nodes"}),"\n",(0,r.jsx)(n.p,{children:"One way of looking at Waku is as an open service network. There are nodes with\nvarying degrees of capabilities and requirements. For example when it comes to\nbandwidth usage, storage, uptime, privacy requirements, latency requirements,\nand connectivity restrictions."}),"\n",(0,r.jsx)(n.p,{children:"We have a concept of adaptive nodes that can run a variety of protocols. A node\noperator can choose which protocols they want to run. Naturally, there'll be\nsome nodes that do more consumption and other nodes that do more provisioning.\nThis gives rise to the idea of a service network, where services are provided\nfor and consumed."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Adaptive Nodes",src:t(46589).A+"",width:"1408",height:"1098"})}),"\n",(0,r.jsx)(n.h3,{id:"waku---protocol-interactions",children:"Waku - protocol interactions"}),"\n",(0,r.jsx)(n.p,{children:"There are many protocols that interact. Waku Relay protocol is based on libp2p\nGossipSub for p2p messaging. We have filter for bandwidth-restricted nodes to\nonly receive subset of messages. Lightpush for nodes with short connection\nwindows to push messages into network. Store for nodes that want to retrieve\nhistorical messages."}),"\n",(0,r.jsx)(n.p,{children:"On the payload layer, we provide support for Noise handshakes/key-exchanges.\nThis means that as a developers, you can get end-to-end encryption and expected\nguarantees out of the box. We have support for setting up a secure channel from\nscratch, and all of this paves the way for providing Signal's Double Ratchet at\nthe protocol level much easier. We also have experimental support for\nmulti-device usage. Similar features have existed in for example the Status app\nfor a while, but with this we make it easier for any platform using Waku to use\nit."}),"\n",(0,r.jsxs)(n.p,{children:["There are other protocols too, related to peer discovery, topic usage, etc. See\n",(0,r.jsx)(n.a,{href:"https://rfc.vac.dev/",children:"specs"})," for more details."]}),"\n",(0,r.jsx)("img",{src:"/img/building_private_infra_interactions.png",alt:"Protocol Interactions"}),"\n",(0,r.jsx)(n.h3,{id:"waku---network",children:"Waku - Network"}),"\n",(0,r.jsx)(n.p,{children:"For the Waku network, there are a few problems. For example, when it comes to\nnetwork spam and incentivizing service nodes. We want to address these while\nkeeping privacy-guarantees of the base layer. I'm going to go into both of\nthese."}),"\n",(0,r.jsx)(n.p,{children:"The spam problem arises on the gossip layer when anyone can overwhelm the\nnetwork with messages. The service incentivization is a problem when nodes don't\ndirectly benefit from the provisioning of a certain service. This can happen if\nthey are not using the protocol directly themselves as part of normal operation,\nor if they aren't socially inclined to provide a certain service. This depends a\nlot on how an individual platform decides to use the network."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Waku Network",src:t(42733).A+"",width:"1860",height:"980"})}),"\n",(0,r.jsx)(n.h3,{id:"dealing-with-network-spam-and-rln-relay",children:"Dealing with network spam and RLN Relay"}),"\n",(0,r.jsx)(n.p,{children:"Since the p2p relay network is open to anyone, there is a problem with spam. If\nwe look at existing solutions for dealing with spam in traditional messaging\nsystems, a lot of entities like Google, Facebook, Twitter, Telegram, Discord use\nphone number verification. While this is largely sybil-resistant, it is\ncentralized and not private at all."}),"\n",(0,r.jsx)(n.p,{children:"Historically, Whisper used PoW which isn't good for heterogenerous networks.\nPeer scoring is open to sybil attacks and doesn't directly address spam\nprotection in an anonymous p2p network."}),"\n",(0,r.jsx)(n.p,{children:"The key idea here is to use RLN for private economic spam protection using\nzkSNARKs."}),"\n",(0,r.jsxs)(n.p,{children:["I'm not going to go into too much detail of RLN here. If you are interested, I\ngave a ",(0,r.jsx)(n.a,{href:"https://www.youtube.com/watch?v=g41nHQ0mLoA",children:"talk"})," in Amsterdam at\nDevconnect about this. We have some write-ups on RLN\n",(0,r.jsx)(n.a,{href:"https://research.logos.co/rln-relay",children:"here"})," by Sanaz who has been pushing a lot of this\nfrom our side. There's also another talk at Devcon by Tyler going into RLN in\nmore detail. Finally, here's the ",(0,r.jsx)(n.a,{href:"https://rfc.vac.dev/vac/32/rln-v1",children:"RLN spec"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"I'll briefly go over what it is, the interface and circuit and then talk about\nhow it is used in Waku."}),"\n",(0,r.jsx)(n.h3,{id:"rln---overview-and-flow",children:"RLN - Overview and Flow"}),"\n",(0,r.jsx)(n.p,{children:"RLN stands for Rate Limiting Nullifier. It is an anonyomous rate limiting\nmechanism based on zkSNARKs. By rate limiting we mean you can only send N\nmessages in a given period. By anonymity we mean that you can't link message to\na publisher. We can think of it as a voting booth, where you are only allowed to\nvote once every election."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Voting Booth",src:t(15635).A+"",width:"703",height:"479"})}),"\n",(0,r.jsx)(n.p,{children:"It can be used for spam protection in p2p messaging systems, and also rate\nlimiting in general, such as for a decentralized captcha."}),"\n",(0,r.jsx)(n.p,{children:"There are three parts to it. You register somewhere, then you can signal and\nfinally there's a verification/slashing phase. You put some capital at risk,\neither economic or social, and if you double signal you get slashed."}),"\n",(0,r.jsx)(n.h3,{id:"rln---circuit",children:"RLN - Circuit"}),"\n",(0,r.jsx)(n.p,{children:"Here's what the private and public inputs to the circuit look like. The identity\nsecret is generated locally, and we create an identity commitment that is\ninserted into a Merkle tree. We then use Merkle proofs to prove membership.\nRegistered member can only signal once for a given epoch or external nullifier,\nfor example every ten seconds in Unix time. RLN identifer is for a specific RLN\napp."}),"\n",(0,r.jsxs)(n.p,{children:["We also see what the circuit output looks like. This is calculated locally. ",(0,r.jsx)(n.code,{children:"y"}),"\nis a share of the secret equation, and the (internal) nullifier acts as a unique\nfingerprint for a given app/user/epoch combination. How do we calculate ",(0,r.jsx)(n.code,{children:"y"})," and\nthe internal nullifier?"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"// Private input\nsignal input identity_secret;\nsignal input path_elements[n_levels][1];\nsignal input identity_path_index[n_levels];\n\n// Public input\nsignal input x; // signal_hash\nsignal input epoch; // external_nullifier\nsignal input rln_identifier;\n\n// Circuit output\nsignal output y;\nsignal output root;\nsignal output nullifier;\n"})}),"\n",(0,r.jsx)(n.h3,{id:"rln---shamirs-secret-sharing",children:"RLN - Shamir's secret sharing"}),"\n",(0,r.jsxs)(n.p,{children:["This is done using ",(0,r.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing",children:"Shamir's secret\nsharing"}),". Shamir\u2019s\nsecret sharing is based on idea of splitting a secret into shares. This is how\nwe enable slashing of funds."]}),"\n",(0,r.jsxs)(n.p,{children:["In this case, we have two shares. If a given identity ",(0,r.jsx)(n.code,{children:"a0"})," signals twice in\nepoch/external nullifier, ",(0,r.jsx)(n.code,{children:"a1"})," is the same. For a given RLN app,\n",(0,r.jsx)(n.code,{children:"internal_nullifier"})," then stays the same. ",(0,r.jsx)(n.code,{children:"x"})," is signal hash which is different,\nand ",(0,r.jsx)(n.code,{children:"y"})," is public, so we can reconstruct ",(0,r.jsx)(n.code,{children:"identity_secret"}),". With the identity\nsecret revealed, this gives access to e.g. financial stake."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"a_0 = identity_secret // secret S\na_1 = poseidonHash([a0, external_nullifier])\n\ny = a_0 + x * a_1\n\ninternal_nullifier = poseidonHash([a_1, rln_identifier])\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Shamir's secret sharing",src:t(64309).A+"",width:"936",height:"704"})}),"\n",(0,r.jsx)(n.h3,{id:"rln-relay",children:"RLN Relay"}),"\n",(0,r.jsx)(n.p,{children:"This is how RLN is used with Relay/GossipSub protocol. A node registers and\nlocks up funds, and after that it can send messages. It publishes a message\ncontaining the Zero Knowledge proof and some other details."}),"\n",(0,r.jsx)(n.p,{children:"Each relayer node listens to the membership contract for new members, and it\nalso keeps track of relevant metadata and merkle tree. Metadata is needed to be\nable to detect double signaling and perform slashing."}),"\n",(0,r.jsx)(n.p,{children:"Before forwarding a message, it does some verification checks to ensure there\nare no duplicate messages, ZKP is valid and no double signaling has occured. It\nis worth noting that this can be combined with peer scoring, for example for\nduplicate messages or invalid ZK proofs."}),"\n",(0,r.jsx)(n.p,{children:"In line of Waku's goals of modularity, RLN Relay is applied on a specific subset\nof pubsub and content topics. You can think of it as an extra secure channel."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"RLN Relay",src:t(88900).A+"",width:"1874",height:"995"})}),"\n",(0,r.jsx)(n.h3,{id:"rln-relay-cross-client-testnet",children:"RLN Relay cross-client testnet"}),"\n",(0,r.jsx)(n.p,{children:"Where are we with RLN Relay deployment? We've recently launched our second\ntestnet. This is using RLN Relay with a smart contract on Goerli. It integrates\nwith our example p2p chat application, and it does so through three different\nclients, nwaku, go-waku and js-waku for browsers. This is our first p2p\ncross-client testnet for RLN Relay."}),"\n",(0,r.jsxs)(n.p,{children:["Here's a ",(0,r.jsx)(n.a,{href:"https://www.youtube.com/watch?v=-vVrJWW0fls",children:"video"})," that shows a user\nregistering in a browser, signaling through JS-Waku. It then gets relayed to a\nnwaku node, that verifies the proof. The second\n",(0,r.jsx)(n.a,{href:"https://www.youtube.com/watch?v=Xz5q2ZhkFYs",children:"video"})," shows what happens in the\nspam case. when more than one message is sent in a given epoch, it detects it as\nspam and discards it. Slashing hasn't been implemented fully yet in the client\nand is a work in progress."]}),"\n",(0,r.jsxs)(n.p,{children:["If you are curious and want to participate, you can join the effort on our ",(0,r.jsx)(n.a,{href:"https://discord.gg/PQFdubGt6d",children:"Vac\nDiscord"}),". We also have\n",(0,r.jsx)(n.a,{href:"https://github.com/status-im/nwaku/blob/master/docs/tutorial/rln-chat-cross-client.md",children:"tutorials"}),"\nsetup for all clients so you can play around with it."]}),"\n",(0,r.jsx)(n.p,{children:"As part of this, and to make it work in multiple different environments, we've\nalso been developing a new library called Zerokit. I'll talk about this a bit\nlater."}),"\n",(0,r.jsx)(n.h3,{id:"private-settlement--service-credentials",children:"Private settlement / Service credentials"}),"\n",(0,r.jsx)(n.p,{children:"Going back to the service network idea, let's talk about service credentials.\nThe idea behind service credentials and private settlement is to enable two\nactors to pay for and provide services without compromising their privacy. We do\nnot want the payment to create a direct public link between the service provider\nand requester."}),"\n",(0,r.jsx)(n.p,{children:"Recall the Waku service network illustration with adaptive nodes that choose\nwhich protocols they want to run. Many of these protocols aren't very heavy and\njust work by default. For example the relay protocol is enabled by default.\nOther protocols are much heavier to provide, such as storing historical\nmessages."}),"\n",(0,r.jsx)(n.p,{children:"It is desirable to have additional incentives for this, especially for platforms\nthat aren't community-based where some level of altruism can be assumed (e.g.\nStatus Communities, or WalletConnect cloud infrastructure)."}),"\n",(0,r.jsx)(n.p,{children:"You have a node Alice that is often offline and wants to consume historical\nmessages on some specific content topics. You have another node Bob that runs a\nserver at home where they store historical messages for the last several weeks.\nBob is happy to provide this service for free because he's excited about running\nprivacy-preserving infrastructure and he's using it himself, but his node is\ngetting overwhelmed by freeloaders and he feels like he should be paid something\nfor continuing to provide this service."}),"\n",(0,r.jsx)(n.p,{children:"Alice deposits some funds in a smart contract which registers it in a tree,\nsimilar to certain other private settlement mechanisms. A fee is taken or\nburned. In exchange, she gets a set of tokens or service credentials. When she\nwants to do a query with some criteria, she sends this to Bob. Bob responds with\nsize of response, cost, and receiver address. Alice then sends a proof of\ndelegation of a service token as a payment. Bob verifies the proof and resolves\nthe query."}),"\n",(0,r.jsx)(n.p,{children:"The end result is that Alice has consumed some service from Bob, and Bob has\nreceived payment for this. There's no direct transaction link between Alice and\nBob, and gas fees can be minimized by extending the period before settling on\nchain."}),"\n",(0,r.jsx)(n.p,{children:"This can be complemented with altruistic service provisioning, for example by\nsplitting the peer pool into two slots, or only providing a few cheap queries\nfor free."}),"\n",(0,r.jsx)(n.p,{children:"The service provisioning is general, and can be generalized for any kind of\nrequest/response service provisoning that we want to keep private."}),"\n",(0,r.jsx)(n.p,{children:"This isn't a perfect solution, but it is an incremental improvement on top of\nthe status quo. It can be augmented with more advanced techniques such as better\nnon-repudiable node reputation, proof of correct service provisioning, etc."}),"\n",(0,r.jsx)(n.p,{children:"We are currently in the raw spec / proof of concept stage of this. We expect to\nlaunch a testnet of this later this year or early next year."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Service credentials flow",src:t(19690).A+"",width:"1414",height:"1022"})}),"\n",(0,r.jsx)(n.h3,{id:"zerokit",children:"Zerokit"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"https://github.com/vacp2p/zerokit",children:"Zerokit"})," is a set of Zero Knowledge modules,\nwritten in Rust and designed to be used in many different environments. The\ninitial goal is to get the best of both worlds with Circom/Solidity/JS and\nRust/ZK ecosystem. This enables people to leverage Circom-based constructs from\nnon-JS environments."]}),"\n",(0,r.jsx)(n.p,{children:"For the RLN module, it is using Circom circuits via ark-circom and Rust for\nscaffolding. It exposes a C FFI API that can be used through other system\nprogramming environments, like Nim and Go. It also exposes an experimental WASM\nAPI that can be used through web browsers."}),"\n",(0,r.jsx)(n.p,{children:"Waku is p2p infrastructure running in many different environments, such as\nNim/JS/Go/Rust, so this a requirement for us."}),"\n",(0,r.jsx)(n.p,{children:"Circom and JS strengths are access to Dapp developers, tooling, generating\nverification code, circuits etc. Rust strengths is that it is systems-based and\neasy to interface with other language runtime such as Nim, Go, Rust, C. It also\ngives access to other Rust ZK ecosystems such as arkworks. This opens door for\nusing other constructs, such as Halo2. This becomes especially relevant for\nconstructs where you don't want to do a trusted setup or where circuits are more\ncomplex/custom and performance requirements are higher."}),"\n",(0,r.jsx)(n.p,{children:"In general with Zerokit, we want to make it easy to build and use ZKP in a\nmultitude of environments, such as mobile phones and web browsers. Currently it\nis too complex to write privacy-protecting infrastructure with ZKPs considering\nall the languages and tools you have to learn, from JS, Solidity and Circom to\nRust, WASM and FFI. And that isn't even touching on things like secure key\nstorage or mobile dev. Luckily more and more projects are working on this,\nincluding writing DSLs etc. It'd also be exciting if we can make a useful\ntoolstack for JS-less ZK dev to reduce cognitive overhead, similar to what we\nhave with something like Foundry."}),"\n",(0,r.jsx)(n.h3,{id:"other-research",children:"Other research"}),"\n",(0,r.jsxs)(n.p,{children:["I also want to mention a few other things we are doing. One thing is\n",(0,r.jsx)(n.a,{href:"https://rfc.vac.dev/",children:"protocol specifications"}),". We think this is very important\nfor p2p infra, and we see a lot of other projects that claim to do it p2p\ninfrastructure but they aren't clear about guarantees or how stable something\nis. That makes it hard to have multiple implementations, to collaborate across\ndifferent projects, and to analyze things objectively."]}),"\n",(0,r.jsxs)(n.p,{children:["Related to that is publishing ",(0,r.jsx)(n.a,{href:"https://research.logos.co/publications",children:"papers"}),". We've put\nout three so far, related to Waku and RLN-Relay. This makes it easier to\ninterface with academia. There's a lot of good researchers out there and we want\nto build a better bridge between academia and industry."]}),"\n",(0,r.jsxs)(n.p,{children:["Another thing is ",(0,r.jsx)(n.a,{href:"https://research.logos.co/wakuv2-relay-anon",children:"network"}),"\n",(0,r.jsx)(n.a,{href:"https://github.com/vacp2p/research/issues/107",children:"privacy"}),". Waku is modular with\nrespect to privacy guarantees, and there are a lot of knobs to turn here\ndepending on specific deployments. For example, if you are running the full\nrelay protocol you currently have much stronger receiver anonymity than if you\nare running filter protocol from a bandwidth or connectivity-restricted node."]}),"\n",(0,r.jsx)(n.p,{children:"We aim to make this pluggable depending on user needs. E.g. mixnets such as Nym\ncome with some trade-offs but are a useful tool in the arsenal. A good mental\nmodel to keep in mind is the anonymity trilemma, where you can only pick 2/3 out\nof low latency, low bandwidth usage and strong anonymity."}),"\n",(0,r.jsxs)(n.p,{children:["We are currently exploring ",(0,r.jsx)(n.a,{href:"https://github.com/vacp2p/research/issues/119",children:"Dandelion-like\nadditions"})," to the relay/gossip\nprotocol, which would provide for stronger sender anonymity, especially in a\nmulti-node/botnet attacker model. As part of this we are looking into different\nparameters choices and general possibilities for lower latency usage. This could\nmake it more amenable for latency sensitive environments, such as validator\nprivacy, for specific threat models. The general theme here is we want to be\nrigorous with the guarantees we provide, under what conditions and for what\nthreat models."]}),"\n",(0,r.jsxs)(n.p,{children:["Another thing mentioned earlier is ",(0,r.jsx)(n.a,{href:"https://research.logos.co/wakuv2-noise",children:"Noise payload\nencryption"}),", and specifically things like allowing\nfor pairing different devices with e.g. QR codes. This makes it easier for\ndevelopers to provide secure messaging in many realistic scenarios in a\nmulti-device world."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Other research",src:t(80071).A+"",width:"1662",height:"1156"})}),"\n",(0,r.jsx)(n.h3,{id:"summary",children:"Summary"}),"\n",(0,r.jsx)(n.p,{children:"We've gone over what privacy-protecting infrastructure is, why we want it and\nhow we can build it. We've seen how ZK is a fundamental building block for this.\nWe've looked at Waku, the communication layer for Web3, and how it uses Zero\nKnowledge proofs to stay private and function better. We've also looked at\nZerokit and how we can make it easier to do ZKP in different environments."}),"\n",(0,r.jsxs)(n.p,{children:["Finally we also looked at some other research we've been doing. All of the\nthings mentioned in this article, and more, is available as\n",(0,r.jsx)(n.a,{href:"https://research.logos.co/research",children:"write-ups"}),", ",(0,r.jsx)(n.a,{href:"https://rfc.vac.dev/",children:"specs"}),", or\ndiscussions on our ",(0,r.jsx)(n.a,{href:"forum.vac.dev/",children:"forum"})," or ",(0,r.jsx)(n.a,{href:"github.com/vacp2p/",children:"Github"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If you find any of this exciting to work on, feel free to reach out on our\nDiscord. We are also ",(0,r.jsx)(n.a,{href:"https://jobs.status.im/",children:"hiring"}),", and we have started\nexpanding into other privacy infrastructure tech like private and provable\ncomputation with ZK-WASM."]})]})}function d(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},64309:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_shamir-8f4c8e31d2eaa86b62392514a411b999.png"},72944:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_principles-699c52e62e0e4de0843ddb23ffbed365.png"},80071:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_misc-16721ea7c68873dbb0276ae7fe665ae5.png"},88900:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/building_private_infra_rlnrelay-4823f37fce52d9d44d72ca73028fa9b8.png"}}]); |