Liberate Data Week hackathon - Day 2 - dApp day
Swarm·Sat, Oct 9, 2021, 12:00 AM
Liberate Data Week is a Fair Data Society organized hackathon happening from 8–14 February 2021. Ethereum Swarm website: https://swarm.ethereum.org/ Fair Data Society website: https://fairdatasociety.org/ REIMAGINING THE DATA ECONOMY BY CREATING A FAIR, DECENTRALISED DATA LAYER Those who are not yet familiar with the Fair Data Society (FDS) initiative should check out their website, but in short, FDS is an ecosystem initiative working towards a self-sovereign data commons, guided by the community’s ethical principles. As Swarm was once incubated in the Ethereum Foundation, Swarm is supporting Fair data society until it can stand on its own feet. Fair Data Society aims to connect the wider ecosystem and is technology-agnostic, connecting the “tech with social” while facilitating discussion around the ethical shared values of the ecosystem. Liberate Data Week is a hackathon packed with valuable announcements, talks, demos, and presentations. Each hackathon day is dedicated to a specific topic, each relevant to the Fair Data economy. You can expect many practical workshops that will demonstrate how to use Fair Data Society’s FairOS libraries and Fairdrive to build thin dApps on top of Swarm. A lot of focus will also be dedicated to Swarm incentives and tutorials on how to run your own Bee node. CONTRIBUTE YOUR FIRST THIN DAPP VIA FAIRDRIVE The goal of the event is for you to learn how to install and run your own Bee node, discuss fair data-related topics, and understand Swarm incentives and how you can benefit by plugging into the Swarm network in its early stages. The ultimate goal, though, is to bootstrap the use of Fairdrive as the go-to solution when developing thin dApps on Swarm and to build your first one at the event. A jury will vote for the best one and reward the winning team for their efforts. More hackathon rules and guidelines will be given at the start of the event. WHO IS THIS EVENT FOR? Although this is promoted as a hackathon, this event is interesting to a wider audience than just developers and Swarm grant recipients. The topics discussed during the opening morning talks give a comprehensive insight into Swarm and Fair Data Society related topics, and the practical Swarm Bee node workshops present an opportunity for non-tech people to run and install their own nodes too. Everybody is welcome to re-watch the videos of this event.
Transcript
awesome so hello everybody and welcome to the second day of our liberate data week um this is that day and um when i woke up this morning um there were like two wonderful messages in uh my chat platforms uh the first one is that b has a new release which is version 0.5.1 if i'm not mistaken um and also um bjs the companioning library also has um a new update so this means uh everybody in the hackathon that we today we can like basically definitely start hacking for real um because we have things like feats in there um i hope you all had a good night's sleep um i personally uh was a little bit hacking last night but not too much because i definitely was waiting for this release to do it for real so tonight is gonna be the night um [Music] some housekeeping messages maybe we released a document in the swarm sorry in the b support chat it would be really convenient if you could add your project to that list so other participants sort of get a view on what is being worked on and um where you can join basically um today let me go quickly through the program um if i can find it okay so that day so first off i'm gonna have an interesting conversation with daniel nagy um who is um one of our brilliant researchers um in the swarm team after that you will hear from attila who is the i think i can say the dev lead for the bjs team um and he will be showing you how you can build maps with bjs then and then dan and gregor um we'll basically show you how fds js works um it's a library to connect to data networks and do storage and at 15.50 approximately of course we'll have a workshop with gregor and kent and with lenin labs and they will be showing you how to do fair drive and get login and then at around 16 20 16 30 we will be closing this event for the day and we can start hacking finally um if you have any questions please i'm i'm literally looking at the telegram group here so you can just ask anything or give feedback you can oh gregor says it will just be damn showing off um today that's a shame gregor it's always fun to see you hacking stuff um so if you have any questions or remarks please do that in the uh telegram group are of course here in the chat so let's get this thing started daniel can i please ask you to unmute and show your video hello hello okay i'm gonna try to get a different view here because yeah this is way better i think ah there you are now i can see you perfectly hello what a nice sweater you are wearing i'm a little bit jealous of that i didn't i don't have one like that um so daniel the we are gonna talk a little bit about that day so today is all about um you know our hackers building dabs on top of swarm um using the um i know you did like a really cool presentation in one of our last events where you explained what swarm is and maybe you're tired of it but but i i would love to hear from you what what is swarm but in the context of dabs like why do we need swarm for dabs so swarm is at its heart a distributed storage platform which means that as a very rudimentary at the very rudimentary level that can use swarm to just host themselves so the the way you get the dap running on your computer is uh by downloading it from swarm so basically you get a swarm reference you go you follow that link and the dap starts on your computer so that's like the very rudimentary most basic thing for which tabs can use swarm and for that purpose they don't even need to be aware of swarm it just functions as a static web server but distributed now from time to time we get questions like can we host dynamic pages on score i was literally just about to ask you like but what with all these php websites and your dynamic server kind of languages right so that cannot be done in a decentralized trustless fashion so when you're writing that app it's not you you should free your mind from the client server architecture so here we are in the peer-to-peer context peer-to-peer universe which means that the business logic of the dap is also executed by the client on the client side however these interactions are such that the fact that the computation is performed correctly is verifiable by cryptographic means so when you do something then you apply you know digital signature hash all sorts of matrix but in the end when you submit it and other clients see they can verify that you did well first of all that it was you and that the the computation was correct so the the paradigm is very very different from the client server model so no you cannot host php pages on swarm at least not not the way you can host them on a web server but rather what what you do is if you have some dynamic data which are also hosted on swarm then your dap can do some modifications you get a new root hash of the data set because calculating the root hash is very efficient so you can modify even large data sets we will draw it at relatively little cost and you get a new root hash and then this root hash is kind of the new state of that data set and it needs to somehow get to all the other users and there are two ways to do that the more reliable but more expensive way is to uh submit it as a transaction to the blockchain so we have this nice little consensus machine called ethereum where if you submit a transaction it's carved in stone and once the root hash is available to everybody every client has so it it it gives you instant consistency by instant of course i mean the uh proper confirmation time on the ethereum network but once you have that and once you have the new root hash in the ethereum blockchain for example as an ens ethereum then it means that you have update updated the state and what is it well the cheap way is swarm feeds so we have this thing on swarm called feeds uh it is not entirely a consensus mechanism so you cannot count on every client uh getting the feed update at the same time or even getting it at all so feeds also need to be from time to time anchored to the blockchain but with clever programming it can be done in such a way that it happens relatively infrequently and the costs are somehow borne by the parties that are willing to bear those costs although here i must say that currently transaction fees on ethereum are outrageous they are ridiculously high yeah so that development is also subject to the scaling panes of ethereum but we are quite confident at least some of us are quite confident that ethereum will overcome these things and with ethereum too when we are going to have shards transaction costs are coming back to normal and then basically what you can do is you have feed updates which are cheap and all those who are monitoring the feed at the time of updates are getting uh yeah can i can i do it can i go a little bit deeper i i know you're not sure yeah i hope you you're not here of course to talk about ethereum but but it's such an important um you know part of what we are doing of course do you do you see this um you know like the scaling issue do you see this as um for instance if you look at the evolution of the iphone like the first iphone it was basically compared to what they are doing now it was a brick you know with low battery life etc so do you think this will ethereum will scale also like we have seen in other technologies where is this is just like a phase where we have to go through yes i think that i mean it's on their roadmap so in order for ethereum to be useful for all the kind of things that we're going to be showcasing today uh it it must overcome the scaling issues and there are some very bright people uh very well funded well bright people working on on these scaling issues so for those curious i would recommend with alex paper about the roll-up based future where basically his current vision is that there will be a relatively small number of shards giving one or two orders of magnitude a scalability compared to current ethereum but from that point on uh the bulk of the transactions which are just plain transfers and which are not proper smart contract interactions we'll move to some layer two solutions probably uh zk roll ups or some other roll up like technology which means that the passing of tokens passing of tokens will be taken off the of the blockchain for them for the most part and that will free up the rest the capacity of the consensus machine for the kind of things that we want to use it for cool so i i also want to touch on on this topic um because i think we don't do this enough so um we have been talking a lot about bcc as a protocol and and how storage works etc but i think one of the also very interesting features is of course messaging the bss protocol um could you talk about how this um ours we as that developers like how are we supposed to use this and integrate this as in our app and i know that of course the simplest example is like okay create like a chat app um where nobody can trace your conversation etc but you know could you go into you know more specifics like why why could we use it or why is it there uh so that's if they are interactive and there are some there are some users working concurrently on some some data then you need instantaneous communication between those online in order to uh communicate the uh the state changes that they introduced so for example suppose you have some whiteboard application where multiple users can draw stuff and of course eventual consistency through feeds and even the blockchain would work so if somebody joins a day later they will see everybody's drawings on the white board however for those working on the white board concurrently what you need is that every stroke is immediately sent to the other participants so that they can see so for example that is a that is a use case for uh for pss where you need instantaneous communication to uh to provide an a you know an acceptable experience of concurrent uh editing of some content so that that would be one example it's like like google docs editing a google doc kind of exactly if two of you are editing you want to see what the other guy is typing not when the transaction eventually gets committed with the new root hash into the blockchain but you want to see it immediately as they are typing and for that what you need is uh instant messaging and that's what vss provides you what what would you see so this is this is a hack week so we we do have some talks of course but in the end the idea is for this week to to have on sunday um you know a couple of apps or a couple of projects that that are running on top of swarm and b what would you like to see you know what kind of app or project would you like to see sunday well i'm mostly enthusiastic about things that work on top of large data sets and as far as i know there are people already massaging open street map and it would be very cool to see some some geospatial application to be developed on swarm so that it can use the open the data set from openstreetmap and let people do something with it like share their position or edit it or annotate it or something yeah so i i i think there are some teams that are working on something like this do you think you have you have been thinking about swarm and and you know a world where swarm is is a reality you have been thinking about that a lot um did you ever come up with like a kind of app or a kind of you know solution that is doesn't exist yet because it is not possible because you need swarm to make it possible yes so i usually talk about these these knowledge databases of which chopin street map is one wikipedia would be another example so they all grapple with the problem of official truth and what i would really like to see on swarm is a public data set where you don't have you you simply don't have this problem because the kind of operations that people do with the distributed uh source control like git like you know forking merging rebasing these kind of things you can do with with data on swarm and it would be nice if we had a kind of a wikipedia like application where for every topic that is contended where there are multiple opinions about certain topic where you could see like around which opinions people cluster what are the different perspectives on it and and of course you can choose which perspective you trust or which perspective you even want to see but and there's still plenty of scope for editorial work for somebody to you know to moderate and edit or curate a version of this data set and people can relate to that but basically i think that what's missing from from the web 2 world is what we call permissionless publishing that if you have something to say if you have enough bus to store it in the uh in the swarm then you should be able to store it in the swarm and you know who looks at it that's a different question but you should be able to yeah i think i think you're touching you're touching on a very important topic there like like it seems like the internet now is um you know who pays for the storage or who the person or the company basically that can still pay for all the storage or even the communication they get to say you know sort of what is real or what people see um do you believe and i know this is a very mundane philosophical question for someone like you so i hope you don't mind me asking you um but do you think it is important for us as like a society to have one reality and i say this in the context of you know all the fake news and people who like really believe different things than other people and and they seem to get into fights and polarization by that um do you think this is a this is a problem like do we even need like one truth uh so i think that you know consensus on reality is is nice and even necessary but let's not pretend that there's consensus where there's none so i think that as long as there are different opinions on certain topics it is better to to be honest about it and to uh and to somehow represent the fact that there's no consensus rather than faking the consensus so i think that fake consensus is just as bad if not worse than fake news uh and i think that you know there are there are various methods by which people can choose for for themselves of what to believe in and i think that there should be some mechanisms institutions whatever that help people on converging on us on a reality but but it shouldn't be fake like there shouldn't be we shouldn't pretend that there's a consensus where there's not okay that's awesome yeah that's that's i think that's a wonderful opinion um daniel this is all we have time for i want to thank you from the bottom of my heart for you being here it's always really interesting talking to you and i love that you can share um your thoughts with especially this group of people who are like the builders of our ecosystem so thank you so much and i hope to see you soon well thank you for the conversation it was very pleasant thank you so much michelle thank you bye bye so i i yes yes danny thank you so much i look forward to re-watching that conversation the promise i have a job to do and and this this this mix for you know i want to listen back to this conversation i think it it's always so interesting um to hear danny's take on things um next up um we have attila attila are you there hello oh so attila i want to congratulate you i think i'm i hope i'm one of the first people to congratulate you and the team on releasing bjs for me it is sooner than expected and i can't wait to um start playing around with that um so i hope after your presentation we can still have like a couple of minutes to to speak about some things i was curious about but first i will let you do your thing so please go ahead thank you michelle um i would like to share my screen let me see can you see my screen i prepared a short presentation yeah it's all working cool oops wow okay this is not what i expected but i will just show you like this is it okay yeah sure i can see it nope no worries all right so um i'm gonna talk about bgs to build your own depths on it and first of all i would like to talk a bit about what bgs is what depths are and what b is actually so because i i have heard some people that there is a bit there is a bit of confusion around these things so swarm is the decentralized storage and communication system that we all would like to use and b is a swarm client written in go so basically uh you run b nodes and that's the business free for using the b apis easily so b provides http apis and you can use that directly as well if you'd like but um but when you are working on application development sometimes it's easier just to use a library that also provides some types for you and some definitions and some convenient functions to to make things easier and this is what bjs is and the depths are decentralized applications so basically decentralized applications are ones that are hosted on decentralized platforms so you know they cannot be de-platformed nobody has once you deployed it nobody has total control over it so cannot revoke it and basically swarm is one of those platforms which allows you to build this kind of decentralized applications and we hope that people will like bgs for doing this so the current functionality of bgs is basically the junk bytes files collections upload and download functionalities so you can upload and download data to and from swarm and you can use tags to track your data on the network so if it's uploaded if it's synced everything you can use the local pinning functionality of b to to make sure that your files are always available once you sync it to your node we have pss functionality which is the the well it's a private messaging part of swarm so you can send anonymous private encrypted messages between the nodes and um we have also the balance checkbook settlements functionality so you can you can check your you know your node's balance you can even settle the checks and everything so um take care of the money basically on the accounting parts and coming soon is the single owner chunks and feeds which i think is a unique feature of swarm because that allows you to store data privately and have your own space that you can control and also with feeds you can have updates without having to make transactions on the blockchain so that's very exciting and i prepared with some links and i prepared with a demo so basically i would like to show you what we have now we have a website where you can have the documentation for bjs you can you know your usual things getting started how to install it with npm how to use it from javascript and typescript it is written in typescript so you also have type informations as the first class citizens um and yeah we have some examples and you can check this out and i prepared with a small demo which is also it's one of these similar to one of these examples basically it's a it's a react app um it's a basic react app it was created by the create react app and you can see it's the usual suspects basically the template react project the only difference is that i also installed the heaters for bjs package which is the the official bgs package and then if you if you download this project that you can find here i will provide the links in the channels later after this talk then you can start the react app with npm run start and then you can open this application in the browser and it's very sophisticated it looks like this so basically just a file picker the submit button and i will show you the source code because and we will we will look at the source code so this is like a very basic one file react application you can see it's a div it's a form inside there is an input field and an input button and what we do here basically is that we select one file with this file picker once we um selected the file then we we set it in in the real react state and then when you press the submit button then the handle submit is called and then it gets this file it uploads this file to swarm or b it up downloads this with the hash that was returned just to make sure that this worked and then we set the link of this uh of this file and then once the link is set in the application we will display this link and then i will also show you how the b initialization happens so basically you have to import b from ethers for vgs you have to provide a url it's it is one of my running v-nodes locally then you create a new b instance and after that on this b instance you have the functionality that you can use like download file like file from collection pin collection bss receive unsubscribe retrieve tag whatever and so so this is the example let's try this out so we will choose a file i chose a swarm logo and then i press submit and then i hear i have this link so [Music] it returned actually a b api b file api link which looks like slash files and slash the hash of the file this this is a content hash of the file and if i click on it it takes me to this file that i just uploaded so so that's very simple we can upload another file upload it and then this is a transparent svg logo that i just copied from the website so so this is the the basic demo and then of course you can do multiple files as well but i want to show it to you it's a bit different how it works and actually yeah let me just show you so i prepared with the branch and git and then i just switched to this branch called files and the difference is if you want is that it's it's capable of handling multiple files i added multiple property to this input element and then i also have multiple files in the state and then basically i call the upload files instead of upload file on the on b to upload multiple files but what happens actually is a bit different in the background so when you upload one file to b then it creates a file on b but if you upload multiple files what happened it creates a so-called collection and the call action is basically something like a dictionary or a folder in an operating system balance so that it's a it's a hierarchical structure of many of multiple files and with that you can you know upload websites or or any kind of data basically that you store locally on your disk in a folder so here just to demonstrate this uh we will select multiple files then submit it and then what you can see here is that the difference is that uh now we got back a link which doesn't point to files because files endpoint returns you a single file but uh the business we use the business endpoint which is a general uh resource endpoint basically you give give a hash to swarm and then it returns you in this case this collection which uh represents this directory with the files and then once you have that you have to well there are like uh many features that you can do like you can when you set up a a website for example you can set an index.html as a default file and it will return your website but in our case we have to pass in the file name and then basically add the name to the end of the path and then it will return you this file name so in this short time i only had demo only had time for this demo but we have well we just started working on this public releasing this uh bgs and we just started working on the documentation but we already have i think enough information to get you started of course there are like bugs and we say that this is offer quality but we wanted to release this for the hackathon because we think that this might give you a boost for building applications and uh please feel free to reach out to me i'm available on telegram and also matter most on github so use these channels please i will post the links after my talk to all these channels so that was my presentation and now let's get back to you misha thank you thank you so much attila it was very nice seeing that it seems like a very simple thing um you know if you look at your demo but i know how much work and and thoughts um and brain power is behind this and uh yeah again congratulations one question i have um so when i upload multiple files again is that like recursively can i upload a directory with directories in it and files in it and directories in it yes sure you can do so it will automatically create this yeah so that's possible but as you showed like if i just go to the hash it will not show me sort of a directory or a file listing right yeah not yet so so yeah it's possible to get back this information we don't have this in javascript but yeah of course it's available and hopefully soon it will come awesome do you still do you still have time i mean could you if you have time could you explain maybe a little bit i just want to make sure that um as as victor said like we need to get out some you have you call this like primitives like basic concepts um for instance uh dimitri just asked like what is an soc and and what is feeds right i have been struggling to understand this as well so can you could you try to explain that yes sure so basically swarm can handle right now or can store two types of chunks there are the content address chunks which is basically your data you upload and if you upload the same data twice you get back the same hash because this hash is based on the content of the data but with that you know if it's you cannot really change things and also you cannot really prove the the ownership of the data it's possible to put like something inside your data but swarm also has another way to store chunks and they are called singular chunks which means that if you have a keeper for example your ethereum keeper you can create chunks that are signed by you when you create the chunks you have to sign them and then a swarm will let you upload them and then everyone and then you can get back the the hash of this chunk and then if you pass it to someone else then someone else can also verify that it was signed by you so with that you can create private chunks basically that is signed by you and then you can make sure that nobody else can can write them just you so and with that many things become possible because then you can basically create data structures with the help of these transforms so for example one of these data structures that we that we have in swarm and i think it's unique to swarm is this feeds which is basically a clever way of like deterministically create these single owner chunks so that they can be found for example if you [Music] if you take a for example you can you can you you can have the singular chunks that have that contains an index when you generate the the the chunk itself you can deterministically come up with a way to generate an identity or like uh it's like an index of this chunk so when you when the uh when you get back the address of these chunks you can tell that it was the first or the second or the third or whichever and then basically uh you can you can if you if you share this information in an application or with someone else then for example you you agree ahead that okay so this is my place and i will put data there for you and then okay then you say okay i'm waiting for you please i will i will just pull the information if you if you have written the data to the zero index and then i'm doing my first write to the zero index then you are pulling that and then you will fetch it so you will get that information and then you will pull the the next index so then you move ahead and then once i want to send you an update then i will write to this next index and then you will get this update and with this basically we can have mutable data because then we can have uh deterministic updates in a uh an agreed um schema which we both know and then it can also be used so if you can set up this one-way communication then in a similar way you can set up two-ways communication and after that basically you have um like channel for communicating any kind of data yeah so it's a yeah yeah that's a that's a really good explanation i think um uh another question i had was um in how far is pss uh supported in the bjs lip that you just released what can i do with bss so you can you can send pss messages and you can receive pss messages the only thing that it's good to keep in mind is that this pss is a is a private uh api in a sense that like you cannot use this over gateway and also you have to understand that it's quite computational heavy because basically when you send the pss message it uh it basically mines a chunk so it basically creates a chunk in a format that uh that make sure that the other party will receive it and but nobody else can decrypt it so this is a computationally expensive operation and that's why it's not allowed on the on the public gateways so you have to use your public your private gateway or private node and basically you can use it to send private messages to other private nodes yeah yeah i understand so um yeah another question i know we're going over time but but you know we'll we'll try to strip up some other time uh somewhere else um so i think i mean my my dream is to have bts working as a light be fully in the browser will this i know can we look in i know you just released and you were happy with everything you did but i still want to push you to look into the future and will this ever be possible and is this like you know far out there or is this something that will be feasible so so there are some current limitations in the browsers regarding what kind of connections you can make and basically for security reasons the browser cannot cannot handle incoming connections so it can initiate outgoing connections but it cannot accept incoming connections and that's a pretty serious limitation with the system like b because it you know all the nodes are accepting uh incoming connections as well as initiating outgoing connections so there are some ways to overcome this we are experimenting with these kind of things but it seems that right now it's uh only possible with some kind of either some kind of uh browser extension or you know or using your local b node with the library or you know having browser support just like what brave browser did with ipfs recently so there is hope and uh and the we will work to figure out which is the best way forward so yeah that's one of our our biggest goal for this year actually to to figure this part out and i'm positive that we will see some kind of uh solution which may not be like you know mainstream ready for by the end of this year because this may affect like you know like changing browsers and well it's not an easy thing because the browsers are actually controlled by those exact companies which are like currently controlling the web itself and yeah it's they are not i guess they are not a huge fan of these kind of projects that we are working on but yeah but that's why we are here and working on this to to make sure that this happens i i feel a b browser coming um if i hear you correctly anyhow maybe this could be an idea um so gregor has two comments um purity browser for the win i don't know what he means by that does that ring a belt to you yes so the the b you know one of my colleagues in the bgs team it's called victor thought and he he has this pet project called purity browser and he really wants to explore this direction i see and then and then um gregor also is asking will you rewrite swap chats with bjs yes once we have the soc merged to vgs which i'm pretty i'm hundred percent positive it's gonna happen on this week that's great news thank you so much attila as always great talking to you can't wait to meet you again in the real world um so yes let's yeah i'm going to go to the next topic because we went way over time but that's okay because i think this was very useful and interesting information thanks aphil next up um oh next up is my good hacker friend dan who is going to show us um well the title says using fds js to connect to other data networks and storages which is quite interesting dan are you here i am there you are looking great as always um so then are you as excited as i am with the releases of bee and bjs today i can't tell you how excited i am to work with the single owner chunks and get snatch swap chat working again swap not stop stop but yeah no i'm super excited and actually i've been so excited that i've been jumping ahead and digging into the code as we will see as we'll see yeah yeah so yeah yeah it's all let's i'll just stop conversing with you so you can just show off uh all that stuff um stick around after your talk because i definitely will have some questions for you okay i'll look forward to that yes um okay well i'll prepare the short presentation so i'll show you my screen is that visible yeah it all looks good okay so my presentation is about using fds.
js to connect to other data networks and stores um first a little bit of a history of fds js for those who don't know in so it started off with fair drop um which was a simple and encrypted file transfer app that we built on swarming and it's actually really way too easy to do that with swarm so we decided to make things more difficult for ourselves and we added divi helmet-based encryption and used ems to store the public key the public key registry and and do the usernames element for the discovery of mailboxes and added all this and there's quite a lot of r d over time and then we realized this was like really useful stuff so let's pull it out into fds js then after a while then we started by developing other applications on fds.js and we realized that we needed to add something that enabled us to have different mailboxes essentially for different applications we made a chat application called chatty today did and um after those messages started showing up in fair drop we realized that we've kind of got something here so we we kind of accidentally came across the interoperability and then built into this uh this extra library and we were experimenting with called multibox so i mean fds js is the it was an r d process when we were building it it wasn't perfectly formed but i mean it was very powerful and um still is so yeah multi-boxes and experiments to find out how apps can interact with each other's data and then hence how this is related to the topic so the multi-box like it on the um fds js github repo is visualized as the as these pigeon holes so the idea is that you would know where somebody else's pigeon hole is and you would go and put the data there and encrypt and encode it in such a way that they would be able to then later go find their pigeon hole get the data and retrieve it and that's that's kind of like what the talk is about so for the more sort of like technical coders since we're in a hackathon this is what um a simple chat application or actually it's um sending a file from a web form in this case looks like in nine lines so you just instantiate yes i left this in just to show that it literally is this easy and uh then you create an account send the file to bob and then this is the multi-box um address here so it's in this like file directory format and you can pick that to be whatever you want and then on the other end you have your webmail app and here you just unlock the bob account and then go check that box in the multi-box and you'll get your file so that that's the idea of multi-box now i guess some of you might be thinking well we can do this in web 2 so what's so special about this why is this why is this so important um the answer is like what is actually happening in your networks and and so it's kind of a black box and it takes a lot of explorations kind of find this out so what i've done is i've i've done some artist impressions of um some diagrams of uh of this to kind of try and explain it a little bit more to them to people so this is what it looks like in the current present day you have your server client relationship so you would have send your file to maybe something in amazon web services and then maybe that would come back through microsoft as your cloud and there's you at the bottom you're the client and the situation we're trying to move towards is a bit more like this where you're the b and you have the key and then all of the data's are there if you used to go and find wherever you want and if you've got the key then you get to unlock them so the this is a fundamentally kind of different situation and all of the data is then shared across the whole of the swarm and if you know the right location you know how to it's encrypted and how it's encoded then you get to have it if you've got the key but if you don't have the key you can't have it now you've seen the um swarm address hash i'm sure which is a 64 by 64 character hex string and what that represents is the address of data within swarm there uh as attila was just speaking about in the previous talk you've got your content address chunks so the the address is determined from the content and the singular in the chunks we'll talk a bit more about those in the past but this is the actual number of potential addresses in swarm so as you can see it's an absolutely gigantic number and it's actually it's actually just over google google's um so swarm is actual bigger than google so we're not approved it proved it here google is tens of the 100 uh okay and then now i've um i've tried to prepare an artist's representation of this as well i've had to actually show this in the original thing because this is sort of too big this was too big for google slides so this is the whole of the disc the entire address space and then for single owner chunks this is a special kind of chunk where part of this address space is sort of reserved in a sense not exactly but for um an owner of a public private keeper so here and i think your screen your screen shares died okay go back so this is the artist's impression do you see that now yeah now we see your screen again so this the whole dark area here is intended to be the disk so that's the distributed immutable store of chunks where all the data is stored and then um as i say there's a small section of that which is referred reserved for people essentially with a public private key pair so you have to have the key to be able to write there but if you know the address then you can go and read from there and then within that swarm allows you to then write to specific addresses in this space the reason this is important is because when you get down to this actual chunk right in the midst of the vastness of the swarm determined by the um your ethereum address your and the topic and it identifier not index um of the chunk then you can go and fetch the date right so the idea here is that if you have if you have the key and the address and the topic identifier you can put that data into the swarm and then somebody else as long as any application as long as they're given the appropriate information you can go and fetch that out and that's what gives us the opportunity to have interoperability because anyone can read or write to the swarm as long as you know the address and the information and then just to go into a little bit more technical detail for the more technical of you um this is kind of what it boils down to so on the way in you start with your data you encode it encrypt it and then that ends up in a location in the swarm which you just turn in and then on the way out you go locate it decrypt it decode it and then you've got the data this is this so it's a little bit repetitive what i'm saying but the essential idea is if you know the coding the encryption and the address in the key space you can find it excuse me so what's next fds js well we're in the process of porting it over and that's actually very close as i'll show you later once the single owner chunks are in bjs then we'll start to move over to using that and we're going to do some improvements to multi-box make that a bit more gas efficient and so on and then coming soon fds-2 with um a sort of like refund api that relies less on blockchain and is more built around these swarm primitives that we've been kind of going through and then of course the obligatory live demo um this is wow preview of fair drop um running on b rather than swarm so actually on fair drop xyz it's still happily running on the old school network this is the port over this is the account getting built a lot of the interaction as you can see here in network panel is happening on blockchain but as it goes on you'll start to see these interactions with swarm these 404s is totally normal by the way upload and send data and then if we send it and this is actually uh an example of what we've talked about so it actually makes an entry in the multi-box just send this myself in this case you'll see during the upload process it creates this connection here and that is actually going writing in the multi-box to say go look in here in the disk from where we've left your messages and files using a single end chunk that's it for the presentation so thanks to all the swarm team being the absolute best and uh back to you michelle yes uh then we also love you so that's that's a good thing i guess um so um yeah these were that's just wonderful it's it's so cool that you can you know you just demo it and like this was a live demo right then like technically nothing is going wrong or anything so that's right yeah it's still working yep so i have so many things i would want to ask you but let let me first ask you know the people watching if you have like questions about this um yeah there's just it's just too much i loved your i love the way you visualize uh the disc we should we should definitely use this when we when we are doing um videos on you know what swarm is i think that's brilliant to just zoom in and out from from from this thing um then i'll i'm gonna be back um to you i think at the end of this event if that is okay um because i i think that um our hackers that are watching and that are in the in the telegram group um they will have some questions uh but maybe it's good to come back to that at the end of today's uh live talk um so gregor i'm not gonna ask your question now um let's let's let's let's come back to dan and others to do a little ama at the end of uh of this day is that okay then that sounds great yeah okay i'll see you in a bit then um because we're gonna move on and we're gonna now um go to kent kent in somewhere in south africa um fowlery what is your how do you pronounce your last name furry like for he's a jolly good fellow he's this way can't furry is a really good fellow so um you're gonna show off again uh fair drive and get login at but this time it's a hands-on workshop does this mean that i have to you know be following everything you do on my own machine or can i just watch no no no um for for this i think i was going to also just start off by chatting to to you about fair drive and um i think possible ways forward uh for for for the for the application um i've got some good ideas as well uh you know you're connecting it with fds so it can be used uh without fear os um connecting with bjs as well um and then uh while we were in the talk i just mashed some code together to just basically get a kind of boilerplate reaper up that can basically create the create account with gate login if from the invite and my idea is that it would be quite easy to just put fds at the bottom of that so when you create your get login at account you can take that same one and create an fds okay let's let's get let's i'm gonna i'm gonna be out of the screen and i'm gonna let you show it all off because i just wanna watch it okay thanks ken no worries um cool so i would like to just start off by let me just show you that screen um i thought we'd jump into the code a little bit more can everyone see this screen or is it this one hello yeah cool uh so just a little bit of history um fair drive is a uh is an amazing application built by uh a one and only michelle and um it it's been built to work primarily on fairies dfs currently but it's now that we do have bjs up and running we've got amazing libraries like fds.js it is able to be ported across to these new libraries but also work with vera s i don't think there should be ever a sort of hard line we should always have access to kind of all the implementations that we want um and you know uh one of the one of the things that was inside of the the the schedule was fair drive connect and fair drive connect is specifically something that is mentioned inside of the the fair drive repo and it is it is a it's an amazing idea which is essentially um something that get login if um tries to do on on a contract level on the blockchain level but um with application ids if if anybody is familiar with how portus kind of works it and i can give you a quick explanation um portis essentially what it does is um and i can quickly just also just log in and show you borders is a great wallet um that does single sign-on because you can put into that dap id and um essentially kind of have this login with you username and password it's kind of what you try to accomplish with get log in f uh without being centralized um for this is a great product but um uh you know we we want to we want to push forward the things that we're building here and want to get you guys building so the idea was to store adap id and to create a feed between the application that wants to connect to um to to fair drive um which is hosted and these these sort of thin apps will be able to kind of log in with a username password if they've already created one and create this uh connection with a feed with a swarm feed and i'm sure you guys have learned a lot about that in the in the past past day um last two days um but let's just jump into the code with regards to um with regards to the the quick thing that i put together for you guys um just to kind of step you through what i demoed yesterday and um you guys are more than welcome to pull down the code if you like and play around with it so first and foremost um we have the git login f which is hosted up on this endpoint and i've got a little application here which just allows you to create an account with get loggingnet it's it's this is all it does and it's just got um you know just the easy component that that has a one nice big function which i'll walk you through now if you guys want to get into the code um that i'll take you through the steps of of what this does and where you can kind of plug in other applications for single sign-on cool so i'm going to just pull across this code if you guys and please do ping me i'll try and see i'll pull down my chat box so i can see if um people dipping me from going too quickly so i've got a just a normal boilerplate it's a typescript react boilerplate and it's just got a basic sort of things inside of it like a you know app engine point and everything like that the most important one is just the create account component that is sorry wait the main component that has a lovely credit account with get login connect so first things first because we're dealing with uh contracts we have to create obviously a way through provider um just create a nice http provider uh you can use websocket provider i'm using an inferior endpoint for this um and we just create a an easy website provider you have to obviously have that to be able to send transactions and sign in um the next thing we're doing is getting a invite from get login if and essentially what get login f does is when a when a kind of user that has an invite already creates an invite it creates a invite wallet on the blockchain um i'll show you what that looks like right now um and this wallet is kind of seeded with a little bit of f it's uh it's just enough to kind of get everything started so that people can have uh kind of gasless onboarding um where i'm paying for the guys um when this account is created it kind of it emits it shows the the private key and the mnemonic because um this is on julie and it's not not real money and with that means that we can kind of use this as a starting point for almost any account creation so if you were to instantiate and create an account with fds by passing in the private key and i have spoken to dan about this um in the past weeks um and it is something that can can be done um so you could pass it in and have the same account on get login if as you would on on fbs so recruit in the car create an invite and you know we have a private key you guys if someone grabs us and pulls it away destroy my demo that's fine i'll just make another one and we just just for the purposes we've we've opened up the the memonica as well just so we can pass that in so let's go back to the code let's grab that one there uh so we've got the invite from the monarchy so this is a blockchain wallet it's a wallet that has a little bit of f in it and we essentially get that money or get that private key we get we unfill that account or get access to that that wallet and we use that to send the transaction which creates our new wallet on the blockchain so this mnemonic and this [Music] this mnemonic that we're using as an invite isn't the same one but we create this isn't the same wallet that we will be using for fair drive it's not the same wallet that we're using for the one that we want to push into fds but it's the new one that we create over here we can obviously emit the we can show people the mnemonic beforehand if they want to if they want to type that in but essentially the invite will be a totally different account so the invite instantiates the wallet that essentially just pays for the creation of this new wallet on git plugin f so we pass into memonic creates our invite wallet we create a whole new wallet and we encrypt this wallet with the password that we we give it um and since we're talking to some contracts we can just instantiate the contract we set that we're going to send this transaction from the invite wallet address so they're paying for the they're paying for the gas not me um and i'm just essentially in the storage contract here just for uh just to show you guys there is another contract involved here the logic one is how you speak to the the contract set and the storage one is is the one that kind of stores all the data for it um next we take in the username and make a hash out of that and then we send it off to this method called create username user from invite and that basically takes the username hash it takes the new wallet that we created which is encrypted and we basically pass pass a whole bunch of stuff um that is important to to to be able to access this wallet with that password um and be able to um actually use it later on the line uh pull it down and and log in with it in other things um over here we can see that we are sending a we're basically sending the full value we can over here we can change it to basically say the invite wallet give me all of the balance and send it off to this new one obviously taking it taking into account the gas that needs to be spent so um obviously this invite is created with like 0.1 f so um we just kind of send the whole amount and then obviously the data is uh just encoded uh data coming back from from from this uh from this method um which we got ready uh next we send it and we sign it and always good to add in some gas light gas prices and the gas limits and those sort of things um otherwise it might fail um and yes that is it we can run it now so let me grab this again and we've got our app here so i'm going to create a new a new user and i pop in my invite here and we can kind of step through the code here as it goes so that's what i'm i'm notorious for adding debuggers but they're very very helpful uh we first step through we have our website provider we can kind of check okay cool is this populated it is populated it's got my early endpoint which is a very very good thing i'm probably going to write an article soon about 10 gotchas that you get from working with wallet providers and web 3 and ethers because man it's it's very very crazy next we create the wallet from the mnemonic that we sent in which is our invite we've got all the stuff there next we create a new wallet we encrypt that wallet with the password that we pass in we instantiate our login contract with our wallet invite press as the payer next we're not using the storage contract so just ignore that next we get the username hash which is just basically taking the username and passing it into like a sickac 256 function which is on web3 and ethers click the info get the result sign the transaction wait a bit because it's on gurley and bob's your auntie we've got a signed transaction and if i grab now that it in girly use the scan i should be able to see i've created my user oh still processing there we go awesome so this has been sent uh you can see it's been sent to a contract address it's got all my data it's probably gonna be able to decode because there's too much but you can also see that it's transferred some some cache to this new wallet so that i as the user can do things with it so let's let's just log out and let's just try and see if that worked and hey so we purchased now with signing in we've given it our username our password uh that just gets sent off central to the contracts um as a read function and basically what we get back is our wallet and then we create our wallet and we log in so then we can check our balance and our username hash we can create more invites if we like and if anybody would like an invite please ping me i am inside the the swarm support group as kent or bmac so please anybody that would like to to get one of these or access to this i'll push the code for it now if anybody wants to try and connect get login f with fds on some other dapps i'm sure that fair drop could probably also you could incorporate this into fair drop which dan showed you beforehand and yeah that is the demo yeah you are like amazingly uh well-timed i can't um yeah i would like you to just hang stay around because um we basically the end the end of the official program uh so dan and danielle attila can you guys come back please there you are so um ah there you all are dan what did you think of this demo by kent i'm i'm so impressed honestly and i'm really excited to see that get lined up so it was always a problem that we had with fair drop and it's kind of like there's a cheeky hand wavy solution in the middle of it which is that we've got a faucet that dispenses fake money basically to test money and so i'm i'm really excited to see this get implemented and be able to get rid of the faucet and i think the invite system is like a great social um as a social approach so what's been a really difficult problem for the whole ecosystem yeah yeah i i also think that's it's so smart because um this is like literally thinking outside of the box or in this case thinking outside of the technology so so i think many many people have been looking for the onboarding and the gas problem solution and then i've seen like tons of technological solutions where you know with contracts and like weird going on and then the solution basically is so simple and so social right it's like you will always be on boarded by a friend or maybe your family that will say like you know you have to try out this thing and then you know you basically give a little bit of gas you know just you just hand it out basically to people you trust are yo it's almost like you want to invest into other people's knowledge right like i want to share this with you so i i think that's that's really you know thinking out of the box and yeah really neat because it solves the ux problem and the spam prevention problem all in one thank you danny yeah i was just saying like daddy thank you danny [Laughter] danny when did you do it when did you do this i mean it's this is a long time ago uh so it's been yeah it's it it it's been one of the changes for quite some time uh it was done uh together with igor so let's give credit where credit is due so uh igor shadurin in belarus it did all the heavy lifting with the code and i did the design the specification of how this should work and i think we found a sweet spot here yeah so so how so but but what i'm just wondering at what point did you realize like we're never gonna solve this you know thinking about code we need to involve human beings well it's so the idea has been floating around since the early days of ethereum so if you know alexander sanders who used to be the ux guy in the ethereum foundation uh so he's been floating the these ideas around since the beginning but somehow the exact getting right the exact mechanics was kind of elusive so uh he even when he was graduated from the ethereum foundation he started his own project called universal login or uni login and raised considerable funds but then he decided i mean the whole team decided to just give back the remaining money to the investors and fold up because uh because it's hard and you know it's there's this battle of giants going on between the platforms and the browsers and the platforms want to track you everywhere you go so the browsers need to purge various local storages of data so you can't really have secrets stored in local storage then there are all these security issues that you don't want one app to be able to access the secrets of another app so so it's it's kind of a moving target the whole browser ecosystem and this particular mechanics that you know that eventually got implemented as that login seems to be one where which is resilient to all these changes and sufficiently intuitive sufficiently secure and it it mimics the web 2 experience for which users have already been accustomed so basically you you get a link you click on it and you can afford it okay it took this long to get it right yeah and i know that's that's something we all have to i guess learn to live with uh to be patient and sometimes just wait on things that other people are developing or discovering even so petra you have or pedra or petra you have a question if you want you can just unmute yourself and ask it directly if you feel like that yeah i don't know i'm just wondering in terms of i know it's a decentralized file system we're creating decentralized logins for decentralized storage but this is a method of centralization within that decentralization right does this expose doxxing are there some use cases where this would not be beneficial versus i mean the obvious benefits from it right um danny danny actually explained this really really well in the in the first talk in march 2020 um for get logging in f um i think to paraphrase you you said that the account really um isn't it's not one that is dangerous to to to get um compromised because it has very very little ethane but there's also a way for if you do get doxxed you can essentially contact the person that gave you the invite and they can go through a sort of like knocking other person i'd allow you to change your password um but you know you're not supposed to store a lot of effort on this this is essentially just a kind of wallet to to to to pay for small transactions and to pay for some gas um i think you know a lot of the work that we did as linum labs was to get these contracts into a uh into into hardhat so that so that they can be optimized and run locally so that you guys can um can play around with them and see you know maybe they are optimizing optimizations to make to understand the code while you're running it as well we've got a deploy script there to to get you started up so you can spin the whole thing up locally um danny maybe if you could if you could say um maybe what where there could be optimizations against boxing for this so well just as you said so in the decentralized system you don't have customer support but you have the person who invited you so they are assumed to be more knowledgeable than yourself they have more experience with the system they have been using it long enough to decide to invite you and so instead of you know contacting facebook customer support you contact the person who invited you and they have some control over your account but you can cut this some article cord so so even so the the idea is that this is a social recovery it's called social account recovery mechanism uh and you can do all sorts of sophisticated stuff so you can say that you know those three two of two out of those three people have the right to reset your account and and let you choose another password or something like that so the the system is flexible enough to implement well not maybe not any but a very wide variety of social recovery mechanisms it's just the default one that your your point of contact is the person who invited you but you have full control in the sense that you can you can change this policy so if you you know you can designate for example you can designate another key for recovery which is actually on your hardware wallet so you say that if something goes haywire then i'm going to plug in my hardware wallet and reset my my credentials for forget login does that answer your question um to some degree i guess uh my concern isn't so much accessing wallets but identifying wallets as nodes and communications between wallace's edges and building out relationship diagrams across societies to identify networks well that's a tougher that's a tough that's a tougher knot to crack so yes we invited whom is basically out there on the blockchain and it's public information so it's not yeah it's not so this this particular mechanism does not hide that uh so i understand it as a public network tool and that's got obvious applications but um i i believe the more useful extension for me here is a non-public network tool uh but i wonder if there's a way to abstract this that eliminates that and i'm not sure uh so we haven't so we we we don't have a solution for that yet and uh to be honest this wasn't high priority so first we want to get the public network to uh working and allowing for so it's it's particularly hard to uh to do uh this kind of privacy on ethereum because precisely because of the gas prices so if nothing else you can track the you can track the path of of gas money like where the gas heaters are coming from and it's notoriously difficult to hide so i think that before ethereum has some uh meaningful account obstruction uh which they're working on i mean it's it's it's it's a problem it's not a pro it's it's not only a problem for us it's basically a problem for ethereum as a whole that doing untraceable transactions on ethereum is hard so now they have so now there's things like tornado cache where you can obfuscate the source of funds but even there you need to be very careful with the gas money so i think that we'd rather sit out and wait what ethereum comes up with to this problem and once there's some meaningful account obstruction mechanism or gas abstraction mechanism then we will incorporate it we don't so the r d for this particular problem i think belongs to ethereum rather than swarm i think we will have to wait until ethereum and zcash finally merge because this has been like a love story for a long time as far as i know um so who knows um attila i still have to ask you um [Music] sorry but gregor was with gregor had this wonderful question no sorry attila i think it was a question for dan actually was it difficult then sorry till i i know it's like stupid um then uh gregor was asking was it difficult to port from the old swarm to the new b um yes and no um i think it it has it's been quite difficult for me thus far because we didn't have the feeds implemented in the summer's library but once the fees are implemented then i think it's going to be very easy indeed okay thank you um i don't know if anyone uh has more questions i don't have questions coming in so i guess this means we can um you know close this this live talk event and start hacking i hope i'm gonna take a 30 minute break and then i'm gonna you know npm install bjs in uh in my app and uh i already updated the b note that's working like a charm and so i hope to see you all um until late hours european time my time in the telegram chat group i'll be hacking i hope you all are also going to do some interesting stuff and of course we can gather in gather town um there is an idea there was an idea popping up of maybe you know just pitching pitching some of the ideas the hackers had in getter town so you know people can see where they can join or what kind of technologies they use or i mean solutions they need so let's say goodbye here and see each other in qatar town um yeah good okay bye bye tomorrow you
Automatic transcript — names and jargon may be misspelled.