Web 3.0 Explained

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello world it's Suraj and welcome to the first video in the decentralized applications course this video is called web 3.0 explains pretty self-explanatory title but what I'm gonna do is explain why we need web 3.0 how it works how a blockchain works and at the very end we're going to write out our own smart contract in the solidity programming language to the language of aetherium so it'sit's gonna look kind of like this well we'll say okay here's an integer create it's gonna create a value in this contract object and this is on a decentralized virtual machine I know right now it sounds like a bunch of crazy what are you talking about but don't worry we have so much to cover in this video I'm so excited so just sit back relax and get ready for some amazing amazing stuff because this stuff is just it's it blows my mind every time I look at it it blows my mind so that's that's the demo at the end of the video but we have some things to cover first so this is the only part that's gonna be non-technical at the beginning and that is the why why does web 3.0 matter okay now it's very important so web 1.0 we've that was the birth of the internet web 2.0 was the creation of the services that we all know and love Google you know all these social networks the snapchat everything that's web 2.0 now we need to move to web 3.0 so I'm gonna explain why okay so this is actually a multivariate problem there are multiple reasons why we need to move to web 3.0 so but I think the easiest reason the easiest the main reason I could give people that people would care about the most is that if you want to build a startup that can compete with the big giants this is the only way to really do that or it's the best way it's the best way to do that so if we look at web 2.0 the first problem is there is no room for competition look at these services that control the internet at this point all traffic goes through Google and Microsoft and Facebook Baidu Amazon these companies have the most money they have all the data they have the best talent to create the best algorithms they have the most computing power how is anyone supposed to compete with these people right they have everything they have all the resources how are you supposed to start a start-up in this day and age well the answer is decentralized applications so that's just the first problem with web 2.0 the second problem is that we have a shrinking economy it's a winner-take-all economy right now what I mean by that is the rise of these services the rise in terms of the valuation and the data and the computing power and the talent as they grow bigger and bigger and bigger they have created this kind of winner-take-all economy via the internet and it's responsible for a lot of the income inequality because all these services that used to be that used to belong to the creators to say for example the music industry now it's all those profits are being concentrated centralized into these giant what Jerome Lanier one of the pioneers of the internet calls siren servers Amazon Google Facebook etc so take the music industry for example the internet liberated the distribution of music great Spotify Pandora iTunes but what happened is working-class musicians their earnings have consistently gone down over the years and they become this underpaid underclass who can no longer count on royalties as the basis of a sustainable middle-class life the internet rocked everything in the music industry right and now musicians can't get paid so this is a this is a problem right this is this a real problem because in a good economy we should be monetizing more and more but in a bad economy or monetizing less and less and that's exactly what's happening as all the data the real value in this new world that we're building all of it is being owned controlled and monetized by a few key entities you are not owning your data which brings me to the third problem data ownership we no longer feel like we can control our data you don't own it you're giving away your free data in return for a free service and this works well enough however its cause the economy to shrink over time your data is being used to spy on you take prism for example advertise to you two things you wouldn't even know I was talking to a friend the other day and then I saw the ad for the topic I was talking about show up in my facebook messenger they are listening in our phones they're listening in our Google homes they're listening everywhere okay and they can do that because we've given them the permission to do that we're giving them all our data and they are profiting off of our data we should be profiting off of our data fourth point accountability right Edward Snowden became infamous when he told the world about prism right that US government NSA surveillance service he said well look all of these companies have partnered with the NSA to give away your email your chat your videos your photos all this stuff and we can't really do anything about it right there's no oversight it's there's no transparency into what these services are doing with our data there's no that it's a one-way street you give them your data they decide what to do with it that's it hands-off they'll govern how it's used this is a problem okay so another person is Tristan Harris so Tristan Harris is an X design ethicist at Google and Tristan Harris says that these siren servers like Facebook Google Amazon are competing for attention we are moving to an attention economy the Facebook newsfeed for example is optimizing for your attention because that's what drives their ad revenue business model however this is a problem because what's what gets your attention isn't necessarily what's beneficial to you it isn't necessarily what's good for you what they should be optimizing for is your time well-spent and that's the movement that he's working on election tampering we have no say in the governance of how these systems are created fifth point artificial general intelligence okay we have got way too many problems in the world climate change existential crises like asteroid impact and pollution and disease and warfare and this is way too many problems in the world but if we solve a AI we can say solve for X and it will solve literally everything if we solve real intelligence aka artificial general intelligence so it is to be seen that AGI is the most important thing we can work on to solve all these other problems beneficial AGI maybe there is a missing link to creating AGI what is that missing link so if we think about an AI as a control system right a control system that has a controller it has a state it has systems for sensing the world motor sensors from moving around internal forwarding mechanisms to transmit all this data you don't understand all this right now this is kind of just an abstract general idea of how an AI runs how can we let this AI make decisions on its own and learn by itself in a way that's not controlled by human right now we store our AI on a server and we control everything about it but what if we let it free and live into the live in the world and make its own decisions what we would need some kind of decentralized service not controlled by anybody right so if we create what's called an AI distributed autonomous organization don't worry if you don't understand that word but what that means is it's a new breed it's another word for decentralized application Dao Dao it's a new way of creating companies of entities on the web so if we link these two technologies together AI and blockchain we can see that the AI it's getting its missing link resources like cryptocurrency that it doesn't depend on any central third party right and the DAO the blockchain gets its missing link autonomous decision-making so we put these things together and we create something like a living entity that lives on the web and the last the last problem is data permanence so there's this idea of book-burning right in the middle-ages book-burning was considered heresy it was considered one of the worst things that anybody could do because books were the store of information right so book-burning was a really bad thing so right now the way we store our data it can be lost over time right yes it's stored in a data server and yes you know that server could go down but maybe there's a backup but ideally all data is replicated hundreds of times across the web so you could never never never destroy data think about all the things that really matter to us scientific discoveries and Diaries and memories of your loved ones and lost you know things over time you never want it to lose so we need a way to create data permanence so six six reasons okay so six reasons for this so I'm gonna take all those reasons and provide a single solution called a decentralized application okay so what is now possible with the advent of the the Bitcoin blockchain a couple years ago we discovered that it was possible to create what's called a decentralized application that is an application that that is not controlled by any single entity so if we look at this map of different types of networks the centralized network is like this where the main all the other nodes like let's say humans or computers rely on a single server okay so that's the centralized model there's a distributed network like this okay the one on the far right where there it could still be centralized but it's not just dependent on a single node it can have it can be distributed so for example its type of system can be both centralized and distributed Facebook for example it doesn't have a single server it's got multiple servers but it's controlled by a single entity so it's both centralized and distributed across the world but it's still controlled by a single entity now decentralize is a new type of system that was enabled by Bitcoin it was the first decentralized system what that means is if you take away one of those nodes the system will still run because it doesn't depend on any node however for a distributed network that's centralized you take away the central node the whole thing collapses but for a decentralized system you can never destroy it so you can now create an app that's number one open source and profitable that's never been possible before either it's closed source like Microsoft Office or app anything but Apple and it makes money or it's open source like Ubuntu or Firefox and you don't make any money for the first time you can make an application that's both open source and profitable second of all this can be a community governed / controlled application all of these actions that we perform inside of this network whether that be you know what to spend our money on what a hire how to market the product how to make sales we can create a structure using the blockchain we're the people who use the app can also opt in they can also say let me vote on what we should be doing I'll get into how all this is possible later on and lastly it can create we can create apps that are censorship resistant so this is an example of you know the app store rejecting a certain app because it it's it doesn't abide by Chinese law etc you know the Chinese firewall blocks a lot of applications from entering because all of the apps that are mainstream on the Internet today are not censorship resistant but if we build a decentralized app no one that the Chinese government not any kind of negative entity could block your application like the Chinese government can't stop Bitcoin they can also not stop any other kind of decentralized application that we built so there's a lot of hype behind the centralized applications ok but the problem is it's kind of like this trade-off right so right now a lot of the decentralized applications out there we are sacrificing speed and cost and scalability and sometimes even user interface for one single thing and that is censorship or resistance however as more people build these decentralized applications this seesaw is gonna is gonna tear this way so it's gonna be more even and then all those things will go to the to the left side so we're gonna gain back some of these things that we're sacrificing for the sake of censorship resistance so that's what we're building we're trying to get there we are getting there very fast all these problems are being worked on so how do we get started ok so how do we get started with web 3.0 well it all starts with what I like to call the linked list so this is in Python don't worry if you don't understand it it's just a very very basic class with some functions but the linked lists is a simple data structure that we learn in data structures 101 the linked lists is basically a way to store data so a link looks is like this let's say you have a phrase like hello Stack Overflow and you want to store that in some kind of data structure let's say a linked list this is how it would look ok so we'd say let's create a class it's called class node and this represents a single node like this little box inside of a linked list now this note is gonna have several functions that will create the first function is the constructor function we'll say what is the data that we want to give this and what's the next node in the list so we'll say initialize it with hello and then say self dot next equals none but we're gonna set what the next note is so just kind of block out all the other other two boxes there's only one box and now we'll see create functions for getters and setters so get data says return whatever we store it in that single note which would be hello get next we'll say we'll get the data in the next node that it's connected to set data will say set what's inside of that node so we'll say set data hello or whatever we want to store in there and lastly set next we'll say we'll set the data in the next node which would be stack and then set next again would be overflow so now we have this linked list of hello stack overflow three different strings stored in three different nodes the whole thing is considered a linked list so this linked list is a immutable data structure we can change the values in this linked list but what if we could not change the values in this linked list what if it was an immutable linked list so once you store data in there you cannot change it so if we create what's called in an immutable linked list we would call it a block chain okay that is what a block chain is a block chain is a glorified linked list an immutable linked list and instead of calling them nodes we call them blocks and inside of these blocks we store data the data is in the form of what are called transactions okay so I'm going to explain how this works so a block chain is essentially a linked list that you cannot change the values of what's inside of there you cannot change how does this happen well satoshi said let's create a system Bitcoin was and it's gonna use this data structure called the blockchain on my computer I'm gonna store this linked list a blockchain of transactions you know Bob sent to Mary Mary sent above all these transactions of people sending money I'm gonna store it on my computer and and other people let's say ten other people will store the same exact data structure okay the blockchain how do I make sure that no one can change the values in this list right you don't want your bank changing the values in your account right yeah it would change your account balance right that's what we have banks but what Satoshi said was oh I have it I have a genius way of preventing people from changing the value in this blockchain Satoshi said in order for someone to change the value in their blockchain they would have to have more computing power than the majority of the network and what happened was the Bitcoin network grew so fast it it it had more computing power than the 500 fastest supercomputers in the world combined so in order to change any of those values in a single block a bad actor would have to have more computing power than the 500 fastest supercomputers in the world combined and no one has that much computing power so the blockchain has remained immutable and this has been a revolution right for the first time we don't need to trust a bank or any kind of central party to say we're not going to modify your your data structure now we have this network where no one can change that no one controls now we can use this to apply it to different things but the way the proof-of-work algorithm works is by doing several things the first is a node is so a node in the blockchain a minor will say I'm gonna retrieve a pending transaction okay so they're gonna retrieve that transaction it's got several features a hash a block ID transactions hash and then what they're gonna do is they're gonna calculate the proof-of-work it's gonna take some time they're gonna send send the block and proof to the node update the blockchain and then broadcast so what does the proof of work look like so the proof of work looks like this they're gonna say okay here are some proposed transactions okay I get you I get the transactions now I'm going to hash it using what's called the sha-256 hashing algorithm don't worry if you don't understand this we're gonna go over this in the future but let's just say the block will take the the miner will take this transaction and try to compute some random string from this transaction if the computed hash is below a threshold value then he'll say okay won the game and now this is my proof-of-work but if it hasn't it's got to redo it again she's got to keep redoing that hash calculation over and over and over and over and over over again until the value is below this threshold and then it could say okay this is the proof of work I proved it I've solved it done that's the basic idea now if all the miners do this they all do then the amount of computing power that the network has is giant gigantic right because there's so many miners and that's why it's secured that no one can change it because they would have to have more computing power than all these miners or half of them which is no one has that much computing power so the best way to really explain how this blockchain thing works is by looking at a visual demo that I found by this guy Anders calm so here's so hashing is basically taking some value and creating some fixed output so taking an input doing some kind of function to it some series of operations and then computing an output which we couldn't call a hash so let's say I have some data like yo notice how every letter I type the hash below changes so if I type in ABCD a unique hash shows up let me try it again ABCD the same exact unique hash shows up so no matter what if someone has if someone wants to create a hash that looks like this the only input data that could create this hash is the word ABCD that's it so that's that's the hashing function okay that and then so Bitcoin uses what's called the sha-256 I'll go into the details of that later on but it's a type of hashing function so that brings us to the block okay so for a block we're gonna say let's have some data and it's got this hashing function okay so this is block number one so what what a miner will do is they'll mind that block to find what's called the nonce the number only used once it's called a nonce but it's got a fine what is what is the what is a valid nonce for this data to create a hash so I'll hit mine okay and then it shows this correct nonce so now it's mine the block it's computed like exactly what I said before from from the proof-of-work demo right here what is that threshold value got it here's the nonce it's it's kept trying to calculate this nonce for this data such that the hash looks just like this okay so that's how mining works now a blockchain then is like this so it's a series of these blocks until miner will say okay here's the data for this block let me mine it okay so in order to be able to mine any of these blocks the a miner has to have the the previous block before it's right so each block depends on the hash value of the previous block what happens is the people is with the longest chain are considered the most valid because they've been around the longest time so if I try to break any of this fight if I change the value here notice how this one turned red as well the whole block chain breaks so the miners with the longest chain are considered the most valid during this proof of work mechanism I just want to give you a kind of flyby overview of how a blockchain works we'll go into more of those details later but I just wanted to give you some idea of a blockchain it's not some you know a super complicated thing it's actually a very simple thing it's a glorified linked list that's immutable that a bunch of people store secured by a proof-of-work algorithm which uses hashing which is a which is a topic in computer science which I'll go over in detail later so let's move on to the web 3.0 stack so for web 2.0 if you want to build an app you use for computation use Amazon ec2 Heroku right these are services that provide computation in the cloud but now you can use what's called aetherium okay I'll talk about that in a second for file storage you would use s3 Google Cloud Floyd hub one of these storage providers but now you can use what's called ipfs for external data you'd use a third party API to pull data from the web but now you use what's called an Oracle for monetization you would say okay it's got to be the ad model but now we've got the token model for payments you use PayPal Visa Amex all of these depend on banks but now we can use Bitcoin litecoin aetherium so each aspect of web 2.0 is now decentralized and we can use all of these services so am I going talk about every single one of these etherium ipfs Oracle's token in this video no that'd be far too much we've got a lot to cover like I said okay we understand the basics of how a blockchain works which is fine for now now let's just go over aetherium just just a little bit just a very little bit we have so much a cover don't worry I know it's a lot but if the idea behind aetherium was the founder said let's take this idea of Bitcoin well we have this blockchain an immutable data structure and say well we don't have to trust a bank to store this data what else can we use this for well we can use to say we can basically decentralize everything that exists right now right insurance social networks we have to trust the third the central party for social networks ride sharing everything games you know Blizzard and World of Warcraft there's always some kind of central middlemen that we have to trust between all these services so we can basically disrupt everything and just apply blockchain to every single idea and now it's a new type of startup that couldn't have been possible before so what they said was let's create a blockchain that we can store code inside of okay not just transactions transactions are fine but what if we stored code inside of this thing well then we can decentralize what's called like Heroku right computation now it's a world computer we can create an app and let it live on this network not Heroku but on a network that nobody controls so it's essentially an unstoppable application no one can shut down this application so that's just the first bit right there's a lot of different things going on here and notice how the ethereum blockchain looks similar to the Bitcoin blockchain except there's a whole bunch of other features and variables in there we don't have to worry about that just notice the code bit right here that's it for now it stores code it's it's like the Bitcoin blockchain except for except it doesn't just store transactions it stores code it's a decentralized Heroku that's it okay so when I say it's stores code it stores a specific type of code that's called a smart contract and a smart contract looks like this okay a cerium has its own language called solidity which we're going to go into so much over the coming weeks but it's called solidity and what you can do is you can write code in this language that goes on the etherium block chain that no one can shut down it's it's unstoppable unchangeable immutable code and generally if solidity contracts have four parts they've got an address that you know identifies what where that contract is they've got a balance they've got some code and they have a state okay so what we're gonna do right now is we're going to code our first simple solidity contract so what I've got here is the remix solidity compiler what this is is is a browser compiler for solidity so we can compile solidity contracts in the browser very useful stuff it's that you can find it at remix etherium org so all of these solidity contracts and in dot Sol because is its own language it's very similar to JavaScript so we're gonna have to take some getting used to I'm gonna teach you a lot about this over the coming weeks but let's just write a very simple one okay so the first thing we're gonna do for solidity is import is say well what is the version of solidity we want to use so we always have to say pragma is just kind of an identifier to say here's the version of solidity we want to use and I'm gonna say it's gonna be point four 0.16 now I'm gonna say okay I'm gonna create my contract so this is my contract object and I'm gonna call it test contract so this is my contract class okay it's a class object right object oriented programming this is my class this is my object it's called test contract now what I'm gonna do is I'm gonna say okay well this contract has a single value called int called value okay that's all it's going to do it's going to store this value and what I'm gonna do is I'm going to create getters and setters to help set the value here and get the value here so the first function that I'm gonna create in this test contract class is called a test contract and the input is going to be an integer and this is essentially notice how this name of this function is the same as the objects name which means it's called a constructor exactly it's called a constructor it's okay if you don't know that it's constructor which basically says if I initialize this object here's the value I'm setting for that for value right when we start so I can I can initialize it as whatever value I want so now I'll create the set I'll create a set function called set P which stands for set payable what this means is there is this keyword called payable that solidity contracts use that say whether or not we can the the contract will accept any kind of payment in the form of ether right and this can be used for different things whether it's a store an auction a shop you know all these different things will this function accept will this object this test contract accept payments yes or no and so for this last function is called not payable and it says well you can't pay this object anymore it doesn't accept payments and here's the value that we want to set it to as well so for this last part I'm going to say let's create a getter function so it's called get constant returns and it's gonna return the value of value right right here that's all it does and then it says return boom just like that and now that's our contract right we've created a test contract object it's got these tests these getters and setters and now we can run this thing so let me go ahead and refresh this page and then say start to compile okay so now I've compiled it and now I can create some value for this I'll say well here's the value I want to add to the test contract object create so I've initialized this test contract object it now exists on the ethereum blockchain this is a test blockchain exactly it's not the production blockchain but now it exists and now I can execute one of these functions I create a get set not payable and set payable so I'll say set payable 20 okay and now let's get the value oh it's 20 right so let me set not payable to 10 so now it's not payable I can't pay it and now I get and it's zero right so if we can set payable I'm gonna say 300 set payable yet and now there now that that object that test contract object it's now initialized and exists on the blockchain on the test blockchain and it has a value of 300 of 300 that's that that variable we coded up here so super simple solidity contract I know but it's a very easy way to get started to just have this thing run yourself all this other stuff gas environment value the debugger all this stuff we're gonna get to but just for now be okay with saying okay I get why we need web 3.0 I get what a blockchain is basically I get that the ethereum blockchain is saying let's take the Bitcoin blockchain and just put code in it so we can have decentralized computation and I get that solidity is the language of etherium that I can run smart contracts with that are censorship resistant and this isn't a this is an example of one if you get that you're good and I can't wait to see you next time please subscribe for more programming videos and for now I've got to use a theory of more so thanks for watching [Music]
Info
Channel: Siraj Raval
Views: 122,629
Rating: 4.8675032 out of 5
Keywords: web 3.0, what is web 3.0 blockchain, what is web 3.0, web 3.0 blockchain, what is web 3.0 technology, web 3.0 technologies, web 3.0 explained, web 3, web 3.0 ethereum, web 3.0 the internet of things, web 3.0 examples, vitalik buterin
Id: aPVmd7SyKfQ
Channel Id: undefined
Length: 29min 36sec (1776 seconds)
Published: Wed Mar 21 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.