New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Shane Howley: Mainframe OS x Swarm | Swarm Orange Summit Madrid 2019

SwarmWed, Oct 9, 2019, 12:00 AM

Shane Howley: Mainframe OS × Swarm Mainframe OS is an environment for building, deploying and running dapps, that heavily depends on various Swarm technologies to enable decentralised, censorship-resistant storage and communications. This talk gives a tour & live demo of the main features of Mainframe OS that are implemented using Swarm such as: - Contacts - Dapp deploying, sharing & updating - Storage - Communications About Shane Shane Howley is a conscientious software engineer with a passion for concurrent computing problems. Shane has put blood, sweat and tears into a few startups over the last 10 years and is currently leading technology development for Mainframe. He holds a Ph.D. in concurrent algorithms and an engineering bachelors degree, both from Trinity College Dublin.

Transcript

hi everyone I'm Shane I'm going to tell you a little bit about something we built in mainframe that we call mainframe OS and with particular attention to what raising and swarm and how we've implemented various features using swarm features so first of all what is main for him OS so it's a platform for decentralized applications and we've taken like a little bit of a bit of a different tack than like web 3 dots so we're actually following more like the sandbox model so closer to how apps exist on iOS and Android and so yeah observer sandbox by default they have to request explicit permissions to do anything if they want to escape the sandbox developing the daps the defaults are always to provide or to preserve privacy and security for the users and really like using cryptography and the centralized technologies consumers just be really hard for a newcomer so we're just really trying to make it easier for developers to do the work do the right thing without having to get an advanced degree and yeah so also the the adapter build using web technologies so basically you're going to be using javascript and so I'll just give a quick status on what stuff we have implemented in our SDK already so the web 3 stuff as far as I know it's mostly all there you can so if you have an existing aetherium gap and you're using about 3GS it's basically just like a drop-in replacement to just hook your web 3 provider into our sdk and everything should just keep working for comms so previously we we've been like big proponents of PSS and think it's awesome we've had some issues more recently with basically if you're going to use PSS you're going to be running a full swarm node which is difficult for onboarding users convince them to do this so we've actually removed some of the PSS stuff and we're hoping to put it back in one slight nodes are available and then it's a bit more palatable for for new users coming on so all of the communications stuff we have right now is using feeds really the way we envision comes to work is by having feeds as pretty for a persistence layer and then layering PSS on top for like real-time snappiness so we see them kind of coexisting but right now yeah we just have feeds so you still got the persistence which is nice in terms of storage API is right now we're just providing storage for the like the local user so we're not supporting files oh well just currently it doesn't support like sharing files with other users but obviously this is something we want to do especially things like images or avatars you know this just makes the app feel like nicer for the user so this is where we're going with storage but right now we have just personal storage down on the encryption side we're still just kind of getting up to speed of this we just want to make it work first on the encryption side the local storage is encrypted for you like your private data but currently all the communication stuff is unencrypted but obviously we want it all to be encrypted and all the pieces are in place to do it we just have to implement it and so the rest of the talk is mostly going to be like demoing like May for us and what you can do with it today I'm just some of the flows that we think are interesting and I'll talk about how it hooks into swarm so yeah like whoever's closer to the video screens is gonna have a better time and also hopefully the videos will work in this Libre Office so those are the onboarding so once you open the app for the first time we ask you to provide a password and this is going to be used to encrypt your local data on disk so things like your keys and then keep them secure and once we do that we ask you to create an identity okay I've anticipated this and I'll just play the videos directly open source is it gonna play okay and so yeah we saw this so we asked you to create an identity so this is just used for like communicating with other users and signing data and this kind of thing so you give your name and you have the option to make your identity discoverable and this is really just gonna make making contact with other users more convenient we also asked you to create an aetherium wallet and then this is just mostly used for the web 3 integrations so this is just this kind of standard while I'm boarding so you can import an existing wallet or create a new one we show your seed phrase and impress upon you that you must store it somewhere safe and but I'm not going to do that and I'm gonna skip it this is what then when you come to the main home screen in mainframe OS so this shows like your applications and if you go to your identity you can see the identity you've already created with an ID and this ID is gonna be used for making contact with other users ok so I'm gonna just show you like one of the basic taps and then how it uses storage this is a dock we get we just created called noted it's just a simple note-taking app so if you want to install a dock you click install it'll show you before you install it what permissions the dock requires and then if you're happy enough to accept those permissions you can download the dap from Swarm it'll store a copy of the deck on your local disk and then now you have the option to open it so depths run inside their own sandbox windows as you can see here and yeah so this staff here just allows you to create some private notes and then in the background when you're finished making changes it will stink it syncs it to your local swarm storage so that if you need to recover your your fault which is where all your keys are stored then you can you can like regain access to all this data ok so now we're going to talk about how we make contact with other users oh yeah so I'm gonna just show you one of the data structures that we use and so it's this okay so I showed you this this IDE earlier that I said you could share with other users so I'm not just gonna this is just really a feed hash so I'm just gonna look it up and swarm and I'll just show you like what the public data that's shown is so when other user downloads your feed they can see your [Music] sorry I thought it was paused okay they see your public key and then some of your profile information so because I made my profile information discoverable we see my name and my aetherium address and then this really just helps with the contact integration it means you can unlock more functionality and I also have this first contact address and then this is going to be used to help like bootstrap communication with another user so the one of the problems but using feeds for for like a cold like connection with someone else is that if you create a feed and send them a message they don't necessarily know where to look for that message so we're calling this like bootstrapping problem first contact oh yeah I want to see that video okay so the way we've implemented this is using feeds mm-hmm so when you want them so this is one of our users Alice and she wants to make contact with Bob mm-hmm so the first thing she does this Bob has to send her his contact feed and then so she gets access to his public key and his first contact address so the first thing she does is create a private feed that is gonna be used for her communication with Bob she then encrypts a reference to that feed using Bob's public key and then post that in another feed and this feed is going to be in a predictable locations because but because Bob needs to know where to look for it so our predictable location is used is determined using Alice's first contact address so when when Bob looks up alice's feed he'll see her first contact address so she uses that as the user and then the topic is bob's hashed public key and then bob can use this data to like discover this feed and then find out and then decrypt this data and then find out where the private communications are going to happen so once alice does this she needs to see if bob has reciprocated so she takes bob's first contact address and hashes her public key and then we'll just start like polling that location and then wait for Bob to to like publish to that feed she knows where the the feed is gonna be and she's gonna wait for Bob to do it when Bob reciprocate now they both know about these two private feeds so these can be used for like bootstrapping any further communications inside mainframe OS and to give you to show you what that looks like and so I've got Bob's feed address in the clipboard so we can have a new contact we can just see use public data first before we try to do anything we have two options here for making connection the first one is the one I just described and we have another way which is like posting a message on the blockchain which kind of solves the problem in a different way you know we're going to talk about swarm so the swarm way is the main way so bob is pending so at this point alice is like polling the predictable feed location for Bob so now on bob's mainframe voice we're gonna do the opposite so we add Alice's feed and we can see that it is Alice and try to make the connection so now they're both friending they're both just like holding each other's feeds and then eventually once they see that the other person has initiated first contact as well they'll mark them as like connected and you see so now they both now that we have a bootstrap communication between these two users and we can do like other fun things so one of those things we can do with the etherium address is just directly be able to like interact with that user through the etherium dress with like web 3 stuff and without having to like copy and paste etherium addresses so users who are may be intimidated by dealing with the dresses don't need to deal with it so this is just like a toy app for just sending crypto to other users so you're gonna initiate a transfer when the adapters to interact with contacts it actually comes up in this that pop down box and that is like a that was a protected part of the UI that is only controlled by my parent West so that so the DAP has no access to the contact list the staff has to request access and then when you select the contact there's like an anonymized reference to that contact handed to the DA and then as the user are as the dap cause it calls sdk functions with that anonymized contact address they're performed with the real contact data so it's just a way to kind of like try to protect your contact list from being like scraped by malicious taps so yeah we're also gonna look up about how you actually like create apps and how you deploy them and what functionality we have there and so if you create it this is just like me creating a doc here so give this app development tool in my favor so first create a developer identity which is how you're gonna reference yourself as a developer and then you can add a new death and then fill out some information about like the version and the name of your doc this is a react adapt I built so I'm selecting the build directory for where the static content is going to be spat out my deaf is going to do communications with users so I'm going to my that as a required permission anything that's optional will like prompt the user if you try to do that thing but I'm explicitly saying like don't even bother downloading the staff unless you want to do communications so now I can work on developing the DAP so I open it up right now it's not built so there's nothing in the bill directory but if I'm using the nice react tools to do this I can start a local web server and just be testing it in that and then still get access to all the like existing JavaScript development tools like the you saw the chrome debug tools there it's gonna ask me if I want to access loco hosts because generally accessing the web is not allowed in my fam apps and you can see here it's prompted me for another permission to access contacts because maybe I've forgotten that I also need contacts and I'm gonna want to change that later so there's an example of some of the UI in my mood to death and I've decided that like I want to change some of the styling so you can see you you've got earlier like hot reloading and stuff you get from the react development tools so you can use your existing development tools to do this yeah I like the size of this better so I'm gonna make it big okay so that is how you that's kind of the development flow for building adapts on mainframe OS so then publishing so for publishing the the apps we're using the timelines that Milosz mentioned just before this and this allows you to have like a history of app versions so that if you want to like roll back or like see what versions are available and all the changes you can you can have access to that and this one okay so I finished building with my real time debugging so I'm gonna build a production debug build or our production build of my dad and then it'll it'll get dumped into the the bill directory which is just gonna be like my static content my JavaScript files and then I can click publish in the app development tool you have another opportunity to change your informations and I decided I want that contact permission so I'm gonna make it required and then click publish so what's happening here is first of all you're uploading all your app content to swarm then you're uploading a manifest which is describing the permissions and like signing keys for the death to prevent like malicious updates and all this sort of stuff and then we're publishing a timeline which is pointing to that which is gonna be able to track the history of the versions and at the end we have like a reference here that we can use for sharing the app and again internally it's just going to be a warm feed and so then once we have this feed hash we can share it with other users so I want to share my new app with Bob so I can send him my app ID he can install an app paste my app ID first of all it download the manifest for the file to show like the name and what permissions it requires Bob's cool with that so he's going to download the app so downloads a copy of the app just like we saw earlier and when it finishes we can open it and you know it should look the same as the the app that we created earlier so yeah there it is okay we can also update apps this was my attempt at making impress work earlier but it didn't so that's why that's there and updating so this is about like you can publish updates to your app and then other users who are your existing users of your death will just detect these updates and be able to download new versions so I'm gonna assume that I've changed the code and made some awesome improvements and I'm changing my version number to indicate that it's like a patch release I have the opportunity to like rename my app if I think it has a like a better name and I can change the permissions in case I've added a new functionality but I haven't so I'm gonna leave it and then publish the updates so this is going to do the same thing as we saw earlier with your first update it's going to publish the app data then upload the new manifest and then it's gonna publish the timeline update to that Dapp it took a while when I was demoing this earlier so at some point later bauble detect the update and he has the option to update from version zero one zero two zero one one and he can download the app and start using the new functionality so in this a freezing communications I'm just going to tell you a little bit about how the feeds are structured to to enable like all the communication between users because again like like I said we wanted to make it easier for developers to access these tools and to kind of do they just want to make users communicate they don't necessarily want to learn all about swarm and have feeds work and everything so the way we have that implemented is this is the contact feed which is like the private feed that we saw created way back when we talked about first contact so some of the information in that is like private profile information so you might have like additional information you want to reveal about yourself to your contacts that can go in there we also have information about apps that the youth that the user wants to interact with you with so these are Heidi's it's a key values key value list which is like an app ID pointing to another feed specifically for that app so in the app feed it's got more feeds so within the app you could have different types of communications that you want to do so you might have like this things an image and this thing's like a list of messages and you want to keep track of all these things so again this is just like another key value store so we got just string keys and then each one of those points to another feed and then that feed is one that's actually used for the Cubs so you're all your application layer data gets dumped into these feeds and I'll just show you what this code actually looks like so this is the code from everyone see that there's a good code for my moods app so when I want to select the contact that's going to be used to that I want to interact with in my app I call this function contact start select contact so I'll drop down the contact picker and once you select the contact it'll get callback into this code and I'm going to try to fetch that user's mood when I'm trying to fetch the users mood the first thing I do is check what subscribable feeds that user has already created for me and crucially I'm looking for the one with the key mood if it doesn't doesn't exist I'll wait and then see I like check again in a few seconds see if the users created it but if they have created the mood feed I'm gonna subscribe to it and what this does is it will I mean in the background it's gonna be polling the feed for changes but how it's gonna work in the front-end is you'll get it'll return the current value that's stored in the feed and then only when the feed is updated you'll get the call back again so it's just kind of like Handy convenient stuff so if the user changes their mood I'm gonna just set the variables and then update and then the other comes thing is about when I'm setting my mood so if I choose my new mood i iterate over my contacts because each each communication is per contact so I'm gonna iterate over all the contacts that have already shared with the DAP I'm gonna call comms publish to the mood feed and I just dump in the mood and timestamp so like it's just like super easy JavaScript JSON style updating here and so now I'll show you what that looks like in the actual death we can get this to play okay so this is Alice she's opening the moods death and she's gonna want like she's made friends with Bob now so she's gonna share her mood so the first thing she's gonna do is hit that drop-down to access the list of contacts and choose Bob checks Bob's feed if there's nothing there because bout it Bob's never used the app yet but she's gonna send her move it anyway and that's gonna write to her contact feeds for Bob see ya and then this is Bob's instance of the moods ax so Bob is gonna do the same thing he's gonna want to know about Alice's mood so he adds her initially like waiting for updates for like the was like there's all the feeds that you have to run through you kind of are like polling them all on a timer but he's that's his mood and now you can see he's received Alice's mood from her his polling of her feed says description is fired and then hopefully Alice will also get the update because yeah so I got this is what I was talking about with PSS versus feeds so right now everything is kind of like asynchronous like this because we're just for it lying on feeds and like constantly checking to see if well I'm a timer checking to see if they update and we've gotten Bob's update but once we have PSS layer down here - the hope is that like this will all be like way more real-time but yeah like I said earlier really light nodes is gonna be the key to like having this real-time snappiness and that's it so I hope you enjoyed the demo and thank you very much [Applause]

Automatic transcript — names and jargon may be misspelled.