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

Loading player…

Decentralise your dApp UI with the permaweb

ETHGlobalWed, Oct 9, 2019, 12:00 AM

The team from AIRWEAVE explains building Permaweb Apps with Airweave at a workshop at ETHNewYork. ETHNewYork was a hackathon organized by ETHGlobal and a team of hackers, developers and enthusiasts interested in building and creating in the ethereum ecosystem. ETHNewYork ethereum focused hackathon took place May 8-10, 2019 at New Lab at the Brooklyn Navy Yard. For more information visit https://ethnewyork.com/ and https://ethglobal.co/

Transcript

yeah I guess because it's fairly small group we may as well just like chat to one another and that's I don't try and build something and put it on the are we even see what happens I guess okay so the olive is basically a decentralized storage platform that exposes data over HTTP it's pretty much what it does it also has like a database which provides you with a way of indexing tags that are associated with data but you can use it to do things like this so you can think of it essentially it's like a web right here's an hour weave transaction has been sent to the network and we're accessing it through a gateway and this transaction is including the network itself and it's saying hey tell me about all the apps on the network that have been submitted with this particular Wow myself with this particular kind of content type and then it renders it into what you see here so it looks and feels just like a normal application so if I log in for example I can drop my key file here so the current trust model for these kinds of applications is pretty simple it's don't give it a key you don't trust it to use so you make a new key you put as many tokens as you're comfortable with the application using inside and that's basically it so now we've logged in we can do normal JavaScript stuff so like where we've it is a core alike application built on top of the are we you press the button it sent an advocate is sent the transaction to the are we've network now so if we look on view block which is a kind of a bottom floor it'll take a little while to settle data all right here we go so this yeah that's a perfect actually so the transaction I sent the network just looks like this one here so it's got a bunch of tags associated with it and it says I'm voting and I'm voting up this content here and then inside the application what's happening the backgrounds is just um yeah it's currying the network just as you would with any normal web application and there's a consequence it's hiding out how many votes each thing has it's very very simple but it allows you to basically build any kind of web application that you would normally build in the normal web except in a totally decentralized manner so this is going to the our we've done it can't wait but normally on Chrome if you have the web extension installed it'll go around the network it finds nodes and then when you need a piece of data it just gets it for you it's very very simple yeah and I guess the main use for it here is like if you have a smart contract that lives in etherium it's basically gonna live forever right if you have a UI that goes of that smart contracts say like a web UI which is like maybe 2/3 of smart contract verifications it's gonna die at some point that's not great so instead you put it on the our weave and it lives forever as well so now you have a permanent UI to go with your permanent back-end it's really simple and you just interact with meta Matic like you do in any other system so like let's just try so to get started if you just go to our live to look you can go to hosting and then say deploy a page now you know take you through the documentation okay read the docs fine so you go here we literally just say npm installed SG r we've deployed just a deployment tool and then once we've got it installed we can just say now if I know this is gonna be tiny text isn't it great okay go and then that is too small all right there we go good we can see it so now we just have to say how we've deployed and then the name of the thing HTML and then we give it our key file except actually mine's already loaded so you would just say - - key file ah sorry right in the docs here it points you to you can go to tokens are we've talked it's very simple like if you just go there it stings you from the website you just put in you know unfortunately have we had a continue with github link and we wanted to make one that actually allows you to like generate a proof of work in the browser and use that as sort of civil protection except there's civil protection that was this problem with doing that in the browser which is that they like killing all these crypto miners so if you do that then they think you're a crypto - it's not great and also we had a github on with it turns out github doesn't verify email addresses so people just like spamming out once and grabbing free tokens but if you have a Google account then you can get five free tokens it's super simple and if you don't have a Google account you don't want to use Google and just like shoot me your address and I'll give you some tokens that's fine yeah so you go here you grab a key file like that you download it and then you would just say - - key file here but we won't yeah and then we'll just say deploy so it's asking me for that key file so it says yeah you're gonna send this files 62 bytes blah blah blah blah blah the tags will be content type this so one thing that happens in the browser is when you render it with yeah when you like access a transaction with the browser the HTTP server on the r-wave node will say okay I'll take the content type and then I'll give that as a HTTP header so that means you can like upload PDFs or whatever you want and the browser will react the right way yeah it says are you sure you want to do this because you can't take it back it's just like your theory aman says deploy this forever it's literally permanent sacrum and now it says okay it'll be there and we can check the status here so the key thing maybe it's anyone who use like EFS okay so ipfs has this idea that the data should be super fast to write and very well they don't have the idea that it should be slow to read but the practical like reality of the matter is it's very very slow to read we have the opposite so without Eve you have to wait for your transaction to be mined into a block and it says pending here and it'll do so for a few minutes but once it is actually mined in took a block is super fast so it can get the data to the user and kind of like sub 200 milliseconds approximately where is like with IKEA fest you might be looking at I mean we tried it once it literally took 30 minutes to find a piece of data ipfs yeah yeah so if you don't have the data cached locally mi PFS it uses kodi neeya which was this like distributed hash table that was invented in 1999 and hasn't changed very much since and it's like basically the principle is everybody takes sort of random key they the mirror roots for a sort of area of addresses and the longer they're online the more addresses and locations they get but you know when you speak to someone and then they don't give you the data so like that note has gone offline or something you actually have to wait for it to timeout so it's extremely slow however we have the opposite system so what we do is we mined data literally into blocks and then we incentivize people for storing blocks and we require that they rather we don't require that they store all of what so they're just rewarded proportionally to the number of blocks that they do store yeah and this means in practice that almost well everyone has an incentive to store every block and storage is cheap hashing is expensive and as a consequence as a consequence there are very large numbers of replications of a piece of data so we get rid of the data finding issue which is like like ipfs you get started transferring the data it's very fast but it's the latency for finding the data that makes it very slow so we have this system that basically makes the data almost everywhere and the consequence is very easy to find yeah and that's how you can get the data in like 200 milliseconds no not at all no this is completely separate from mine yet sorry yeah so we actually have a system for incentivized data finding the will deploy before he gets to the point where it becomes slow but you can also just like do next hop routine basically so each of the nodes in the network grants every other node that it speaks to as a consequence it builds up this kind of map of who you should speak to first and then if you ask for a transaction and it says oh sorry I don't have that transaction it just sends you to another randomly chosen person down the street there's a consequence you just bounce around so if you hit your browser at it it'll literally because it's like everything is HTTP in the system it'll just redirect you down like a rabbit hole of nodes until you get to one that has it it's sorry no no no so the thing about our me visit is building a permanent web like really permanent so once you put a piece of information that's true but they can't remove the incentive for storing all data so there is always an incentive for other people in the network historic yeah so actually what's happening in the background how goes my slice is we use this block we've structure rather than a block chain so basically the idea is instead of just including the hash of the last block in the next block which makes the chain we also include the entire contents of a randomly chosen previous block but the thing is until you get to this block you don't know what the random recall block is gonna be for this block it's doesn't actually work that it's more about transaction size so the moment the transaction size limit is 2 megabytes or rather 3 megabytes but there's some overhead except it's like in the very near future we'll push that to about 20 megabytes and then in about a year we think we can get it to like terabytes it's like a so what we're doing currently is the proof of access that happens here so let me just write so you have to have the Ricoh block in order to mine the next block and you have to prove that you have access to it the proof at the moment is fairly large and this is why the size has to be fairly small but it's big enough for most web replicate almost all web applications and that's what it supposed to be useful what we're doing in the future is moving to this system we call us extinct reefs of access so it's pretty basic you take the data inside a transaction you split it into tiny like chunks we think maybe 128 bytes then you generate Merkle tree and then you put the root of the Merkle tree into the transaction rather than the data itself then you distribute the data off chain using some kind of yeah we actually think we're probably use gonna use BitTorrent for it because it's good and it works you distribute the data in that way and then you can make us extinct proof that you have access to the data by just giving like 5 or 10 or maybe 20 100 doesn't really matter different chunks from the data and Merkle root path right so then someone that just has access to the merkel root can say okay yeah no that is actually the piece of data inside the system so it depends I mean yes is the answer but it depends on the kind of data as to how you do that so like if it's a web application you should just issue another transaction it's not that big a deal so these these web applications cost like so for example I think this one was like 0.005 R which is like so small a fraction of a penny I can't really calculate in my head it's like very very cheap so the problem is more that you have to wait some period of time and you just make it part of your deployment system so like when I deploy I wait 15 minutes approximately but once I've got it there then it's super fast and you can you can actually point users to this in production like it's fast enough that they won't really know that they're using any weird decentralized technology it just looks like a normal web page you can also hide this stuff behind DNS if you like and still enable TLS sorry so it is all down to incentives so we basically flipped the game like it's still hard to find data and decentralized networks but we just make it so that the data is almost everywhere and there's an incentive for people to do that Mary yeah so if you put a piece of data into it today so if you store your web stree UI on it you'll get like 400 copies yeah but so is Bitcoin money so so whether I mentioned that because what's happening here is you're making the storage of that data part of the mining process right so if you don't have access to that recall block you can't take part in a hashing competition so you have an incentive to store that recall block and because storage is super cheap you have a larger incentive to optimize that first so store as much of the block move as you can before you spend extra money on like CPUs right yeah yeah so the what we're doing is essentially just offsetting value that the miners were otherwise going to expend on this other expensive process like hashing is a really expensive thing to do and it's completely useless we just made a proof-of-work use create like positive externalities you can think that as you can warm houses with hashing that's true we actually do have a miner one of the people in that community he comes from Berlin so he's German and I can't quite tell if he's joking when he says no I am warming up my room it's really annoying when my my miner isn't on because Mike my room gets cold I can't quite tell if he's joking the thing with this system is it's actually kind of cool right when when it gets stretched you just if you don't have the data you do nothing so you just don't expend any electricity at all and subsequently your miner is just like sitting idly but that's the most efficient way to mine this it's kind of interesting but it does make your room cold yeah so actually what we expect people will do like when it gets large enough so at the moment they're just incentivized and they just draw the whole thing pretty much everybody we think that'll actually stretch into the like terabytes before that stops yes but we think sort of in the longer term people probably make kind of group mining systems so like when the CPU is not mining this they'll go mine mana row something like that yeah exactly so the first node you hit so actually a white board would have been way more helpful than that screen the first node you hit will basically say okay do I have the data if I don't have the data I send you to you make a kind of exponentially decaying curve and you rank your peers on how likely you expect they are to have to the data and then you pick slightly randomly right so you go down the list and you say okay well 50% chance I pick the first one 25% chance the second one twelve and a half percent and so on and this essentially like sends you around a random route through the network until you find the data but in order to build up the rankings and why the rankings are so successful that doing this strategy is because we essentially user system that's kind of like optimistic tip attacked from BitTorrent if you're you're naughty naughty okay so you know like the basic principle is if I give data to you you give data to me and then every so often we just randomly give data to each other and the equilibrium in this system is just like you just everybody gives data to each other all the time because like you have that small optimistic element right as a consequence you're ranking each other all the time on how fast you give data and the amount of data you have and this kind of thing so like if you tell you've got a piece of data if you deliver it to me and like you know sub-millisecond and I'm gonna rank you way higher than the guy that says he's got a piece of data with this actually like five seconds to get it from so each node in the network is building up this kind of off chain reputation for every other node they speak to and then when I come to you and I say hey if you got this transaction and you don't have it you say well I don't have it but this guy over here probably does and because of the random routing you don't end up in cycles you just kind of explore the network until you find it it's extremely fast extremely efficient and we're going to change it so after we do this sort of fast write project which is the thing I mentioned that allows you to use a 16 proofs of access to like write very large amounts of data into the system very quickly we have this fast find project which is that when you ask for a piece of data and you don't have it you you essentially send them down the route just like you do now except what you also do is you you give reputation to the people that routed you to the right person and as a consequence even if I've not got very much storage I can by making really good routes of the network I can still get a fairly good reputation and reputation is good for me because it doesn't just mean that I can access data quickly but transactions and blocks are distributed according to those ranks right so if I end up at the bottom of everyone's ranks I'm gonna need the last person to get the data the last person to get the block there's a consequence I'm a really crafty miner but if I'm the top of the list then I actually have an advantage over the rest of the network in fact at the bottom that you just get dropped from the network completely so you have this incentive to really compete for ya bandwidth and in the future compete for good routing paths as well yeah um yeah does anyone have any questions I guess zip yeah aha oh yeah sure so zapier is really young simple like it's kind of centralized which makes it bad but like you can at least use it to set up little notification systems so we have a bunch of bots on our discord server for example so my homepage is a an application built by someone in the community that just it's good we've watch it again it's served from our we've it's a perma web app itself and it just goes through the weave looking for stuff and that transaction that we sent a few minutes ago is now here so this has got an ID we just put the ID and the thing and you get that yes Zakia you can get an account with zapier you just press this button to sign up to our thing and then you can make these sort of pipelines so if there's a new tweet from Donald Trump for example someone's been archiving those all the time it just gets the data puts it in our weave transaction it sends it to the network all the time and the other way around you can actually integrate it with like hundreds of thousands of different things using that yeah not hundreds of thousands with at least like 10,000 a thing yeah no problem um yeah so in the context of aetherium this is just a very very simple way to store your UI in such a manner you can actually give that link to people and they can use it and it doesn't take them five to thirty minutes to load the webpage like it still has a really strong user experience and I think if no questions yeah cool oh oh I guess also we have like a that's interesting we have a bounty like fifteen hundred dollars for the best project there's stores it's UI on our weave it's very simple so it's like you just use it to store your UI it's just like a normal web application okay thank you [Applause]

Automatic transcript — names and jargon may be misspelled.