Cryptocurrency Mining For Dummies. Peter Kent. Читать онлайн. Newlib. NEWLIB.NET

Автор: Peter Kent
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Личные финансы
Год издания: 0
isbn: 9781119885382
Скачать книгу
Czech Republic). Mining (in the mineable cryptocurrencies; nonmineable currencies have different mechanisms) is an integral part of making sure these conditions are met:

       The system doesn’t require a central authority and is maintained through distributed consensus. That is, everyone agrees on the balances associated with addresses in the blockchain ledger. Mining is an integral part of adding transactions to the blockchain and maintaining consensus.

       The system keeps track of cryptocurrency units and their ownership. Balances can be proven at any point in time. Mining adds transactions to the blockchain in a way that becomes immutable — the blockchain can’t be changed. If the blockchain shows your balance is five Bitcoin, then you absolutely do own five Bitcoin!

       The system defines whether new cryptocurrency units can be created, and, if so, the system defines the circumstances of their origin and how to determine the ownership of these new units. A fixed issuance or inflation rate is predefined. Mining provides a way to release new cryptocurrency into circulation at a predetermined, controlled rate, with ownership being assigned to the miner.

       Ownership of cryptocurrency units is proved through cryptography. The three conditions of authenticity, nonrepudiation, and immutability are met, through the use of cryptography. Miners, using cryptography, verify that transaction requests are valid before adding them to a new block. The miner verifies that the transaction request is for a sum that is available to the owner of the crypto, that the owner has correctly signed the request with their private key to prove ownership, and that the receiving address is valid and able to accept the transfer.

       The system allows transactions to be performed in which ownership of the cryptographic units is changed. Transactions can be submitted only by senders who can prove ownership of the cryptocurrency being transferred. Cryptocurrency owners prove ownership by signing transactions using the addresses associated with a private key. Mining is the process through which transactions are accomplished, and miners verify ownership before adding the transaction to the blockchain.

       If two different instructions for changing the ownership of the same cryptographic units are simultaneously entered, the system performs at most one of them. Double-spending the same unit is not possible. The problem of double-spending was one that weakened earlier digital currencies. But with modern cryptocurrencies, miners vet transactions, searching the blockchain record of transactions to determine whether the owner actually has sufficient balance at that moment. If a sufficient balance isn’t accounted for within the spend address (the Input address) in the transaction request, the transaction will be rejected by the node software and never mined onto the blockchain. Also, if the same sender has two or more pending transaction requests, but doesn’t own enough cryptocurrency to cover them all, miners can decide which of the requests is valid. Additional transactions will be discarded to avoid double-spending the same currency.

      A mind exercise known as the Byzantine Generals Problem (or the Byzantine Fault, the error avalanche, and by various other names) illustrates the problem that cryptocurrency consensus algorithms seek to solve.

      The overall problem? You’re trying to reach consensus; in cryptocurrency, you’re trying to reach agreement over the history of currency transactions. But in a cryptocurrency network, a distributed computer system of equals, you have many separate computers (nodes); the Bitcoin network, at times, has 50,000 to 200,000 nodes connected. Out of those thousands of systems, some are going to have technical problems: hardware faults, misconfiguration, out-of-date software, malfunctioning routers, and so on. Others are going to be untrustworthy; they’re going to be seeking to exploit weaknesses for the financial gain of the people running the node (they are run by “traitors”). The problem is that for various reasons, some nodes may send conflicting and faulty information.

      So to deal with this problem, a sort of parable or metaphor was devised, called the Byzantine Generals Problem. (Three guys — Leslie Lamport, Robert Shostak, and Marshall Pease — first told this story in 1980, in a paper related to general issues of reliability in distributed computer systems.) Originally named the Albanian Generals Problem, it was renamed after a long-defunct empire so as not to offend people from Albania! (Although in this interconnected world of constant social media offense, there must be at least some offended residents of Istanbul.) Apparently, distributed-computing academics like to sit around and devise these little metaphors. You may have heard of the dining philosopher’s problem, the reader’s/writer’s problem, and so on. In fact, the Byzantine Generals Problem was derived from the Chinese Generals Problem.

      Anyway, here is the idea, as described in their original paper:

       We imagine that several divisions of the Byzantine army are camped outside an enemy city, each division commanded by its own general. The generals can communicate with one another only by messenger. After observing the enemy, they must decide upon a common plan of action. However, some of the generals may be traitors, trying to prevent the loyal generals from reaching agreement. The generals must have an algorithm to guarantee that

       A. All loyal generals decide upon the same plan of action… .

       B. A small number of traitors cannot cause the loyal generals to adopt a bad plan.

      

Search online for “The Byzantine Generals Problem” if you’re interested in seeing the original paper.

      That’s the problem that cryptocurrency consensus algorithms, as they’re known, are trying to solve: how the generals (the computer nodes) come up with consensus (all agree on the same plan of action — or transaction ledger), and avoid being led astray by a small number of traitors (faulty equipment and hackers).

      To have a chance at the mining reward, miners must set up their mining rigs (the computer equipment) and run that cryptocurrency’s associated mining software. Depending on how many resources the miner is committing, they will have a proportional chance of being the lucky miner who gets to create and chain the latest block; the more resources employed, the higher the chance of winning the reward. Each block has a predetermined amount of payment, which is rewarded to the victorious miner for their hard work to spend as they wish.

      So how is the winning miner chosen? That depends. In most cases, one of two basic methods is used:

       Proof of work: Under this method, the miner has to carry out a task, and the first miner to complete the task adds the latest block to the blockchain and wins the block reward, the block subsidy, and transaction fees. Bitcoin and other cryptocurrencies, such as ether (for now; it plans to switch to proof of stake at some point), Bitcoin Cash, Litecoin, and Dogecoin, use proof of work.

       Proof of stake: In this system, the software is going to choose one of the cryptocurrency nodes to add the latest block; to be in the running, nodes must have a stake, generally meaning that they must own a certain amount of the cryptocurrency. The cryptocurrency network chooses the miner who will add the next block to the chain based on a combination of random choice and amount of stake — for example, with some cryptocurrencies, the more cryptocurrency owned and the longer it has been owned, the more likely the miner is to be chosen. (It’s like owning lottery tickets: the more you own, the more likely you are to win.) With other cryptocurrencies, the choice is made sequentially, one by one, from a queue of preselected miners.