Cryptocurrency Mining For Dummies. Peter Kent

Чтение книги онлайн.

Читать онлайн книгу Cryptocurrency Mining For Dummies - Peter Kent страница 16

Cryptocurrency Mining For Dummies - Peter  Kent

Скачать книгу

      

How you mine a particular cryptocurrency varies slightly depending on the type of cryptocurrency being mined, but the basics are still the same: Mining creates a system to build trust between parties without needing a single authority and ensures that everyone’s cryptocurrency balances are up-to-date and correct in the blockchain ledger.

      The work performed by miners consists of a few main actions:

       Verifying and validating new transactions

       Collecting those transactions and ordering them into a new block

       Adding the block to the ledger’s chain of blocks (the blockchain)

       Broadcasting the new block to the cryptocurrency node network

      The preceding mining process is essential work, necessary for the continued propagation of the blockchain and its associated transactions. Without it, the blockchain won’t function. But why would someone do this work? What are the incentives for the miner?

       Transaction fees: A small fee is paid by each person spending the cryptocurrency to have the transaction added to the new block; the miner adding the block gets the transaction fees.

       Block subsidy: Newly created cryptocurrency, known as the block subsidy, is paid to the miner who successfully adds a block to the ledger.

      Combined, the fees and subsidy are known as the block reward. In Bitcoin, the block subsidy began at 50 BTC. (BTC is the ticker symbol for Bitcoin.) The block subsidy at the time of this writing is currently 6.25 BTC. The block subsidy is halved every 210,000 blocks, or roughly every four years; sometime around spring 2024, it will halve again to 3.125 BTC per block.

Screenshot of a transaction displaying the block subsidy and transaction fees being paid to a miner, from the BlockChain.com blockchain explorer.

      FIGURE 2-1: The block subsidy and transaction fees being paid to a miner, from the BlockChain.com blockchain explorer.

      For a cryptocurrency to function, several conditions must be met by the protocol. We like Jan Lanksy’s six-factor list (Jan is a cryptocurrency academic, teaching at a university in the 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

Скачать книгу