How Miners Secure Bitcoin & Blockchains (ft. Hamza, Pavlovic & Wang)

in two previous videos we discussed the Bitcoin and the blockchain tl;dr The bitcoin is a distributed currency which means that the set of all Bitcoin transactions and the amount owned by all Bitcoin accounts are publicly managed to by any computer who would want to do so on the internet such computers are called miners A miner tries to extend the blockchain by appending a block at the end of the chain it is a process running on some computer and it is performing work that needs to be done in order to add Bitcoin transactions to the Bitcoin ledger anyone can participate as a miner and the impact you have on the blockchain is somehow proportional to the computational power you have as a miner, how many operations you can do per second these were Jingjing Wang, Matej Pavlovic and Jad Hamza, of the IC school at EPFL and they’ll be our guides today in our attempt to understanding the role of the miners in managing the blockchain People maintain the same blockchain and anyone can try to append a new block to the blockchain so when you find a block you broadcast it to everyone so that everyone appends it to their blockchain so that everyone keeps a same copy But if I could do this cheaply then anybody could do this cheaply and that would be bad trolls would be able to write anything they want in the blockchain, and everything would turn into a huge mess. To maintain a safe and spam-free blockchain, we need to restrict everyone’s right to add blocks to the blockchain to append a block you need to solve a mathematical puzzle which takes a lot of computational power. In order to contribute to the blockchain, a miner has to solve a mathematical puzzle which has basically nothing to do with the content of the blockchain. But there’s more, we’ll get miners to vote for which block they want to add to the blockchain. Now we cannot do this with a basic classical vote as the one we use in democracy. This would be prone to what we call a Sybil attack where anybody could create a lot of identities and express a lot of agreement or disagreement, on what is in the ledger and what should not be in the ledger and anybody could have arbitrarily many votes and overtake the system so we don’t want every miner to get one vote but how can we get them to vote without having them voting? The great idea of the bitcoin, is that the way the miners will be voting for what they think is the right blockchain is through some indirect measure of that computational power intuitively, if we make a miner compute a proof-of-work, before he can express its agreement or disagreement about what is in ledger, then in order to vote you need to have a lot of computing power and in general it is much harder to gather a lot of computing power than to forge a lot of identity roughly speaking, the right blockchain would be the one that is supported by the majority of miners’ computational power. And the way this computational power is measured, is through the miners’ ability to compute so-called proofs of work. So in general a proof of work is a simple solution to a hard problem. In general, a lot of work needs to be done to find such a solution to this problem but once you have a solution it’s a rather easy to verify that this solution is the correct solution for that problem. In bitcoin in particular, the problem is the following: A miner needs to find a number that we call a nonce such that when you take this nonce, combine it with some other things from the Bitcoin protocol, and you complete the hash of all this, then the resulting hash is also a small number. But, what a hash function? A hash function is a function that usually takes a rather big input and produces a rather small output this is in general. In Bitcoin, we use a special hash function that has a very crucial property that is important for Bitcoin and that is that the function is not invertible this means that it is extremely hard to start from the output and compute what would be the input to the hash function, that would produce the output if this is infeasible, then the function can be used as the as a hash function for the Bitcoin system In particular, cryptography experts now believe that there is no smart way to find a nonce that will produce the desirable hash. It seems that the only way to find such a nonce is through some dumb brute force computation. What the miner have to do is to just try a lot a lot, a lot, of nonces and compute a lot of hashes and at some point you might be lucky and find a hash that is small enough given a nonce you tried. And once he has this nonce everybody will believe that he computed a lot of them before he found the right one. And this is why this right nonce can be used as a proof of work ok… but why does providing a proof-of-work count as a vote for the blockchain which one believes to be right? Somehow the fact that a minor append new transactions to the global ledger also expresses that the miner agrees with what is already in the ledger so if I’m a minor and if I append new transactions this is an expression of my agreement with what has been in the ledger so far let’s insist more on this crucial aspect of the Bitcoin. As we discussed in a previous video, forks are actually quite likely in the blockchain. This means that, at any point in time, there may be several different incompatible versions of the blockchain out there. Now there’s an implicit rule that says that the longest sensible blockchain out there, is supposed to be the right blockchain. Of course, the trouble with the internet is that communication can be slow and there can be latencies so that some Bitcoin miners might not be aware of the existence of this longest sensible blockchain. And until they are told about the existence of this longest blockchain, they will tend to believe that some other blockchain is the right blockchain in other words, because of the unreliability of the internet we will unavoidably have disagreements in the network that’s why we need to vote the crucial idea of the bitcoin is that miners will be voting for the blockchain they believe to be right, by adding blocks to this blockchain, hence making it even longer and thus even more trustworthy In particular, thereby, if one blockchain gets slightly longer than the others, then it will attract the votes of all miners which will in turn make it even longer and thus even more reliable the probability that the fork continues to happen decreases exponentially in the length of the fork so the more you go the more likely it is that one chain wins and that people are going to drop the second chain. One chain is going to become longer at some point But in practice, when can we assert that no alternative fork will ever catch up to the leading blockchain? If you are conducting a large Bitcoin transaction you’d better wait for a few confirmations it depends how big your payment is but if it’s really a large payment then you should be safe with six confirmations you need to wait one hour to get six confirmations in average let’s sum up what we’ve discussed. The miners are computers that are voting for the blockchain they believe to be right by investing computational power to make this blockchain even longer, and thus even more reliable. But why would miners do that why would they indeed vote for the blockchain they believe to be right and why would you block the add contain what the users wanted to write it down? Shouldn’t we make it at least to the miners at least accountable for the actions? Shouldn’t their identity be made public? we do not really know who are the miners it’s a peer-to-peer system. we do not know them in person, i mean. the miners are just processes running on some computers. And in general we do not know who they are or who they are controlled by this is why we cannot trust them in general. So why should we trust the blockchain? what are the miners incentives? yes this is a good question. Why does the miner invest a lot of computation power and a lot of electricity and resources to compute this proof of work? The incentives are the Bitcoin created for one thing. When they succeed in appending a block, they earn Bitcoins by appending this block like this, i compute hashes all the time and my reward is bitcoins that i can spend in fact is the miners literally write in the block they add, something like: “I, miner X, give myself 12.5 Bitcoins out of thin air.” And crucially because this is part of the standard Bitcoin protocol, all the miners will be voting for blocks that say so, that is, they’ll be searching for a nonce compatible with such blocks. It is why it is named miner, because it’s similar to the gold miners that put effort to get gold and earns a lot of gold currently, the largest part of the reward to the minor is this reward but they also get rewards from the transaction fees that people attached to their transactions if they succeed in appending a block that includes such transaction they also win that transaction fee you never have to attach a fee but if you don’t, then you’re not guaranteed that the miners are going to include your transaction in a block. The bigger your fee is, then the more likely you are to be included in the next block which is found by the miner because the miner are going to get this fee for themselves, once they find the block so by adding a fee for the miner you give the miners further incentives to mine correctly and as well to include in the block they’re adding what you want them to write down. Actually, the space in each block is limited I think, currently to 1 MB so by paying your fee, you basically pay your entrance fee to get into the next block which has limited space it’s been three episodes already but there’s still so much more to say about the Bitcoin, the blockchain and the miners in a future video we’ll talk about the attacks on the blockchain and how the Bitcoin protocol so far, has withstood these attacks If this huge mining pool maybe together with two others start cooperating on cheating then only these 3 leaders of these 3 mining pools could theoretically control the whole system

One thought on “How Miners Secure Bitcoin & Blockchains (ft. Hamza, Pavlovic & Wang)

Leave a Reply

Your email address will not be published. Required fields are marked *