How does IOTA work?

Hello world it’s Siraj and block chains are so 2017-2018 is gonna be the year of block DAGs directed acyclic Graphs you might be thinking. What did you just say and that’s okay because I’m gonna explain what I just said This video is about a crypto system called iota Okay, so it’s called iota and it uses a distributed ledger similar to bitcoins blockchain Except it solves a lot of the issues or it aims to solve a lot of its issues And it’s getting really popular, and it’s about number seven or number eight on the coin market cap website It’s getting really popular, and I’ve gotten a lot of requests for this video so I’m gonna do a video on this I’ve been studying it all day and yesterday, so And I’m and I’m pretty excited about what I’ve what I’ve studied so far So I’m gonna share with you what I’ve learned about this system today. Okay, so before we go into why iota is awesome I want to start off with the problem with block chains because block chains are awesome However, they’ve got their problems 99 of them, but no not 99 problems. Just some problems, okay I just wanted to slip that in there okay, so here we go with the problems the first problem with block chains are Scalability issues right there are endless debates on Twitter on slack on Bitcoin forums on scalability And there’s a million-in-one solutions to scalability right so bitcoins blockchain Takes about 10 minutes to confirm a transaction That’s a long time right 10 minutes to confirm a transaction is a very long time for a system That’s meant for micro payments right micro payments for machines the machine to machine Transfer we want machines to be transferring millions of transactions per second ideally just giant mesh networks a machine just Transmitting value faster than any human could but for 10 minutes. That’s way too long right and that’s what it’s become there are currently 200,000 unconfirmed transactions on the Bitcoin blockchain so if we open this list this real-time list of transactions, okay? This is real time. We’ll see that there are about 100 83,000 unconfirmed transactions, and it is flowing in right now. Just like that That’s a lot of unconfirmed transaction and at ten minutes per transaction. That’s just way too long Okay, so that’s a lot of unconfirmed transactions because it’s taking so long to confirm them and this is annoying right Why would you want to wait or pay a higher fee for a faster transaction validation or deal with transaction uncertainty, let’s say you’re a multinational corporation like IBM, or you know Chase Bank, and you want to use blockchain technology to sync up your Different branches across the world you know use its ledger to sync up the data and in a in a permissionless trustless way But if you’re having to wait ten minutes per transaction That’s way too long so check this out visa has two thousand transactions per second visa is the network Globally it is the network for transmitting value currently Bitcoin is nothing compared to Visa okay Look at that five to seven transactions a second that is nothing we weigh more than that so in Comparison PayPal is way more so how are we going to get up to that visa level you know what I’m saying How do we get up to that visa level and there’s been so many different? Suggestions, there’s Segway, there’s a Lightning Network There’s all these solutions, so I’m gonna go into those a bit, but that’s the first issue with blockchains Scalability, it’s hard to scale a blockchain right you’ve got massive amounts of computing power You’ve got the speed of transactions decreases as a network increases in size And you don’t want to store data on the blockchain right? There’s this There’s this thing called blockchain bloat Where you don’t want to store data directly on a blockchain you want to have a pointer to data? That’s living somewhere like in a distributed hash table right so Scalability is one there’s number two are fees right so the mean transaction fee that is the the average Transaction fee for a transaction and the Bitcoin network is a dollar that might not seem like a lot of money But that’s a lot of money for a network meant for micro payments right that’s that’s the whole point visa has that 2% What is it two percent charge for for each transaction the coin was all about okay? And we don’t need that anymore right we have we have felis transactions, or there’s a very minimal fee well now It’s a dollar so anything under that is Worthless right because the fee is going to be greater than the transaction So micro payments under $1 are virtually useless or impossible now and this can be more than the transaction amount itself right so solutions include increasing the block size using lightning network central servers for off chain transactions like using coinbase for example side chains tree chains There’s a lot of proposals And there’s a lot of ways that the core Developers and just the the Bitcoin community is doing to fix that I’m not saying that they are not trying to fix it they are but It’s still it’s still It’s not fixed right that there are still the fee still exists so if we look at the fee over time It’s just going straight up. It’s just exponentially over time for transmitting even 0.01 BTC. Which is what this graph is

so There’s a lot of computing power required to maintain the Bitcoin blockchain as well as you probably know and Mining has become somewhat centralized by these giant mining pools right in China mostly But that’s that’s a lot like just I take a look at this chart right here of the distribution of Bitcoin mining power Right if you look at gee hash and BTC guild together. They make up 55% of the network two pools make up the majority of the network’s mining power now that is centralization okay, that is a lot of centralization for supposedly decentralized network and Transaction speed declines as the network increases in size as more transactions compete for the limited block spaces So it’s gonna take more and more computing power to mine the same amount of Bitcoin you got to buy these Asics if you want to be a miner you got to put the money in okay you got to buy some giant a Six ideally if you want to make some profit, and then you know meter your electricity costs etc Let me just look at this. This is the hash rate You know that the cost it takes to mine a block just going straight up Which means you need way more computing power to mine the same amount of Bitcoin that you would? otherwise Okay and lastly one more problem. They’re vulnerable to quantum attacks right so Bitcoin and other proof of work based block chains are susceptible to Being broken by a powerful quantum computer, so here’s why the proof-of-work algorithm, and I’ve talked about this in previous videos But the proof-of-work algorithm is trying to solve random mathematical problems right it takes a certain amount of time to solve these problems So for a minor to generate a suitable hash to generate a block they’ve got to check around 2 to the 68th Nonces that means numbers only used once to find that suitable hash So a quantum computer would need the square root of n operations to solve a problem That would normally need n operations on a classical computer That’s let’s this is an order of a magnet or of an order of magnitude difference so a quantum computer Would need if we calculated it out, which I did, right? Here is a quantum computer would be 17 billion times more efficient in Bitcoin mining than the classical computer right so right so the network requires lots of computing power to maintain its security And if a bad actor could gain control of more than 51% of nodes that means they have more than 51% of computing power then they would be able to double spend that means change a transaction history and spend money that they don’t actually Have and that would break the entire network and everything is based off of classical computing right the laws of classical computers However quantum computers could do this 17 billion times faster so with just one very powerful Quantum computer an attacker could break the entire network, and this is very dangerous And we don’t have a quantum computer like that right now, and it’s all theoretical But there are advances being made in this space And it’s it’s gonna happen so we need some sort of quantum attack resistance mechanism And I’ve got this little Infographic here on how a quantum computer works, but the most basic li5 Explanation I can give right now is that classical computer only computes ones and zeros so there are binary Operators. Where as a quantum computer uses instead of a bit a qubit which can be both a 1 a 0 and a 1 and 0 at the same time, so it’s a superposition of two different bits and this allows for The types of computation that would not be possible on a classical computer I have to have a great video on this and a part of my math of intelligence series It’s called quantum computation so check that I just search Siraj quantum computation. Let’s keep going here Okay, so those are all the problems with the blockchain So let’s talk about why iota as a crypto system is Different from a blockchain so the first big difference is the structure so like I said blockchain tour so 2017 iota uses What’s called a block dag okay a directed acyclic graph I? Just want to talk about the directed acyclic graph for a second, okay, so DAGs are not new a dag is just a hierarchy of nodes that are connected to each other where no node is a Descendant of itself that means there are no cycles that’s the word a Cyclic there are no cycles right so it’s just a hierarchy of nodes that are connected to each other in one direction So there are a million different ways that you could? Structure a dag, but that’s the basic idea no cycles in this graph. You could think of a file system as a dag right because It’s just a hierarchy of nodes right folder within a folder within a folder get the the protocol that github uses. That’s a DAC ipfs is Ipfs the interplanetary file system that’s a dag in fact You can even think of a blockchain as a dag right because a blockchain doesn’t have cycles

But it’s a very specific type of deck in that. It’s a singly linked list It’s a glorified singly linked list that is a that is secured by the proof-of-work algorithm a Dag is more general like so here’s here’s an image right here, so Block chains are just blocks that are pointing to each other in one direction and tangle Which is what they call which is what Iota calls, its. It’s another word for its tag I’m just gonna call it that guys I know of you. I know the iota guys are watching this right now Let’s just call it dag Please let’s not add more terminologies to this just for adoption so block chains are sequential chains where blocks are added in regular intervals right But I Oda’s data structure the dag is able to achieve high transaction throughput by parallel parallelizing validation no transaction fees occurs Occur for any transaction as it grows more participants make transactions And the overall system becomes more secure and faster with confirmation times transaction finality going down What that means is as more nodes are added to the network the network’s transactions actually? Get approved faster, and that’s in direct contrast to the blockchain the more nodes There are the slower the transactions are approved right and the longer it takes for a transaction to be approved Whereas in the block tag that iota uses the more nodes? There are the faster the transactions are approved which is a much more scalable architecture, and you might be wondering Why is this but I’m going to that in a second, okay, so it’s still a distributed database It’s still a peer-to-peer network it still relies on consensus and a validation mechanism, so those things are all the same It’s just a structure that is different and the type of consensus and validation mechanism that’s different – right and it scales like I said it scales as Blockchain scale the usability goes down as I Oda’s dag scales the usability goes up So here’s the big difference here’s big difference number two there are two big differences right so the first one is a Structure the second one is consensus, so there are no minors So people who want to be minors too bad. You can’t be minors. That’s okay. This is a good thing for the network Here’s why? So in so blotching consensus is achieved by requiring multiple Parties to race against each other in an attempt to add the next block to the blockchain and get the block reward right so miners are competing to mine the next block the fastest using their computing power and Whoever is first to do it gets to mine it and they get the reward but because of this Consensus is decoupled from transaction generation you have this whole separate group of nodes in the Bitcoin network that are dedicated to mining right and then all the Participants in the network that are not miners all they do is just generate transactions right I want to pay for this I want to receive this I want to pay for this I want to receive this and because it’s decoupled that leads to further centralization right because the these mining pools can occur but in iota there is no decoupling the all the nodes are Miners in a way or they’re not miners. Here’s how it works so an iota every participant in the network making a transaction Also actively participates in the consensus, here’s how? Every time you make a transaction you reference two transactions directly and and in a way other Transactions in the sub dag indirectly just by referencing two So there are no blocks in the classical sense instead a single transaction references to past transactions right, so here’s here’s a here’s the graph it bundles all transactions in a directed acyclic graph, it’s self-regulating consensus, no longer decoupled to a set of minors And it’s very scalable with a low overhead proof of work to prevent spam so check this out the green blocks are transactions in which Consensus was achieved the red blocks are transactions where we are still uncertain on their full acceptance and the gray blocks are unconfirmed transactions Ideally we want all of these transactions to be green right so from right to left or left to right depending on how this works eventually all the nodes will be verified if the nodes pointing to it verify that it is indeed a valid transaction and There are no transaction fees because there are no miners You when you make a transaction you have to approve to other transactions And then you have to perform the proof-of-work algorithm so in a way You get paid by not having to pay a fee right so because you’re computing this proof of work, which is for civil resistance, right? because you’re computing that proof of work you get to make a transaction without there being a fee and That is your reward so there are no transaction fees which is awesome so instead of a smaller subset of the network being responsible for the overall consensus ie the miners the entire network of active participants ie the devices making the Transactions are directly involved in the approval of those transactions and so consensus in iota is no longer decoupled from the transaction making process

It’s an intrinsic part of it And that’s what lets it scale without any transaction fees oh and one more thing like I said before it’s quantum It’s quantum resistant It’s not success susceptible to quantum attacks And why is this well it uses an how? Them call the winter knits one time signature I can make an entire video on how winter knits one time signatures work I’m not gonna do that because it would be too long, but check out the link right here in this Jupiter notebook Which is in the github by the way, okay? So here’s a little picture of it alright, okay, so here Okay, so you might be confused by this process of making a transaction. Let me clarify it, so it’s a three-step process It’s a three-step process so the first step like let’s say I want to pay you know. I’m a machine I want to pay this other machine or even I’m a human. You know I want to pay this other human Here’s how it works the first step is to sign the Transaction input with your private keys what that means is you’ve got a unique set of private keys that identify you as a unique individual Node in the network when you sign a transaction that You are hashing you’re creating the hash of that transaction using your private unique unique 25 character key Which means a transaction will be both unique and linked to you so you sign it with your private key? Then step 2 is tip selection right so tips are the what Iota calls these unconformity The Monte it uses the Markov chain Monte Carlo algorithm to randomly select two tips these are unconfirmed transactions which will be referenced by your transaction and in the code these are called the brand transaction and the trunk transaction right so once you’ve signed your Transaction you then point to two unconfirmed transactions that you’re gonna have to approve Before your transaction is generated and validated, so that’s that’s what you’re paying for this and step Three is to perform the proof-of-work algorithm in order to have your transaction accepted by the network You need to do some proof of work similar to Hashcash similar to Bitcoin right and this is for civil resistance, right? It’s all about the computing power right you don’t want any of The nodes in the network that gain control of the network by having the majority of the computing power and that’s what proof-of-work prevents because everyone has to compute this you know random mathematical problem a Node would have to have more computing power than the rest of the an attacker would have to have more computing power and then half the network in order to double spend so Proof of work as for double spending tip selection is computed using the Markov chain Carlo process I also have a video on how this works. It’s a part of my reinforcement learning series I could go into a whole video on that But it’s called Monte Carlo prediction. Just google that but in short. This is a probabilistic algorithm that samples randomly using distributions So it’s some so Markov chain Monte Carlo methods sample from a set of nodes randomly using a distribution function, okay, so Once you’ve competed completed these three three steps your transaction will be broadcast to the network and someone else will come along choose your transaction in the tip selection process and Validate it and just like that your transaction is confirmed So that’s why if the network gets faster Transactions get faster as it network scales because the more people there are in the network then the faster your transaction will be validated because there are more people available to Confirm your transaction right so that’s why it scales as there are more people okay So I do want to say one thing so there is this concept of the coordinator right now in iota and so the coordinator is Is run by the iota foundation the people who? You know made iota and the coordinator checkpoints valid transactions, which are then validated by the entire network It cannot go rogue as this coordinator is being checked and validated by the entire network But what this means is first of all it’s very hard to Bootstrap a blockchain right because you need it’s you need a certain amount of nodes there For the computing power to be greater than what an attacker would have right in order to Gain control the network because bitcoin is so big as an as a system The amount of computing power an attack would need is way too big right But when you’re starting a blockchain that relies on the proof of work mechanism you got to have some kind of system in place to prevent a bad actor from taking over some sort of civil resistance so the way the i/o the iota Foundation has Sought to prevent. This is by creating this coordinator. That is run by that so it’s centralized yes It’s a centralized node that validates transactions temporarily they’ve been clear about this since the beginning which I like and Yeah, it’s centralized. That’s a bad thing, but it’s it’s a temporary thing And I think that I mean their goals and their their aims and their white paper its It all seems to be pointing in a decentralized direction, but it’s a temporary mechanism to validate transactions at the start

But eventually they’re not going to need it or want it, and it’s gonna go away, so I just want to mention that Okay, so use cases right so first is data integrity right so There’s this mechanism to send messages secure messages between different nodes in the iota Network which allows for Nodes to communicate data right and because there is this distributed ledger that there is consensus on that is permissionless and trustless you can you can ensure that the data that is being passed between these nodes is is valid and Data integrity is super useful for any kind of Hospital Records Or you know any kind of secure records that we need to you know government law legal You know anything that needs a lot of security this would be great in a trustless permissionless systems supply chains, right? Importers exporters shipping liners logistic companies right they’re all over the world They’re global, and they need to sync up on data And you know what the what the status is of you know delivery And what the status is of this and this and this and this and that’s a perfect use case for distributed Ledger’s like iota Right, and I mean this this system was meant for the Internet of Things right so and when it comes to the Internet of Things We are we need ways to share a bandwidth computing power resources you know data all sorts of these things and That is what this would be good at or any kind of grid as well solar grid micro grid services electrical grid just anyways to share Resources that doesn’t need a human in the loop just automatic systems that are trustless permissionless that coordinate Scarce resources amongst groups of people this would be a great use case right so it’s key features are infinite scalability No Fee microtransactions and quantum resistance, three key features that Would be awesome to have so I mean the network already has a hundred million in transactions that have occurred without fees Yes, it’s using a coordinator right now. Eventually it doesn’t need to or they don’t want it to be there and I Think it’s pretty cool I mean the promise of No Fee transactions and a network that scales really well and gets better in Terms of the speed of transactions over time that is a that is a promise that I like okay And I want that to happen we should want that to happen Iota is a proof of concept I mean everything in this space is a proof of concept Bitcoin is even a proof of concept What what I mean by that is it is not production ready yet nor is Bitcoin even But I like where this is going I mean these guys seem to have Know their stuff like they worked on next which was this this first asset transferring service that uses block chains in 2010-2011, so they’ve been in the space for a while and You know they’re they’re pre mine was modest I think something like 500k and all the coins are Are generated all of them that can be created have been created so it’s I think it’s a cool system And I want to see more of it I want to see more development of it more interest more excitement because yeah we need no fee we need no fee distributed ledger services right that’s how we’re going to really get this Internet of Things of things that are communicating and Transmitting value at millions of transactions per second faster than Visa, or is a magnitude faster than Visa screw Visa We just go million times a second, okay that’s what we want to be and if we can just bypass all of these issues that are coming up as a Bitcoin blockchain scales and use something like iota that would be awesome, so I think that yes There’s still some problems, and they have a lot of promises, but if they can come through with them And I think that they can that would be awesome for everybody, okay, so Let’s let’s look at the code for a bit so they’ve got this GUI client, which is really cool If you want to just the easiest way to get started this would be it it’s built in JavaScript You can use NPM to install it. It’s base of the electron wallet and Instructions are here in this github repository one more thing is the client library in Python So the base library is in Java, but they’ve got client libraries and Python and JavaScript And in C. I think C as well, but it’s all on their github right here at iota ledger Which you can look at right here Java. They’ve got the command line app. They’ve got an Android wallet Yeah, they’ve got they’ve got a lot of repositories here to play with in some different languages But what I’m gonna. Do is I’m gonna just download this and just run. It just just cause so let me download that and I’m going to open in terminal. Let’s see Let me go right into that folder Okay, so pip install Toyota Okay there we go

right sudo pip3 install Toyota All right, so I’ve got I owe to up and running I have a full node running on my computer and using once I have this node running I’ve downloaded the Java client, and then I can use any of the Python or the JavaScript CLI libraries to then you know integrate this into a web app or a mobile app or whatever kind of app I want But it’s a pretty lightweight Client, and it’s easy to integrate into a web app or mobile app so you can use it for you know having an online wallet Or whatever payment system or or any kind of? System you want to create the last thing is how to buy iota so I found this great tutorial on BitFenix calm which is this website? This is it’s an online exchange on how you can buy iota with Bitcoin so it’s a five step process But first first step is to make sure your funds are on the exchange wallet so they have three dedicated wallets that you could use and You can instantly move your funds from one wallet to another on the wallets page which is right here And so you can go to the trading page and choose the pair you want to trade And then there’s an order form and the exchange tab you could click exchange buy and then the order is going to appear if you you’ve got to have Bitcoin in order to Buy I owe to coin, and if you want to buy Bitcoin Then I would suggest using coin base as a the most reliable way to buy them it’ll require you can do this from Virtually any country I think at this point but you link up your credit card or debit card or bank account by Bitcoin and then transfer that Bitcoin to a wallet and then from that wallet by Iota on BitFenix or There’s a couple of exchanges actually, but I think bit finnex Is is the one to do please subscribe for more programming videos and for now I think I’m gonna go buy some iota so Thanks for watching