An Introduction to Blockchain with Mark Russinovich : Build 2018

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Try it again. How is build going. It's hard to see. It looks like there are a few people in here. My name is mark russinovich, i'm the yto aazure, and this is Around introduction to block chain and crypto currency and smart contracts. How many people have invested already in bitcoin or another Crypto currency just out of curiosity. How many people are here because They want to get rich? for those of you watching, that was Everybody raised their hands. So what i have got is a session Here where i'm going to cover the background of this whole Bitcoin, cryptocurrency block chain craze that's going on and Take you inside the technical details behind the technology, Behind the headlines you are seeing. I will start with an overview of Bitcoin mania for those that haven't been paying attention And have been living under a rock the last year or so. I will give you an overview of what's been going on. Then i the talk about where bitcoin came from, its origins And theories around how it emerged. I will talk then about block chain basics and this is where i Will get into some script to graphy, basic level, i will Cover the fundamentals of the public key crypting tofy which Is mind what block chains are made of. I will take you inside what a block chain consists of Underneath the hood. I will explore other block chain Networks besides bitcoin and other uses of those networks, Specifically the use of smart contracts which are transactions On the block chain that can be executed. I will talk about the Limitations of block chain. Some of them with respect to the Current technology that is deployed and dive into what we Are doing to try to help enterprises overcome those Limitations with current technologies. And finally i will give you a Guide on how to get started with block Chain. So this is what you probably Have been seeing. It's article headline from the New york times, everybody else is getting rich and you are not Because you don't own bitcoin. And you probably heard your Neighbors talk about it, your kids talk about it. I have got friends that their kids are saying they are going To retire because they are making all of these money off cryptocurrency. This is really causing this big fomo. Anybody know what fomo is? the Millennials in the house, fear of missing out. That's when this is causing. And you are seeing stories like this. This is one from seattle a couple of months ago where Somebody went and bought a house, at least that's the Headline using bitcoin. And actually this is an example Of the press kind of stretching the truth to get some attention. This person didn't actually buy the house with bitcoin. They put the downpayment on the house with proceeds they had Gotten from the sale of some bitcoin that they had. So not quite. And then you saw this stuff. This is crazy stuff, companies that would put the word block Chain into their name, and then their shares would just go up. This is one example. This is a company working bio Informattics in the u.K., They changed their name, put block Chain in it. They Repivotted, and their stock went up. This one, long island iced tea, This is a cop lar consumer drink maker they are doing decently in The tea business, but they said we can change our name and then We will do a lot better. So their shares went up 200 Percent when they change the their name to long block chain. So now they are putting iced tea on i block chain. If you take a look at what's happened, we are in a small Market correction when it comes to cryptocurrencies this is Since may of last year and you can see the price there $5,000, $10,000, $15,000, $20,000, It went to just above $20,000 right Around the holiday period, and then you see that it had a Correction and as of today, it's somewhere at $9,000, $9,100. Bitcoin. So a little bit of a correction, but still if you invested a While ago, more than a year ago, you are actually in pretty good Shape with bitcoin investment. And this kind of burst bubble. You are starting to see these headlines. Bitcoin hype vanishes. I don't hear my friends kids Talking about bitcoin so much anymore. I think they bout in around the Holidays when they were off from school. You see this, people that are Really bearish about the future of bitcoin and other cryptocurrencies. This is from a few days ago, warren buffet and i never Thought i would hear the words rat poison squared come out of Warren buffet's mouth. Bill gaitsz said he would short Bitcoin if he could. And it turns out you can. There is a futures market for bitcoin, so i sent him an email Last night. This is me, i started to play With bitcoin last year, and i purchased a little bit, and this Is from my account as of yesterday. You can see that i bought, just Spent enough to play with it, $50, and that's what it's worth Yesterday, $3,200. So just to put that in context, That's almost enough for a new iphone. And the thing is i'm killing myself, like when the prices Started to go up, i'm like why didn't i put in a thousand Dollars, because that would have been a million dollars at this Point, so i missed out. Let's get to the history of Bitcoin. Bitcoin was created or launched As a paper back in 2008, and you see the title of this paper, Academic paper, bitcoin a peer to peer electronic cash system. No academic references so it's written like an academic paper, But not treated like, they didn't treat it like an academic Paper referencing other sources as foundation for this work, but This paper, if you are going to read one thing about bitcoin to Understand the way it works, you should read this paper because It's very clearly written. It's very succinct and really It's what i'm going to be talking about for the next 40 Minutes or so, most of the bulk of the middle of the talk is Just what's in this paper. You can see the author, nobody Really knows who this guy is. In fact, nobody knows if it's a Single person or an organization. Some people speculate it's the Nsa, some people speculate it's some other mysterious Organization or somebody that's a hermit and said here is the technology for the world. You can see whoever it is, because they gave themselves a Bunch of bitcoin at the start, whoever it is, they are Incredibly rich right now. The market capitalization of Bitcoin is $150 billion as of today. And so quite a lot of money. Now, there is tons of Speculation about who sotushi is. And somebody from space x published a blog post saying i Figured out who it is. It has to be elain musk and they Provided this evidence that lines up to elain musk who would Have done this and that's why he is so rich. Elain musk responsibilitied -- responded to this, and said i am Not sotoshi yakomoto. In fact, i never bought bitcoin, somebody sent me bitcoin once And i have lost it and now i'm really sad because imagine how Much richer i would be if i had held onto is it. He didn't say that. Let's talk about the difference Between these cryptocurrencies like bitcoin and traditional Currencies like the dollars or whatever foreign occurrence so You might be carrying with you. That corpscy is called fee at Currency it's one that's issued by an organization that backs it And they stand behind it. Now, one of the challenges with Fiat currency, especially when you are transferring large Amounts of money from one entity to another one is it there are Long delays between the transaction and the settlement Of the transaction. This period in between where the Money is neither here nor there and if you do a wire transfer, You are familiar already, it's two or three days for the wire Transfer to clear from one bank making sure everything is lined Up and the other bank making sure everything is lined up and Accepting the payment. In addition most of the time Even for things like wire transfers there are Intermediaries involved for large transactions or Transactions across country borders, there are organizations Like swift which sit there in the middle and help with the Validation of the transaction. Other organizations that sit and Will back up the transaction in the case where the, whoever is Paying the transaction fee defaults on the transaction Amount, they cover it. So there is insurance, there is fees. They are the ones validating it. So you can trust the central Authority to say everything looks good before you accept the transactions amount and start to Use it. And that adds a bunch of fees to the transaction. It also introduces additional delays, and because the money is Neither here nor there for some period of time and you have Middle men in the middle, this offers lots of opportunities for Fraud. Fraud and loss like money Actually can get lost and so this, these are some of the big Challenges with fiat currency. Now, cryptocurrency comes along And tries to address these challenges. It's a distributed decentralized Currency. No there is no central authority. Nobody is issuing the money. Somebody creates the Cryptocurrency, they specify how the currency gets generated, but Once the cryptocurrency is off and running, nobody is in control of it. It's really everybody is contributing as part of a network. There is no transaction settlement clearing. You send a payment from one account on the cryptocurrency Network to another one, it's immediately, once the Transaction is accepted by the network it's instantaneous Settlement and there are no subjecter mediaries involved. Like i said, send money from one account to the other one, it's There as soon as the transaction commits. Another interesting property of These cryptocurrencies is its got on immutable history of Every transaction going back to the genesis of the cryptocurrency. What this means is it's possible to track when you get some Currency of bitcoin, you can go back and track its lineage back To the beginning of time. So this has made it interesting Or very attractive for people that believe in no fiat Currencies and want to overcome these limitations. Now, if you go read the paper, bitcoin is built on a technology Called block chain, hence the title introduction to block chains. And block chains, you will hear them also referred to as Distributed ledger technology or dlts. If you think about what a Database is, one that's keeping track of assets, for example, Payments, funds, one account moving to another account, there Is, it's effectively the digital version of the old ledgers that Kept track of who has what in what account. Distributed again because everybody can see the ledger at The same time. Everybody has a consistent view Of what's going on. But as i hinted before, block Chains get their properties from crip to graphy. If you read the paper you see references to crip to graphy. So i will take you through the basics of Cryptography so you get an idea of what mechanics go On behind the scenes when somebody talks about block Chanels and why they are immutable and how they are Decentralized and how you can assure that somebody that is Paying somebody else that it's encon fro vertable that that Person or organization is the entity that authorized the Payment. There are three concepts. If of you may be familiar already with these, but i will Give it a light touch as i go through. Hash functions, public key Cryptography and digital signatures which build on public Key cryptography. So let's start with hashes. Hashes are algorithms that create shortened representation Or digest of a larger piece of data. Typically a fixed length digest that represents the data. And the characteristic of a good hash algorithm is that you can Take a piece of data, and modify it slightly and it will generate A completely different digest. And it's extremely difficult for Close to impossible using current computing technologies To generate another piece of data that generates the same Digest as a different piece of data. In other words, it's very difficult to create Intentionally a collision of hashes. One way to think about a hash is To think about summary for a movie like star wars, which if You summarized star wars here is what a one paragraph summary Would look like and there is no other movie that would have the Same summary based on the uniqueness of star wars and by The way we are all friends here so let's admit that the vampire Was just trying to restore order to the universe. And by the way, the exhaust port will be patched on tuesday. That's an old microsoft joke. Let's take a look at a little bit more about the technical Details behind what a cryptographic hash function like A shaw 256 hash. You take the word fox, you hash It, you get the digest, you see a slightly different piece of Text, it hashes to something different and digest is the exact length. You change just small, a v to you u, you get something Completely different. So the next concept i will talk about is encryption, and i will Talk with symmetric encryption which everybody is familiar Already with. You take an unencrypted message, Pass it through an encryption algorithm which has a key you Apply to it, and then out pops an encrypted message. This, by the way, looks -- i have seen this kind of thing Before when i have accidentally opened a word document with note Pad, which i'm sure everybody -- how many people have done that Before. Then you can take that data and Using the same key, decrypt it, and hence, the same key is Decrypt or encrypt and decrypt, and those are fast. That's the kind of algorithms that would be used for bit Locker to encrypt har disk, one key used to encrypt the data and The same key is used to decrypt the data. Public cryptography is interesting because it's Asymmetric. So the same keys can'ting used To encrypt as to decrypt. The way this works is if you Think of it as a lock, and the lock here has three positions. In the middle one it's unlocked like i'm showing here. If you take the public key, it can only turn the lock in one direction. And when you turn the lock in that direction, it moves to a. And it gets that lock becomes locked. That public key cannot be used to turn it in the other Direction, so it can't be used to take it from a back to b. The only key that can be used for that is the private key. The private key can turn it in the other direction. So the private key can be used to move from a to b or from b to C, but it can't go back from c to b or b to a. And hence the asymmetric nature of it. It's called key crip to graphy Because these are generated as pairs together using prime Factors, and they are paired together such that no other Combination of numbers can lock or unlock the locks the same way That the public and private key can. Of course, the public ski Key is the part of the key that you Would give to anybody. You could give it to literally Anybody and the private key you would keep secret. Once you have got this scheme in place where you have taken one Part of the key and you said that's private and the other one Is public, you can do cool things with that. One of the things you can do is Encrypt data. You can encrypt data so that Only somebody else that it's intends to can receive it. The way you do that is you take a piece of data. You take the person's public key that you want to send this data To, and you encrypt it. So just like symmetric Encryption, this key is used to encrypt the data, but once it's Encrypted to the person's private key, nobody else with The public key can look at it. Even you cannot decrypt it using That person's public key. The only person that can decrypt It is the person who owns the private key. So they can take the private key and they can move the lock to The unlock position on their side, decrypting that data. So it's a great way if you want to send a secret that nobody Else can look at besides the intended recipient that's what You would do. If you take a look at what this Looks like cryptographically. You get the encrypted message, You hand it to the receiver. They can take their private key And decrypt it and read the message. Now, digital signing is something else you can do with Public key crip to graphy. This is heavily used in block chains. If you want to prove that you are the person that did Something, you can do that using your private key, and other People can verify it using the public key that you are the one That did something. The way this works is taking the Lock in the opposite direction. You take the piece of data. You encrypt it with the private key, and then you hand it to Somebody else and she can decrypt it using your public key. Only people with the public key can decrypt it and you know that If it's decrypted with somebody's public key that they Must have encrypted it with their private key. There is no way anybody else Could have produced the encrypted data because you are Using that person's public key. That's the only key that will Unlock the data. That is called signing. The way you do signing actually is to take a message, take this Message and you want to give it to somebody else and prove that You authorized this message. You said this message is the Message that i want to give you. The way that you would do that Is hash that message, so you get the digest, and then you encrypt That digest using your private key. So what the other person gets is the unencrypted version of the Message, the encrypted digest of the message, and now they want To verify that you are the one that, that that message they Received in unencrypted form is what you actually intended to Give them. So the way they do that is they Take your public key, they decrypt the message, they get Back the hash and then they compare the hash that was Unencrypted with the hash of the plain text document that you Shared with them. And if those match, that means That they actually digitally signed that hash, that document effectively. Nobody else could forge that signature because nobody else has that person's private key That matches the public key that you used to unlock it. So you just compare the two. If it's equal, you know that That's a verified message authenticated message, signed message. And those are the basic tools public key crip to graphy used In block chains the fundamental operation Performed in a cryptocurrency or block chain is called a transaction. It's executing something, changing some state, in the Cryptocurrency that state is transferring assets from one Account to another account. And in this case, we have bob That wants to create a transaction in a cryptocurrency That saying pay alice 10 bitcoin. The way they do this is they the Take the idea of a previous transaction that shows that they Received 10 bitcoin to their account in that previous Transaction was assigned or transferred 10 bitcoin. Now somebody can go back in the previous transaction, verify That bob owns 10 bitcoin and the 10 bitcoin that bob is trying to Pay to alice and then bob would then to give it to alice and Nobody else would take and encrypt a transaction that Includes alice's public key, and then sign it with his own Private key. Now, that this transaction is Signed, it says that bob authorizes the transfer of 10 Bitcoin from bob's account to alice. You can prove or verify that bob Actually authorized this by going and checking the digital Signature with bob bob's public key and if the hash of the unencrypted transaction matches The encrypted hash that was encrypted with bob's privacy, You know that this transaction is the one that bob actually Intended and put the stamp of approval on to give alice these 10 bitcoin. That's the fundamental way that a transaction is authorized, and When you are talking about cryptocurrencies that keeping That private key secure is so important. If you lose that private key, then somebody else can Masquerade as you, they can go around authorizing transactions That appear to be you because that private key represents something only you should be Able to do. So once you have got this basic Transaction, you start to build up transaction chains So you see in a transfer, straight forward transfer of Asset from one owner to another owner in this way you can see There is one transaction here, owner 0 signed this transaction That says give owner 1 some amount of currency, and owner 1 Then can unlock that transaction and execute another transaction That says give this to owner 2, and the way that they unlock it, Of course, is by digitally signing this transaction saying Give this asset to owner 2, and then the chain continues like That. Owner 2 then can take and create Another transaction, digitally sign it and somebody else owner 3 Can verify and other people on the network can verify that Owner 2 transferred this asset to owner 3. So this is, you start to see this immutable kind of Characteristic of block chains show up here with these Transactions that reference one another and have this immutable Record of who authorized the transaction. In this case owner 0 giving Something to owner 1 that giving something to owner 2. So these are the transaction chains that flow through a block chain. I haven't gotten to what a block chain is. I want to show you how you can Explore transactions using -- there is a bunch of different Tools to go explore transactions on public block chains I have got this site, it's block info.Info. It's a great site for exploring The bitcoin block chain. You can see at the top we see Something called blocks. I will talk about that later. If you scroll down you can see interesting stats. There is bitcoin value. You can see the number of Transactions a day. This is the number of Transactions that have been executed on a bitcoin network in The last 24 hours. And then what we are going to do Is click on this block, i will explain what that is in a bit, But blocks contain transactions so we can go take a look at one Of these transactions. And what we see in the Transaction here are inputs and outputs. These inputs are the addresses Of accounts in bitcoin, and they are really crafted from the Public keys of those accounts, the private pub public key pairs. When you create a bitcoin address and advertising it to Somebody, that's basically derived off the public key that Matches the private key that you keep yourself to be able to Execute transactions like this. In this case, the transaction Has one input and it's got two outputs. So what that is saying is it's taking some input from a Previous transaction and splitting it among two output Accounts and it's splitting it this way. So you can see the total input, Total output matches in this case, it doesn't always match. I will talk about that later. And -- actually it doesn't match. This is the difference here. And that is the fundamentals of Looking at a transaction underneath the hood what you Would see are references to previous transaction hashes Signed here by that account, the private key of that account, the Person that owns that account on the left side, the input account. You can have multiple inputs and multiple outputs so i happened To pick one that just had one input and multiple outputs, but You can have multiple inputs as well so you can take currency From multiple accounts, basically combine it together And spread it out among multiple outputs. One piece of trivia about Bitcoin transaction is the input amounts have to match the output Amounts. If there is a deference, that Money goes to a minor, that fee goes to the minor. There is no way to return unspent money to yourself. If you want to actually return, you know, if you got 10 bitcoin In your account and you want to give somebody 7 and you want the Change back one of the outputs has to be back to yourself of The 3 bitcoin difference. So that's what a transaction Looks like. Now, we are ready to move onto The next building block in a block chain and where it gets It's actual name from that is the blocks themselves. The way to explain how blocks, where blocks come from, you got To talk about how the network agrees about Transactions. So the challenge here with these Networks and with transactions in this decentralized ledger is That everybody, the network is asynchronous. Everybody is, if they are sharing transactions with one Another, we are trying to keep track of what's going on, we can Receive transactions in different orders. And you can imagine cases that are inadvertent or deliberate Where bob would say i'm paying alice 10 bitcoin and they sign That transaction and send it to the network. Everybody gets this, bob is giving alice 10 bitcoin. And then you can imagine that they also send out something Else saying i'm giving, using the same coin, i'm giving 10 Bitcoin to joe, and now there is a transaction flowing around That has bob giving 10 transactions to joe. The order matters because one of those is going to fail. If you put the transaction to alice first, then the Transaction to joe fails because there is no 10 bitcoin in bob's account. If you put them in the other order, the reverse thing happens. And so the network has to agree about what the order is. Because everybody needs to know and agree about how much money Bob has, how much money alice has and how much money joe has. And to achieve some common understanding that's a process Called consensus. The challenge with consensus in These networks is that nobody trusts anybody. You might call this thanksgiving in your house. But this is -- nobody trusts anybody. In fact, there are people that are actively trying to game the System and double spend their coins. This is the double spending Problem that these networks need to overcome. And so the solution to this double spending problem is to Accept proposals for transactions from the network, From entities on the network that combine a bunch of Transactions together and say here is my proposal for the next Batch of transactions we are all going to add to the ledger and Process. Now, the challenge to this is How do you determine whose proposal to take, and how do you Stop the system from getting spammed with a bunch of just Bogus proposals for transactions to be added to the ledger. The solution for that in the case of bitcoin is something Called mining. And this is -- mining gets its Name from the way that bitcoin is actually generated. I will come to that in a second. The entities that try to collect Transactions up and then submit them to the network and say, Shay, everybody here is a bunch of transactions, let's add these To the network and here is the order that they are in, that's The mining process. And if you take a look at the Mining process, they create these blocks with the Transactions in them, and they link it onto the ledger in a Specific place by having that block include the hash of the Previous block. And then what 245 does is Creates this immutable connection between one block and The previous block because that block that was added has the Hash of the previous block. And so you can see the network Here blocks 4, 5, 6, 1, 4, 5, 6, 2, referencing hashes of Everything that goes back to the beginning of time because the Hash of one block includes the hash of the previous block, Which has the hash of the previous block. You can think of it as the hash of the most current block has Some information about the very first block in the whole Network. You change anything in the Middle and everybody can tell something is screwed up because They can't follow that chain back. If i modify block 4561, the hash Sitting there in block 4562 is not going to match that block. The unencrypted version of the block. So that's where it gets, we get The name block chain. And also how we get this Immutability. The immutability shows evidence That the entities that own assets are actually executing Those transfers of assets as well as the immutability of Everything is that has come before in the block chain. So that's what miners are doing is pulling up transactions and Submitting them. Now, it's calling mining because They basically have to dig for the award that comes from Actually producing this and having it accepted by the Network, because lots of entities are out there Collecting transaction that's are being submitted to this peer To peer network. They are putting them together, Putting them in blocks and sending them out. And everyone else is trying to get a view of what the ledger Looks like so they get blocks from lots of entities. One of the goals is to stop, try to prevent spamming of the Network with bogus transaction blocks. So the way That the legitimacy or the genuine desire to Participate in the network is established in the case of Bitcoin and in other cryptocurrencies is through something called proof of work. In proof of work a miner has to show that they have invested Something to produce this block that they are submitting to the Network, that they have spent something. , That has cost them something, That they are invested in that thing being legitimately Accepted by the rest of the network, because orc wise they Are wasting their money. So the way they do that is by Solving a cryptographic puzzle. I have talked about hashes Before and how there is no way to, or using current computing Technologies to generate collision, meaning i will Generate there is a target hash i want to generate so i will Produce some document that hashes to that. That's why hashes are called one way functions. I can't go from a hash back to a document. I can only go from a document to the hash. So the way that they prove that they have invested energy is They have got to produce a block that has a Hash that meets a certain requirement, a hashing Difficulty. So, for example, we got to find A hash, we have got to generate a block that its hash with all Of the data in it is below a certain value. Now, think about that. Because the hash values, there Is 256 bytes in a hash, that's massive amount of space. How do i generate a hash below a certain value? i can't do it deterministically. I don't know what data to put in the block to do that. But the miners are given one little piece of data in the Block format that they can mess with to try to get the hash to Come out to a specific target value or range of values. And so in the case of bitcoin, what happens is the miners are Given this puzzle and they have to find a way to generate a Block with those transactions in it that they want to submit Where the hash has a certain number of leading zeros. So you can take a look at right here, the only way to do that is Through bruit force, just to explore. Take that nons and mess with it. You can see the nons you can see 4. Four leading zeros. At that point, we submit our Block to the network and we say, look, we did the work to go find This n oovment ns that makes the hash of this block have a Certain number of leading zeros. The rest of the network can Verify, yes, the hash of the block has a certain number of Leading zeros, the only way you could have figured that out is To go bruit force it. So that's what miners do is they bruit force. They search the space randomly trying different values. Now, before i come back to that, there is something else that can Happen once, because you can have different miners that are Producing legitimate blocks. They all are solving that puzzle In about the same time plus or minus, so the met work because It's asynchronous, different people on the network can get Different blocks that are legitimate that have the proof Of work puzzle solved. That's what's called a fork. So in this case, we have a fork here after block 234,413. There were two legitimate blocks mined by different miners that Both have the hashes of block 234,413 in them. So the network at that point if You are sitting on the network and you are keeping track of What's going on with it, you get one block, you add it on, you Get the other block, oh, this is legitimate too. You are not sure at that point which block the majority of the Network is going to accept, so what you do is you just keep Them both, and then wait for the next block so show up. And the next block that shows up in this picture is 234,415 that Points at 23,414 and say this is the block that i think is the One that will win, so what i'm going to do if you are a miner Is mine on top of that and try to create the next block that is on the fork. The winner here is the longest chain, and the network basically Converges on the longest chain over some period of time because Of the probablallistic nature And long delays in time it takes to generate a block. It's likely that one fork is going to grow longer than Another fork. By long enough amount of time That everybody, even though the network is asynchronous agrees On that view. So this is called the deeper Chain. Chains are considered deep. So the deeper a transaction is in a chain, the more solid it Is, the more likely it's not going to be undone. The risk of acting on a transaction if it's not deep Enough is that the block that that transaction is in gets Invalidated because that fork of the block chain loses and the Network agrees on a different branch. And what exactly is that risk? Well, if i, for example, accept a payment for a cup of coffee Because i'm a store owner, and i accept that transaction and the Network then chooses a different fork than the one that that Block was in, i never, the network doesn't recognize me Having gotten that money, and that person that paid me that Money might have paid it to somebody else. Now, it's unlikely that that Person will be malicious and double spend but that's the risk That could happen. The stakes are very high in Cases where somebody might actually try to legitimately Screw you. So if i'm selling a van gogh, For example, that's an expensive pointing, and if i sell it -- Painting and i sell it for cryptocurrency and i'm selling It to somebody i don't know, that person might really try to Double spend. It's in their interest to double Spend the money they are giving me so what they might do is give Me a transaction, give the net work a transaction that gives me The money and then immediately create another transaction that Transfers the money to a different account, the same Money. And hope that the branch that They gave me loses. And they might, they use Techniques like going and messing with the network to try To get this to happen. And if i give this person the Van gogh and then that branch that has the payment to me Loses, i'm just out the money and the van gogh. So this is why the recommendation when you pay, When you accept a payment for some good, or looking at a Transaction that you don't consider it really solid until Its got some depth in the block chain. The rule of thumb for any decent size transaction is six blocks, Which in the block chain network is about 60 minutes because in The block chain network, the goal for solving is that Cryptographic puzzle is 10 minutes. And what do i mean by how do they set the goal of 10 minutes? It's interesting because the block chain network, the code it Executes is watching how long it takes for blocks to show up. And if blocks show up for a while significantly faster than Ten minutes, it raises the difficulty of the cryptographic puzzle. It says, oh, it looks like the network is getting stronger. It's able to bruit force more quickly. There is more miners out there Bruit forcing hashes, i will add one more zero to the puzzle and Make it harder. And if the network starts to Slow down, the blocks show up more infrequently than ten Minutes significantly for a while, then that means that There is less mining activity going on, fewer people are bruit Forcing and so we are going to lower the difficulty of the Puzzle to try to get it back to ten minutes. That's why you hear about bit copy transactions roughly or Blocks will roughly be generated every ten minutes or so. So you want to wait about 60 minutes and the chance of Another fork coming along in the network that on scree yates that -- Obviates that deep chain that you have got your Transaction in is highly unlikely. There is so much work generated Right now by mining that it's almost impossible for that Scenario to legitimately show up where you have miners off in the Corner that are mining off a different chain to try to double Spend and then obviate that transaction that you have Somewhere in the chain. So why do these miners do all of This work? why do they want to prove that they have got a stake By doing this proof of work? well, they are rewarded for it? There is transaction at the beginning of a block called the Coin-based transaction that they create, that the network agrees Whoever mines a block that's accepted by the network, gets a Certain amount of coin, bitcoin. This started at 50 bitcoin in The bitcoin network when it larninged and it has, it halves Roughly every 210,000 blocks. The code that executes the Bitcoin network says time to only accept coin-based Transactions that are half of what they were before, and we Are currently at 12.5 Bitcoin. So this is haling roughly every Three to four years. Can you see the built coin money Supply is going to run out sometime in the 2030s at this Rate, at the rate that blocks are being generated. That's intentional. Once the rewards through Coin-base are gone, the way the miners are insented are through fees. You saw the fees whoever executed the transaction said I'm transferring money to this account. I'm leaving some unspent, any Unspent money in a transaction that a miner mines goes to the Miner. So that's effectively the way to Give a fee is to not spend everything that came on the Input to the output. And right now the fees, it's a Relatively small fee paid on top of the transaction, but as this Coin base becomes more and more scarce, the fees are going to Continue to go up and that's the way you are going to incent when You submit a transaction to the network, miners to take your Transaction and add it to the block chain. In fact, already today the basic Rule of thumb that miners follow, of course, is to be Incentivized to put those transactions with higher fees Into the blocks they mine because that will mean more Money for them. And so how they are doing this Mining, they are, by the way, this is a picture of my Basement. Actually, this is not a picture Of my basement, my wires would never be a rats nest like that. But here is a picture of my basement. So what you are looking at here are mining pools. So it's very difficult for you to now sit on one computer with A gpu even and successfully mine blocks, because there are so Many other miners out there that are trying to generate blocks And doing proof of work and doing proof of work at massive Scale, like this in these farms of computers that do nothing but Search for hashes. Search for nons that match the Difficulty of the bitcoin puzzle. The mining pools and you can buy Into them yourself, you contribute to the money to the Mining pool and the mining pool is represented by basically an Investment from anybody that has contributed money. If you contribute 10 of the money that goes into the mining Pool, they are going to buy more mining gear, and if the mining Pool wins a block, they distribute the coin base and the Unspent fees to the members of the mining pool according to the Percentage of their investments. So if i contributed 10 to a Mining pool and my mining pool won a block, i get 10 of Whatever fees and coin base came out of the block. That's an incentive for people to all get together and have a Higher probability of winning blocks. You are going to get less money Out of the block, but you get a higher chance of getting Something than if you are a loner going after it. You could win as yourself, but it's like winning the lottery at This point. Now, as far as who is doing Mining, there is no, basically there are very few individual Miners out there, it's mostly all mining pools. Ninety-nine point nine of bitcoin is done by mining pools And they can advertise who they are when they go and win a block. The reason that they advertise who they are, of course, is Because they want you to go, oh, this is a winning mining pool, i Will go put money into that because i will have a chance of Getting return on the money i put in the mining pool. The interesting thing about these mining pools is where they Are located you can see that china mining Pools control more than 50 of bitcoin's mining. And that's a potential concern to people. You have probably heard of the 51 attacks on cryptocurrencies With that much mining power, if they all got together and said We are going to do double spending, they could do it most likely. They could force the network to have big deep chains that fork And have the people accept transactions on a long fork Keeping a longer one to themselves until they say, okay, Now we have gotten all of the van goghs in the world, let's go Unleash the other fork that we have created that's longer and Now everybody is out of their van goghs and they still have All of the money. Now, the disincentive to do This, of course, is if somebody did that, the value of their Currency would go to zero, but in the case of a miner that is Saying i will do one last thing before i'm out of here, and Basically i cause this whole thing to come crashing down, but I'm walking away with a vote of van goghs, that's the potential risk. By the way, here is the other one Also the interesting thing about china, the chinese regulators Have banned cryptocurrency. And this is from about two Months ago, game over, china wants an orderly exit. We are banning cryptocurrency, we are banning mining, you can't Do mining anymore. I have tried to look to see What's going on with this, but it's still, that mining chart is From yesterday, so the miners are still hard at work mining, And so it's not -- it's unclear at this point what will happen To the chinese miners, what i think will happen is they will Go off shore with their mining operations, but it's going to be Interesting to watch this play out given all that's mining Power in china with the chinese government saying they don't Like cryptocurrency. What's considered an Environmental catastrophe, if you consider the amount of Compute power that's thrown at mining bitcoin at this point in Time, each, an individual transaction, right, so only one Miner wins and the amount of energy they spend on mining that Winning block is relatively small, but all of the energy Everybody is spending trying to get the winning block adds up Such that an individual transaction when you clear it on The bitcoin network, when you submit a transaction to give Somebody else some of your bit cosign is about 270 kill low Kilowatts of power has been burned for getting that Transaction onto the block chain. The total amount of energy consumed by the bitcoin network Is about the amount of energy the country of denmark consumed. So this is why there is a lot of people concerned about how much Energy is being spent just spending the cryptographic Puzzle for the cryptocurrencies. Let's take a quick look at Blocks before we move on. So we were here in this transaction. You can see that it's included in this block here, and this Block has a bunch of information that's embedded inside of it, Like the number of transactions are in it, you can see the total Output of all of the transactions is this amount 6 Bitcoin -- of bitcoin, which is the estimated transaction volume Is 317 bitcoin. So that's the amount per Transaction roughly that people have spent in transactions on this. You can see the difficulty, so that's effectively the number of Leading zeros that the miners have to hash and if you scroll Down you can see the individual transactions. You can see most of them are, Here is two pin puts to one out put. So somebody is splitting up a Bunch of coin and sending it in different directions. That's a quick look at blocks. And, of course, you can take This and say, well, here is the hash of this block, here is the Hash of the previous block and we can follow this chain all the Way back to the beginning of time or the genesis block. So that's a quick look at the block chain for bitcoin. If you put this all together, the bitcoin network, so there Are different kinds of nodes on the network. The ones keeping track of the Full state of bitcoin, they are called full bitcoin nodes. There are about 10,000 of those and that's what really Determines what's on the ledger is all of the nodes agreeing This the way the bitcoin is all divided according to these rules That we all agree on, the most work wins. And anybody can spend transactions. You can go buy it. You typically buy it from Somebody that owns bitcoin, you give them fiat currency in Change for it. You give them their own account. And once it's there, you can then go and send bitcoin to Other people on the network. There is a bunch of other Cryptocurrencies that have evolved over time that are Popular and have decent. Ripple xrp is another one, how Many have heard of ripple. I will come back and talk about That one right thousand. The ripple is one that's got the Cryptocurrency purest a little upset, because the way that i Described bitcoin, there is no central authority. The money is created through mining. So nobody controls who gets it. Nobody controls the amount Except for the algorithms themselves. In the case of ripple, there is Or xrp, there is a company called ripple that issues this currency. And the way that they have generated it is they have given A bunch to themselves. So you can see this is not a Decentralized cryptocurrency. It is a cryptocurrency but not Decentralized, it's based on block chain. Everybody has got a common view of what's going on, but given The cryptographic keys to the network, only the ripple Founders can go generate more xrp. So it's not mined in the Traditional sense or at least the mining doesn't account for All of the xrp that they can inject into the network. So this puts them among the richest people in the world. Ripple prices have come down since the article came out. At the time the article came out they were worth $60 billion. So that's kind of money going into cryptocurrency. And then here is another one ethereum this one has a decent Market cap as well. It's up in the tens of billions Of dollars, but this network isn't designed to be a cryptocurrency network. It's designed to be a network for what are called smart Contracts. So let's talk a little bit about Smart contracts. This is extending the block Chain not just to have simple transactions of asset transfer From one account to another one, but actually to store programs. And those programs canning used to encode business problems. Basically you can encode contracts as code itself on the Network. So these, they are called smart Contracts because they basically execute on their own. Nobody is in control of executing them. You can send events to them. You can call functions in them. The network executes them. In the case of ethereum, Ethereum virtual machine, the language to write these Contracts is solidity. I will show you that in a Minute. And basically it's incomplete, So you can write very complicated contracts inside of Solidity and run them in the public block chain on ethereum. And, again, every state trance is logged into the lock chain, The ethereum block chain so its immutable. So you can go back and follow the execution of a heart Contract back to the beginning. If you take a look at what a Smart contract looks like, i will show you this in a second, But it's got characteristics here. You can hold or transfer on chain assets, meaning you can Have smart contracts and own ether, the cryptocurrency of Ethereum, they can send ether to other accounts, receive ether, But they can also generate their own forms of currency on top, And that's something that people have been doing that i will talk About in a minute. There is some big challenges to Writing one of these smart contracts. Once you put it on the ledger, It's there, and you can't change it. And if you have a bug in it, you Are in trouble. There has been a high profile Case of the dow, back in the middle of last year they had a Bug that allowed somebody to go and call it recursively and Seemty empty it of the ether Assigned to the smart contract and give it to themselves. They gave themselves 10s of millions of dollars before this Thing was shut down. And what that caused is the Great ethereum fork of august of 2017, where the ethereum Founders and committers were faced with this conundrum, the Dow had lost huge amounts of money through the bug, so the Question was oh, well, they screwed up, let's continue Because this is a decentralized currency, we shouldn't be the Police for this. People screw up, they screw up, And then there was the other faction that said, no, no, if This can happen like this with huge amounts of money like that, Then that's going to under mine people's trust in this Network, and we are unwilling to invest In it because their risk of losing something like that is Too high, so let's go fix this. So what they did was fork ethereum. At a certain block they said we are going in a different Direction from the map network and this direction is going to Give the money back. We will agree this money goes Back out of that account into this account, into the dow account. So there was a rift and there were two ethereum forks that are Now out there. And the ethereum that i'm Talking about here is the main, the one that forked, the one That gave the money back to the dow. That's the one that's got five Time the market capitalization of the other one. Bitcoin is also forked into two different bitcoin, bitcoin cash And bth, and it's forked because of differences in opinion Between the people writing the code for the network. There was one faction that said we want to make the network Execute faster and have larger blocks of transactions, so they, And another group that said, no, we are nod ready for that. So they forked. Now, bitcoin was the side that Didn't change the algorithms, bitcoin cash is the one that Did, and now that's about one fifth the market cap of the main Bitcoin. So let's take a look at a smart Contract business process. You have a buyer. You have an escrow agent, you have a seller. And the business process is the Buyer gives money to the escrow agent and when everything is Approved about the sale of the house, then bob gives alice the House effectively. The title is transferred. Now, you can encode that business process into a smart Contract where the escrow basically if alice and eve the Escrow agent agree that they were return the money back to Alice, if bob and eve agree, they pay the money to bob Otherwise they split the money between alice and bob in case There is a dispute. So the escrow agent is in the middle. The dispute resolution is encoded in the smart contract, a Dispute between the buyer and seller where the buyer has Already given the money to the escrow agent and we can resolve That societying right here in the smart contract, coding it in Code and executing functions to cause the state transition here To say signal basically bob agrees and the way that bob can Show, prove that he agrees is by signing a transaction that says He agrees, and that transaction is a call into the mart contract. And that changes the state of the smart contract to bob agrees And then alice can choose to say i agree or don't agree. She can sign the transaction that indicates her choice, and That way that kicks off the next step in the transaction and the Smart contract which is to say, okay, they don't agree, so if Alice and bob agree, i guess don't agree is not in there, Then we have got the escrow agent in the middle to kind of Resolve the dispute and they will pick alice or bob and the Money will go one way or another. So that's a simple example of a Business process encode in the smart contract. There are other more frivolous Processes encoded in the smart contracts. How many people have heard of Crip to kitties. Quite a few. You can buy yourself a Kitten now, the kitten exists only in The ethereum block chain. It's randomly generated kitten. There are like 1024 characteristics or genes that The crypto kitties have. They are randomly generated and What happens is dependology on your genes you get a different Looking crypto kit consider -- Kitty. Different eyes, colors, tails, And what has happened is that people have decides these things Are really cool and they are starting to collect them. In fact, somebody actually spent $100,000 for a crypto kitty. So you can have your cool looking crypto kitty. You can offer to sell it to somebody and get ether that then You can transfer to real cash. So member has spent $100,000 of Ether that get somebody else's crypto kitty that they thought Was cool. Over $20 million have been spent Buying crypto kitties. So this is an interesting phenomenon. Now, the other thing you will see on smart contracts are Initial point offerings, so i have talked about bitcoin, Ethereum, but both are platforms that you can use to launch other Currencies on top of them. This is called an icl. How many people saw silicon valley this sunday, the hbo show. If you haven't seen it pied piper, the fictitious company That we love because they are an azure company, they launched an Ico, pied piper coin, and everybody is getting into it. The initial coin offerings is like a public sale. I will create a token and you can sell the token for the Crypto currency that you want o ether or bitcoin, whatever Network it's on and people can buy coin from you and you can Get the money. This is the way now a lot of Companies are raising money through the icos, regulators are Like wait a minute, this is like an initial public offering of Stock sale, but it's done on crypto currencies on the block chain. Nobody has control of it, so rules around it are still vague. Now, let me take you into ethereum smart contracts, and What i want to do to demonstrate these ethereum smart contracts Is today i will launch mark's token, i will do an ico today. That i hope you all buy. I'm hoeing you what it would look like and how easy it is for You to do our own ico. This is an editor, it's visual Studio and it has the solidity plug in for it. This is a smart contract i have got here. It's mark's token contract, and i will show you some of the Codes in here. We have smart math. If you do and are playing with cryptocurrency you can screw Yourself. So you want to use safe math Functions, and then you can see i have something defined as interface. This is the erc20 interface. This interface is the Standardized interface for tokens built on top of the edge Near yum block chain. So any icm on the ethereum block Chain will implement interfaces. And it will be able to look at The tokens implemented by the smart contract. You can see functions like what's the total supply of the Coin, the token. I can call a function like Transfer just to take some of my token and give it to somebody else. And the way that an ico works is that there is a function called A fall back function, if somebody sends money to a Cryptocurrency, the money or the crip to -- i'm sorry, if Somebody sends crip cryptocurrenc y to A smart contract , it gets routed To a function called fall back that determines what happens to That money. Where is my fall back function Here it is. If you want to, a smart contract To receive money you do this, page. And so that's what -- all of This fall back function is transfer money back into the Smrt contract owner's account. The owner is by default the Account that submitted the transaction to publish that Smart contract on the block chain. You can see i have got a Constructer up here too, which kind of defines the symbol. The name. So if somebody gives this Contract 10 ether they get back 10 of mark's tokens. I made quite a bit of supply for myself because i expect to raise A ton of money. What i can do here in the local Dev environment, is compile that code. First, i will delete the previous output. And i can type compile, and then what i can do is type migrate And that will deploy it in my local system in a synthetic Block chain here i used for debugging purposes and i can do Things like mark's token deploy ed then and then i can put In a lamb da, return, i.Total Supply just to show what the total supply of my coin is It will take me too long to figure out what typo i had. So basically what i can do inside the debugger is interact With any smart contract. What i can do with the smart Contract is publish it. I will publish this smart Contract as an initial point offering not in the main Ethereum network, but in a test network called rob's team. This is an ide called remix. I have my same smart contract up Here and if i say run, run Deploy, what that's going to do is ask for some test Ether and then deploy this to this test Network. And i have already deployed this Previously, a version of the contract, you can see it's here. And you can see this smart contract address. It gets its own address on the network. It looks like any other account address. It's got a private and public key. You can see the transactions that this smart contract has accepted. What i have done already with this version of mark's token is Transfer money into it and out of it between parties. And because it's the erc20 interface, these uxs like this Know it's a token. And you can click on the token, And it will show you things like oh, these are all of the token Transfers that were made of mark's token. And here are the token holders. So that's an example of smart Contract as a cryptocurrency, as a token deployed on the test ethereum network. If i want to do a real ico, i could go and launch that on the Main ethereum network and say everybody, hey, go buy mark's token. You are going to get rich, i'm going to get rich, we are all Going to get rich together. It will be awesome. Now, the smart contracts, i showed you some frivolous cases, Icos trying to raise money as well as cryptocurrency kind of Beanie baby thing, but block chains and smart contracts are Used in many enterprise scenarios. If you think about them in trade Finance to do cross border payments without any middlemen Without any settlement fees without any settlement delays of Transactions from one company to another one, you can think Digital music rights, who owns the rights to this piece of Music? that was on a block chain. Everybody could know which Artist to pay or which organization that owns that Rights to that they should play whenever they play the song. Today artists get very little of the money they are due because Nobody knows who they should pay, what account they should Give money to. Diamond tracking is another one. So the legitimacy of diamonds. If you have a diamond, it has a Certificate of authenticity from a company you trust and you can Look at the block chain and see that this actually, the diamond Came from the company, and was actually sourced from legitimate Place. Real estate sales, so this is Where you are transferring assets from one house, or from One person to another. I showed you a shortened example Of that back with the escrow thing. Supply chain management is a Huge scenario for enterprise block chain, keeping track of What suppliers have and where things are along the supply Chain when there is multiple suppliers and the goods being Shipped between them. Today if you take a look at the Hotel business, which is a hotel supply chain problem with a lot Of hotel operators having inventory that they are selling To purchasers, right now there are about $10 billion a year in Fraud in the hotel industry because of the lack of, the Decentralized view of what the hotel inventory is and who owns It. Again, when somebody sells their Hotel inventory to somebody else, then things can get double Spent, intentionally because of fraud and things can get lost as Well, because we just lose track of who has it. Who has the inventory which can happen if we are all maintaining Our own views and our own databases of what's going on. And the list of potential scenarios is really limitless. We have got one in microsoft that we are creating. It's called it's a consortium block chain meaning only certain Participates of authorized to participate in it as opposed to The public block chains. This is the microsoft treasury Working with bank of america to do stand by letters of credit on Behalf of purchasers, the partners that we have got. And we work with the bank of america to issue these stand by Letters of credit for them or we get them from, you know, Microsoft to the applicant, you can see the complex business Flow that is simplified if we encode this on a smart contract, And just have this execute on the smart contract where the Partner, where us, and where bank of america can all see What's going on every step of the way, and the rules are Encoded in the smart contract, so they execute in an automatic manner. So we are seeing lots of interest, ethereum is just one Of the potential networks to run these kinds of smart contracts, You can see other ones, corda, hyperledger, fabric, and quorum Are other examples, but one of the challenges with many of These is that they work on proof of work or other consensus Algorithms that waste energy or have low performance in Transaction clearing or throughput. And they lack governance. This is where we have created something called the cocoa Framework which is based off the trust and execution environment. If you are in my session this morning you saw awhat that is. You can use these to establish a trusted net where we all trust The block chain code. We trust it to do what we expect It to do and it can implement rules that we agree to and it Can establish con sent us quickly because every node Trusts every other node. So i will show you a really Quick demo of public ethereum versus cocoa enabled ethereum Executing 2,000 transaction that's have been reported off The public ethereum network, you can see that the cocoa network Has just completed them all. And it's executed at about 1600 Transactions per second. You see the average latency is 5 Seconds, actually, it should be less than that. There is something wrong with The ux. All right. Typically what we see is 1600 transactions per second, and you can see the ethereum side. The ethereum proof of work is 10 seconds rather than ten minutes Like bitcoin, but that means you have to wait a minute before you Can trust a transaction is clearing on the public ethereum Network or a consortium network that's using the ethereum proof Of work consensus algorithm. You can get started by creating A wallet. Coin base is one of the popular Places to get a wallet. You can download bitcoin and set Up a full node. You can join a mining pool if You want to. Warning about these exchanges, So coin base, well, that's not a warning, but coin base is Generating a huge amount of money just with all of the people that are signing up and Buying cryptocurrencies through them, a billion dollars, but This is something that can happen, and it's happened for Several exchanges. It gets hacked and the money leaves. These are basically banks with the amount of money they store And the amount of money that attackers want to get into. So finally, some resources to point you at, block chain on azure. One of the things to check out if you are interested in Enterprise block chain scenarios which is workbench which we Released this week at build which simplifies everything. You are not sitting in low level tools to create smart contracts Or interact with them ux to understand what the smart Contract state looks like. It's really something i think we Will transform enterprise block chain by making it so simple. So there is a place to sign up. There is a github repo where you Can check out samples for Workbench and here we got it over here. So go check out the azure samples for block chain. And that brings me to the conclusion of the talk. I have just got one last thing to show you. One of the challenges with or values of block chains is Immutable which is also one of the risks or maybe benefits Depending how you look at it. This is a transaction on the Bitcoin cash network. One input and lots of outputs. This is actually encoding an imagine side of these outputs Which are not real bitcoin cash addresses. They are just there encoding bits in a png file. And this is the png file that's going to be forever on the Bitcoin cash network. So with that i want to thank you
Info
Channel: Microsoft Developer
Views: 35,396
Rating: undefined out of 5
Keywords: An Introduction to Blockchain with Mark Russinovich, BRK2507, Azure, Cloud, Build2018
Id: cYWal114BOw
Channel Id: undefined
Length: 77min 8sec (4628 seconds)
Published: Wed May 09 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.