DappConnect: Enabling decentralised communications using Waku
ETHCC 4 · July 2021 · 43:24
Franck Royer demonstrates how DappConnect can add decentralized communication features to dapps using Waku v2. He discusses shortcomings of Whisper and the changes intended to address them.
Speakers
Topics
From ETHCC 4, hosted by Ethereum France.
Transcript
okay that's good um all right hi everyone i am frank from
the status team i am the dub connect that connect team lead and today i'm going to talk about dab connect and how you can use it to decentralize communications in your tab and web app let's go right in so i have four points on my agenda first i'm going to talk about the waku protocol and accent it then we'll talk about what is dab connect then we look at some use cases that could benefit of that connect and then finally we look at some code to see how easy it is to use it so let's get right in so the waco protocol the easier way to present the waku protocol is just to look at his
inception so why investigate web3 was created there was there was three protocol whisper for communication so one for storage and then ethereum for contracts as you know it so statues created the status app which is a decentralized messenger app and try to use whisper at the time unfortunately whisper is not really mobile friendly so for example it uses proof of work for spam protection and this doesn't really work when you have a mobile phone on one side of the network under your server on the other side of the network so we created what could be one a wacom model which is built on top of whisper and modify someone's protocol or add some of the features to be able to run statues
on mobile phone and this is what the statue's chat app is currently using so staging chat app is a fully decentralized messaging app and it's using work v1 now having learned some lessons from using whisper our qv1 we came up with waco v2 and the idea here was to start with a brand new tech stack and starting fresh from other lesson learned so whisper and walk with one for example use devp2p like the like ecom1 for translation and block so same technology whereas work v2 uses ep2p as a new tech stack so that's how we get to uh to work with v2 from the need from building the status chat app so what could be two is a it's a set of
protocols so it's a bit hard to summarize a goal in in this short paragraph but i'm that's my best uh my best qualities so what could be to goal is to provide you an infrastructure and standard for decentralized blockchain private communications to the economical we're considering the limitations of restricted resource environment so it's a bit of a mouseful so let's break this down together so infrastructure infrastructure is in the same way than when you build on this item or when you use ethereum you don't need to have any faster tier you don't need to run your own cm node so the idea with roku is that you can
build on waku you can use waku but you don't have to run your own node however it is an open system all the code is open source all the specs are our open source creative command so you can run your own node if you want but you don't have to you don't have to run your own nodes to use roku you don't have to own your own node to build your darp using wacom standard in the way of of the web 3 api similarly the de facto standard a common ground for everyone to build and add communication to their system so whether you are jumping from one project to the other or maybe you want some interoperability between your dap and the wallet having waku as a command standard
allows this enterprise to happen and just make it easier to bid faster and add decentralized communication to your project so decentralized is uh so i think you are all familiar with uh what decentralized means you know it's a technical property that gives you a lot of functional features and benefits so waku is a decentralized network so you have assembly feeds then for essaying it is um so it's a censorship resistance um you don't have a single point of failure or bottleneck you can um on your own node you can connect to any node and you don't have the risk of endo paying some sort or anything like that so what is a decentralized network
i mentioned of change just to be sure that everyone understand that the idea is not to use the html blockchain to send messages and pay gas every time so the working network is a separate network from an ethereum so it is of chain in the way that you don't have to attack the blockchain i don't have to pay gas however as i mentioned it is a set of protocol so some of the protocols for example one of the spam protection protocols we're working on uses a smart contract on the blockchain to help resist time protection because work is very modular it will really be up to the to the developer to decide what protocol they want to use and which one fits best their usage private so we are aware that some depths
want to have some privacy guarantees whether it is pseudonymity or maybe antoine encryption so waku gives you this basic bidding blocks to make it easy for developers to on one hand add these features add encryption but the other hand also knows that their message um that is hard to find the originator of the message for example and seeing that so the specs from the spec point of view we are trying to read to ensure that we are keeping some privacy guaranteed at all time plus there is a possibility to use the protocol in in some ways where you can increase these priority guarantees communication so waku is about communication
which is basically sending and receiving messages so it's not a decentralized storage solution it's purely about communication being able to have this near instant communication happening and more about i would say fmr messages in the way that it's not about storing data like ipfs would be so it's really a communication protocol so ecm ecosystem so we you know status is an serum app we have an instagram company and we are building waku to make it easier for dab developers to the ecm depth developers to use waku and we are looking at pointing examples and easy ways to integrate waku with webster api for example when it makes
sense however it is an open system so anyone that wants to use waku can use it there is no restriction no one stopping it uh we are aware of some blockchain projects that are interested in using waku and which are not excellent related for example and finally you don't have to have a blockchain project to use vocal either so it is a decentralized communication platform so anyone that has a need for that could use it and finally so i already talked about how what kuv2 was created from the need of opening status app on mobile phone and that is something that we are uh keeping in mind and mob so by vst restricted resources we are talking about having limited cpu rm limited bandwidth uh limited connectivity so not being
online all the time but we're also talking about browser environment so in a browser environment you may have the data but maybe you don't have access to the tcp stack for example and you have to use web sockets so we are aware of that and we're providing an array of protocols that allow people to develop their adapt whether it's natively on mobile phone or within a browser you will have a protocol that you can use in the waku from the aku protocol family all right so um so far i've been talking about very abstract concepts as to what what we have concretely uh today so we have a few implementations um we have namewaku so nimaku is the reference implementation it is an adaptive node in the way that
you can start your node and can select which protocol you want to run it can be either be used as a backend for a more complex system for example this is the node that when it connects to uh uses um you can use it as a native library as well if you may be running you know creating a desktop app or you can just run it as a node as an incentivized node so part of the drawback of whispers there was no incentivization in running the node and some things that we're currently working on for waku then we have the javascript typescript library which is targeted for adapts web apps and wallet i will talk more about it uh in the next section and then finally worth mentioning we do have a go
implementation that is used as a backend for the statues chat app on mobile and desktop so at the moment status chat app still uses what could be one but we're actually working to migrate it to work v2 alright so why would you want to use waku for your dap um so waku is here to solve communication so whether you want to do a user to user communication maybe a chat app maybe having a toolbox in your exchange or in your text or something like that um you could also do operator to use your communication for example if you're on a tao and you want to notify your users or your stock and holders that your photos started any kind of communication you want to do
you have two ways to do it either you can go for a centralized way and then you run a server that under handles communication for you but then your dap becomes centralized or if you go into decentralized pass then it's not easy and so the idea is that waku is built by with a research team and we are tackling these hard problems and then it's really up to you to either just use it or join the effort and same way that by using ethereum you don't have to solve the scalability problem yourself as a developer but you can get involved in it so the same way here um we're trying to solve all the hard problems of having decentralized communication working with mobile devices and browser and you can either use it or you can even join the effort if you are you know
on the research side of things finally the idea is really to have an out-of-box solution so waku you know it's a very complex layer of protocols and the idea with devconnect is to give you a very easy gateway to the waku network all right jumping in uh in-depth connect so to work with raise the protocol and i'm trying to use work with terminology for everything that is protocol related that connector is more the entry point for dev developers so the idea is that as a developer we should be able to just search that tab connect and find it and jump right into it so what we want to have with that connect is a set of
documentations and libraries that allows you to add decentralized communication to your adapts web apps and wallets so we have the javascript typescript library which is jswaku we do have some code examples i'm working on some tutorials explanation videos like this talk um and use case studies extra so the idea is to really have like a full um an easy way to advocate your uh to your dab and that's what we call dab connect so let's look at what's available with dev connect so today we have gsuaku it allows you to receive messages so we have here i mentioned two protocols so we have the relay protocol so the real protocol is your gossip sub
peer-to-peer protocol so um you are committed to peers which are your neighbors and they receive a message and then they forward this message so this works well when you have connectivity when you have a hc number we are connected to a healthy number of peers and you receive message lives and then once you see message you just fold it and it's done this doesn't work if you don't have signal okay you're on a mobile phone there is no connectivity and when you resume connectivity these messages are lost so what we have we have the store protocol so we incentivize people to run their own uh waku node using nimraku activating the store protocol which we store and save messages as the encounter on relay and then from a mobile phone you can
query the store a store node and ask for any messages that the standard has seen in the last 10 minutes so that you don't miss your messages so that's kind of of situation or all kind of um of features that could provide to allow you to be able to run your dap and have communication even if you're on mobile phones so same thing for sending messages so you can either send your messages overlay which is with past messages to your neighboring peers but if maybe you don't have good connectivity maybe again you don't have a healthy number of peers and you want to be sure the message is sent then you can use the right push protocol so the last protocol again the the nodes that support like push
will most likely be uh you know what namework nodes running uh in the cloud and so you can contact this node send the message and this node will confirm that there's your message and then they can broadcast the message overlay for you so again situation where you don't have great bandwidth you don't have quite data limitations and you can use like push instead of for it we have encryption asymmetrical symmetric available and synthetic so be able to encrypt your payload or sign your payload and this is done the ecd i'll show you in the code section how it's done we also have a couple of code examples so very naive little web apps that can demonstrate how you
use library and how it works we have a website which is just a chat room and we have an end-to-end encrypted direct message where you can send a message to someone only knowing their instagram address so alice wants to send a message to bob alice only knows bob's icm address and if bob is keen to participate to that then he can receive encrypted messages from alice so it's very naive easy for the code but that's good ways to demonstrate how things work and finally our api and documentation our api code is also documented that's what we have ready today um so what's next so i've been starting i've been working on locations like just this year so
i score on on gsa cousins this year so there's quite a number of things to uh to be done um and i'm actually i'm hiring so the man is just me in the team so uh if you are a developer and you are keen to uh this project besides you then uh please feel free to check out the jobs opportunity at status so as a match we're working on the on the website as well so i have a nice nice dark connect website where i can list more tutorials and use cases to really showcase what you can do with waku and help any developer on board i want to work on more code examples uh stage i'm very excited to do some state channels called examples i will talk a bit more about that just after just for stability so we actually have a couple of uh
depths at statues that are going to use the jswaku so just need to fix some bugs and um i'm trying to have a very open process so uh so the code is open source so specs are creative commands and i have a project board as well so that you can check out the private priorities there so i use cases so what okay so this one has communications what why do we want that what's the point okay we have the chat example but is there any other use cases that we could use so literally anything of chain so when you go of chain uh what do you do you usually want to take some of the messages or transactions that you do on the on the in blockchain that we have to pay for
i'm trying to not have that on the blockchain and instead doing off-chain or doing directly between peers maybe directly between a participant and aggregator if it's all up so anything that needs a communication layer and moving off chain could use waku so if you think a bit more so we already talked a lot about uh chat app examples um so stage chat app allows to have private groups which are anti-encrypted it has their public groups and private peer-to-peer messages so we talked about that already uh okay ecm scalability solutions so if you want to do so when you create state channels so you would usually lock some assets in mutising on subdoction between a number of
participants and then these participants can exchange signed messages and transactions with each other at some point after you know ten hundred thousand messages you can decide to go into blockchain to update the state uh of this music so today if you want to do that then you have you do have to solve the communication problem how are this participant going to connect to each other how they're going to send messages to each other and that's one part of the programmatic of you know of doing such peer-to-peer uh system using waku you can easily have commit the communication done and sorted and just focus on your on your state channel logic same thing for all ups so in roll-ups so same thing you
you lock some uh some assets on the blockchain and then participants with some transaction like uh hold up transactions to aggregator at some point later will take selection and push some proof on the blockchain so again you have to have some off-chain communication here participant needs to send this transaction to aggregator which means that the aggregator may need to publish their ip address and port to be you know to receive transactions and then cause the risk of you know of being uh either blocked or being taken down or anything like that so using the work networks and even if you just use one aggregator you could just use working network to send the transaction over and the educator doesn't have to expose uh itself instead just system's working
network um i still need to do more research on this on this topic to uh to really have a nice defined use case we also be interesting to look at cases where several aggregator looks listen on the work network and see if we can have some kind of market there voting so voting we do have so we have a status we are currently working on the statutes community directory creation dab so in short is uh being able to have a list of curated communities available on the blockchain and so for for these communities to be voted in um we need to do what and so is the blockchain vote and so what we are looking into is what we are working
on is to have a more gas efficient voting so instead of a community owner you know opens the vote to get their community in the in the directory and then everyone has to work on the blockchain and pay mp fees instead the owner opens blockchain but then participants voters can just and once everyone has voted then someone can grab all the votes and submit them subduction or several people can do that you know if maybe there is someone who is keen to put the guesswork in there somebody's going to put the note in there so which means that as a voter i don't have to be to pay gas but um those who are more keen to get to vote resolved as one pays
gas so that's one way to uh to have voting happening without um uh without having everyone to pay gas basically another one is a gaseous pollen so again right to this dab so what we want to have is um some featured communities and so this is uh fully over uh done over wacom so as a as a user you can vote for a community so as a token holder you can vote for a community to uh to be featured and so each each dap so each mobile phone uh each user will collect the votes for the feature community and then display the local hazards so here there is absolutely no blockchain interaction
and that's one way to have a decentralized poll happening without having to pay any gas and so each each client will just look at the as what they can see and display the feature community for for the week and so these two projects have been currently worked on and finally so again any kind of communication you may need for your dabs and could be uh could be could use waku without having to solve the the heart problems of the decentralized communications uh one subject i quite like is nst auctions so if you look at some of the nft platforms today um a number of them are centralized so in the way that
when you're nft are centralized platforms so they they custody and ft and when you start an auction it is of chain but it's off-chain within the centralized platform so you start an auction and then people can uh you know can bid and then it gets transferred from one user of the platform to another user platform and that of course we all know what risk it brings to have uh such custodial solutions so with waku i could have again a system like that where as nft owner could start an auction on the blockchain and then the bid could be transferred via waku at the end the bid could be taken by the owner of the highest b could be taken by the owner and pushed the blockchain
um again i have to do more research but that's the idea so really trying to limit the gas cost there of course all of that could still be uh coupled with uh any roll-ups you know you can still use opportunity roll up to do all this uh the fewer blockchain action that you need to do but you see steve gasps because you limit the number of actions you have to do on the blockchain at the end or on so let's connect too so i know that uh talk has been already done for iconic two as i mentioned waku so they using it and uh and here's the idea is again decentralized communications um instead of having dap and wallet connect to uh where it connects servers for communication uh they're all done via the work network and the way connect server can just
listen to local network instead of receiving directories uh connections from the different users all right so uh this case is done let's look at uh some color so just wanted to show like how simple it is and we're trying to have a very simple api so to get started just use the jswaku package javascript package and you can just do what could create and create your node so trying to have a very good default so that you don't have to pass any option parameters and there is option to do that as well if you want if you do want to pass optional parameters you can but the idea is that it's simple and just walk out of the box so once you have your your work who
knows um you can you can listen to messages so i just wanted to mention as a content topic i think it's a it's a good way to give get an idea of how things work so when you when you create a dap you decide on the content topic so i'll create in my dap and maybe and you may have some there are features that use the work network maybe you have one feature for code messages and one feature for direct messages for example so you can just put that into content topic and now when i want to listen to messages i just need to add an observer and just say i just want messages from this content topic and that allows your client to not be flooded by all messages from the network but just focus on messages that are relevant to uh to the dap and you have a message and
you can process your message and whatever you want with it all right then send messages so so if you look at the first section here just very easy way to create a message again you pass a content topic there so that your message is categorized basically and um and on the other side only the you know only user of your dap will process it process these messages once you have your message uh you can either use work relay so there very compressible uh design here roku.trolley.sound and you send it to your neighboring peers that's unfolded um if maybe you have connectivity as i mentioned before
or you want to be sure you have confirmation then you can use a light push in this case you push a message to a one of the light push node so again here one of the idea is to make it as is possible for you so in this case it will select a light push node that is connected to in the way that you don't have to to find out for you as part of the discovery we try to find it like push node and select it and send the attachment is not and this gives you an arc so acknowledgement and then you can you know do some processing if you don't get acknowledgement so i also mentioned before the store protocol so store protocol allows you to do
direct query to a node to get messages that you may have missed so again work with the store and then you create the history and you pass the content to pick your interest into and then you get the messages back so very simple very simple switching and api and that's yeah so that's how you can then so you play with rodian store maybe if you uh resume connectivity you're going to use a store and if you connect to a new store not then you're going to use torches to see if there's any messages you may have missed another idea is just composing the protocol together to be able to achieve your goals and so i also mentioned signing and encrypting messages so
we have a quick look here so the idea is that the api provides you a way to generate private keys or you can generate key in your waste maybe relate to your dap and then when you create your welcome message then you have a set of options where you can select pass a recipient public key and pass your signing private key and so waku will handle signing and encrypting messages for you so so it means that if you need to if you want to do antoine encryption um you don't have to you don't have to do much okay you just have to generate the key and that's it you don't have to worry too much about the cryptography of course again it is open source science or specs so you know
you're free to have a look and see what it is um as i mentioned before we are targeting the issue ecosystem so for example in terms of choices for the cryptographic schemes there are choices we we uh schemes that are very commonly used in whisper and ethereum so that is nothing uh brand new it's nothing uh odd it's something that really fits with your you know and then ecosystem you have a message you can send it via holley of your store as the hourly of the ad like push as we uh previously discussed okay and same thing so when you want to defeat messages so if you're if you're expecting encrypted messages
then you can just add the dedication key to your work quality so again just trying to make it very easy for you to add these features privacy uh my oriented features in a very simple manner and then you can pass you can use so private keys for quite public so asymmetric encryption or you can pass a symmetric key if you want to use synthetic encryption and then we just try to uh so you know we just try to decrypt messages and um and when you use your ad observer you just get to decrypt messages and you don't have to handle the description yourself all right so um yeah so i'm done i
want two minutes faster than i thought so are good as the slides are available at this url if you uh if you are interested just uh search for gs gs waku there is a npm package and also documentation everything is there as i mentioned we are still working on the dap connect website so um it'll be advertised once it's ready and we do have some some toys to play with we have the web chat is available at this address here on a github page and same for sdm which is an encrypted message so feel free to have a go and play around with it and see how it looks we are hiring so please free to uh
to go and uh and check out the gs4 cool position there and we do have a discord as well if you want to chat with us um yeah any questions uh yeah so that is uh awesome question
so there's a few ways to integrate so um so one hand you know you can um so it depends how you want to anticipate so if you want to uh just use webster api to do maybe some message message signing or thing as that so we're currently working on that on one hand on the other hand it'll be enticing to uh indeed uh there's some use cases like the the dow use case so you have a your voting doc or you download up which include voting and you want to be able to uh notify your user um on the wallet side so on in their wallet so you don't have to open the dab to get notified that vote has started so what we our target here is to just
have uh dev connect used by civil adapts first and to see how things goes and really learn from that and uh and get it used and then once we see that uh we get adoption then trying to see what what it akin to uh to integrate um that connect to get you know the other side of things uh knowing that status has you know the status app is well it up as well uh so the idea is the most likely to also play around with uh with the status wallets first to showcase this notification and system so once we reach that uh because we have statues well it'd be it'd be good actually to authenticate in there once we reach these cases where we want to have um many way notifications or be able to to vote directly from your wallet and
this kind of features okay so in terms of scalability so it is an improvement over a whisper because whisper was using float sub meaning that every node was receiving every message we are using uh gossip so our holy protocol is just a slight modification of the p2p gossips protocol which as part of the protocol you have a management of peers so the idea is that it's trying to keep
a healthy number of peers and um and so that you can limit the number of messages you receive so there's not too much money with at the moment i'm not sure how familiar with p2p but so the moment we use one pub sub topic which means that everyone is basically on same network but we have opened the door to maybe shout a network at some point or do some optimization like that stability but in terms of stability what could be one was already a huge improvement comparing to whisper and something that uh i can i can pass some of the previous talks that my critics talk about um first question uh incentive okay so for the incentive
um i haven't yet implemented this product so the protocol is being implemented in imaku as we speak and i haven't done it in jswaku so i'm just going to give you a i haven't dig deep into that just yet but the quick overview is the idea is that as a store node for example the standard so you sell so you save messages from the from the network and you can serve them to clients that query you so you can keep count there so the idea is to keep count as a store node and if you if the balance is a charge you always sell like a you know you're always having the same client at some point you have this kind okay we need to rebalance the count here so the idea about ms in the account could be to then use the token or use
so we haven't i don't we're trying to keep things open but we haven't decided what to come we will uh this transaction will happen in but the idea is to be able to then balance at the stage but on the other hand as we say it's very modular so if similarly similarly it's a between protocol you could have a situation where everyone particip participates in a healthy manner to the network so that everyone can serve you know if you serve other of their clients as well then this balance is kept in check and you don't need to uh to pay up um yeah so have a look i can forward the specs so if you look for for the specs and it goes in more details but i'm not there yet in the full understanding right so yeah so um so first thing one hand
in term of so in terms of drawings of storing the messages by the store node we do have a protocol in place as well that helps the store nodes and shows that they have the full image to do that we have a protocol on top of the store protocol which is our photo tolerance top protocol which allows turner to ping on the tunnel and just check and say hey do i have all the messages that i'm supposed to have in store and the idea at the moment the default uh capacity is 28 days so she's keeping his messages for 28 days now at the moment as a as a client so using jswaku you are going so we're still working on discovery but you're connecting to the number of nodes and the idea is that it will just pick
up any standard that you have you're connected to so as a user i don't have to worry about it as that developer i don't really have to worry about it either if but if you are worried about maybe a standard omitting messages for you then we can look at our strategies we're not just there yet but we already have strategies in case a store not maybe miss message itself and hence it doesn't give you a full image that's why there is this photograph store protocol as well yes so we um so for now so for that
connect is just myself but i'm working very closely with the protocol research team and so the research team has a number of researchers that are studying these uh these use cases and and and you know working on the specs and working on the nimoku uh the reference implementation um again you know everything is open source so we are adopting a system of rfc so the current uh rfc is being implemented in imoku and we you know cover like a like a first functionality of incentivization and that as we as we as we move on as we get feedback um we can then look into more details into the new use cases um but we are both we are putting in both the research team and my team so we already have a number of
researchers and we want to know to get more people on board to help us with you know resolving this this hard problem that you mentioned i i haven't um i have to double check the research at this stage um sorry just because i've been working very closely with them but uh i you know i started this year so i'm not uh excited exactly uh i don't know exactly all the background and racing uh but feel free to uh i'll definitely drop the question to my colleague and uh and see what they think
and i can tweet about it um as i mentioned i haven't dig too deep
into this protocol so i can't really answer your question at this stage uh but we do have a number of researchers that are looking into it and i'll be following up on them so that i i know for myself awesome thank you thank you okay so in term of uh discovery currently we so currently we don't have
discovery we are implementing a dns discovery protocol which is similar to what is used by a stuart beef so as this dns recovery we're currently implementing it in nimaku in the transplantation and once it's in place then i can do it in jesuaku and uh and be able to uh change more precisely but yeah so dhc is not yet on the on the table but again the idea is that it's very modular the idea is to provide a very modular set of protocols so this dns good question so um i mean
yeah if you feel free to come and uh and you know open an issue on the github and and state your case something maybe to state is that i try to be very um like permissive on the on the design so for example when you start to work node when you do this what could create it starts a little bit not in the background and you can fine tune any option you want of the dp2p so you have the possibility to pass your lip to the p2p options to your wacoo node so if you want to do some fine tuning like that for example on the other hand yes um so in this case i haven't yet reached
this stage but if if we are if we have to implement the dht discovery and we realized that the only p2p one is not ready i wanted to have it ready you know earlier than the p2ps and i would do upstream so i would upstream my work if like if i need because i'm using ep2p uh you know a lot because we are basing on that so there is no whatever bugs or issue encounter with p2p are does it make sense cool awesome thank you for the question all right take care everyone thank you
bye you