Tag: decentralized security

  • Day 5 — Why Would Anyone Spend Real Money to Mine Bitcoin?

    And we have now stumbled across the clever incentive structure at the heart of Bitcoin. As we learned, transactions are verified globally by a network, then added in blocks and appended to the blockchain through a competitive computational puzzle that requires extensive resources (in the form of specialized hardware, constant electricity, and some degree of patience) to solve. It doesn’t take a genius to realize that this leads to an obvious question. Who in their right mind would want to donate these real world resources (time, money, and energy) to operate this system?

    The answer comes down to the incentive layer:

    Bitcoin is constructed in such a way that participants contributing to the network are financially rewarded for their labor. When a miner successfully solves the computational puzzle and thus publishes their new block of transactions, they receive the reward of freshly created Bitcoins. Added to the reward of newly generated coins, a miner also gets a reward in the form of the transaction fees that their transactions collectively accumulate. These two rewards together motivate miners to expend their computational resources to participate in the system. Without this layer of incentive, it’s hard to imagine someone wanting to waste their resources on a system they don’t own.

    The brilliance of this construction is that it makes securing the network an economic activity. Miners are rational, self-interested agents making costs-benefits assessments. They invest in better machines, look for the cheapest source of electricity, and fiercely compete against each other for block rewards because it is the most plausible means to obtain the network’s currency. In doing so, Bitcoin turns security from a technical issue to an economic one. The network’s security relies on the financial interests of the network’s operators, rather than on assumptions about their honest intentions.

    To see why this system is so reliable, look at what happens when miners do try to cheat. A miner could include a fraudulent transaction, but once a block is submitted to the network, it will be individually verified by each other node. The block, which violates protocol rules, will be rejected very quickly. The cheated miner ends up wasting their entire computation and electricity expenditure, all for nothing. Miners who follow protocol rules, on the other hand, have a chance to earn rewards. It quickly becomes more economically feasible for miners to behave honestly rather than cheat.

    This system ensures the security of the network in yet another way: the larger the amount of computation invested, the more secure the system is. It is exponentially harder to perform enough computation to successfully “fork” the blockchain. This implies that it is far easier for thousands of people running inexpensive, specialized hardware for the benefit of the entire network, rather than for one entity to obtain enough computational power to disrupt the entire network.

    Finally, one other fundamental mechanism in Bitcoin to make sure that new Bitcoins are generated at a controlled rate, is its capped supply of new coins. In contrast to traditional currencies where their value is mostly regulated by monetary policy through the creation or destruction of cash (in the form of fiat money) by banks. In Bitcoin, however, new coins enter into circulation as a result of the mining process, and the rewarded number of new Bitcoins is decreased over time,halving itself, and that in turn controls the scarcity and therefore the perceived value.

    All in all, this entire system appears to be incredibly well balanced. Economic incentives are driving participation in securing the network, and the strict cryptographic rules guarantee the integrity of the transactions in the blocks. The decentralization of thousands of nodes globally contributes to the agreement on the ledger. Because there’s no trust placed in anyone or any organization, and simply placed in mathematical principles and economic incentives, people on Earth are allowed to engage in mutual agreements concerning a shared financial history without ever knowing each other personally.

    With the power and expense of mining growing ever so increasingly, we might start wondering if mining might ever centralize, causing the system to be not so decentralized after all.

    In our next post we discuss mining evolution, mining pools and how decentralization could survive against competing, ever-improving technologies.

  • Day 4 — The Puzzle That Keeps Bitcoin Honest

    So, we came to an interesting point here: miners are competing with each other in adding a new block to the blockchain, and to do so, they need to solve a computational puzzle. The miner who solves it first gets rewarded in Bitcoins. On first look this seems a little strange. Why does a financial system rely on solving puzzles, and what does solving puzzles have to do with sending money? It might seem unnecessary at first, but this is where it all starts.

    We need to look at what these miners are doing in the background. When a miner gets some transactions from the network, it bundles them all up together to form a “block” that can be added to the blockchain. This block contains a list of all these transactions as well as some extra data linking it to the previous block on the chain. So it’s not just an isolated lump of data, rather it’s just a further part of the blockchain, and is linked to previous bits of data in a way that forms continuity through the entire chain. However, in order for a miner to add this block to the blockchain, they have to work out what number can be combined with all of the other data in the block in such a way that a specific condition, set by the network, is met.

    This is where hashing is important. You can think of a hash as a digital finger-print for data. Any chunk of data can be put through a hashing function (whether it’s a sentence, a file or a block full of transactions) and we will get a seemingly random fixed length output. But the beauty of hashing functions is that they’re incredibly sensitive to change. If I alter the slightest bit of the data, even just changing one letter in a sentence, the hash will be completely different. This means every block can be given a fingerprint, based not only on the data inside it, but also the fingerprint of the block which precedes it. The chain becomes self linked.

    This makes the blockchain incredibly tamper evident. If I wanted to change a transaction in an earlier block, the hash would change, breaking the link between that block and the one following it. This would cascade through the entire blockchain, and it would become impossible to make any changes at all.

    However, what are miners actually solving? The network has one condition. In order to be considered valid, the hash of the block must meet a specific criteria (for instance, it must start with x amount of zeros). Although this sounds simple, it’s actually incredibly computationally difficult to figure out. There is no direct way to work this out, miners have to try out millions, or even trillions of possible inputs until they find a suitable one. They do this by changing a small value within the block known as a ‘nonce’, a value that when paired with the rest of the data in the block, is hashed repeatedly, over and over until a suitable result is found.

    It’s like trying to break into a combination lock without any numbers at all. It just requires brute force. When a miner does eventually find a valid block, they simply show it to the network. The other nodes can easily verify that it is a valid solution, and thus the block is added.

    This creates a disparity in ease; solving the problem is extremely computationally expensive, however verifying it is easy. This is part of what ensures Bitcoin is so secure. The cost in resources, meaning it’s effectively impossible for malicious users to disrupt the system. To alter an earlier transaction you’d have to carry out the same computational effort for that block and every block after it, plus beat everyone else on the network to it, and all of this at speed.

    This whole system is known as Proof of Work and ensures that a degree of effort is involved in the process of adding to the blockchain to make it resilient to attacks. Instead of relying on trust from a central party, Bitcoin uses mathematical functions.

    We now have the structure of the whole thing working; transactions get submitted, verified by various parties on the network and then grouped together by miners who then add the block to the blockchain through the process of Proof of Work. There’s no central entity involved and it works well.

    This leads nicely into one final, crucial question: If it takes such resources to mine blocks (time, electricity, computational power), what drives miners to do this work for the network?