Cryptocurrency Mining For Dummies. Peter Kent

Cryptocurrency Mining For Dummies - Peter  Kent


Скачать книгу
that builds trust. Nodes will get blocked by other nodes — depending on the infraction nodes may be blocked for a few hours, or permanently blocked for obviously intentional misbehavior — and thus the system is self-regulating. Because nodes don’t trust other nodes, the overall system can be trusted.

Screenshot depicting a live view of the full listening node count on the Bitcoin network as well as the distribution of these nodes across the world.

      Source: https://bitnodes.io

      Say that you want to send someone some money, some of your Bitcoin. (Remember, we’re writing this from the perspective of Bitcoin; other cryptocurrencies may function slightly differently, but the core principles are much the same.)

      And say that you have a single Bitcoin associated with an address in the Bitcoin blockchain, and you want to send one tenth of that money (0.1BTC) to Joe. (It doesn’t matter why — perhaps payment for a purchase, for some work Joe did for you, a charitable donation, a bribe, or whatever. All we care is that you’re sending 0.1 Bitcoin to Joe.)

      So, using your wallet software, you enter Joe’s address, the Bitcoin address he gave you to use for the transaction. You state how much Bitcoin you’re going to send him (0.1BTC). You also state how much of a fee you’re willing to pay for the transaction.

      Looking at transaction fees

Snapshot of a view at the time of writing of the average transaction fee as measured in Bitcoin on the network.

      FIGURE 3-2: A view at the time of writing of the average transaction fee as measured in Bitcoin on the network.

Snapshot of a view at the time of writing of the average transaction fee as measured in dollars on the network.

      FIGURE 3-3: A view at the time of writing of the average transaction fee as measured in dollars on the network.

      A Satoshi is the smallest unit of Bitcoin — one hundred millionth of a Bitcoin. If your wallet balance is 1.00000001 BTC, the last digit denotes one Satoshi. Your wallet software will probably suggest a fee, estimated on current rates and network congestion; some wallet software will pick the fee for you, while other software lets you set that fee manually for more precision and to avoid over spending. Pay too little, and the transaction may not go through or may take a long time; pay too much, and, well, you overpaid. Transactions with higher fees will get picked up by mining software quicker than those with lower fees, of course; the more high-fee transactions in a block, the more the winning miner will earn.

      For our example, say that you decide to pay a 0.0004BTC fee. Now, say this is your address:

       1x6YnuBVeeE65dQRZztRWgUPwyBjHCA5g

      Remember, it has a balance of 1BTC. That’s what’s known as the input for the transaction.

      Here’s Joe’s address:

       38DcfF4zWPi7bSPkoNxxk3hx3mCSEvDhLp

      That’s one of the outputs in the transaction. So far the transaction looks like this:

       Input1x6YnuBVeeE65dQRZztRWgUPwyBjHCA5g - 1BTCOutput38DcfF4zWPi7bSPkoNxxk3hx3mCSEvDhLp - 0.1BTC

      But wait, we need another output. We’re putting 1BTC into the transaction, giving 0.1BTC to Joe, so we have to decide what happens to the other 0.9BTC. Actually, the other 0.8996BTC, as 0.0004BTC is being paid to the miner as a fee. So, where does the 0.8996BTC go? It goes back to you, of course, as your change. So the transaction might now look like this:

       Input1x6YnuBVeeE65dQRZztRWgUPwyBjHCA5g - 1BTCOutputs38DcfF4zWPi7bSPkoNxxk3hx3mCSEvDhLp - 0.1BTC1x6YnuBVeeE65dQRZztRWgUPwyBjHCA5g - 0.8996BTC

      We’ve shown 0.8996BTC going back to the original address. (Imagine going into a store with a ten-dollar bill, and paying $1 for something. What happens? You take $10 out of your pocket, hand it to the clerk, the clerk gives you $9 back, and you put the $9 back into your pocket.)

      Change address

      We’ve shown the change coming back to the same address used for the Input, and that’s certainly possible. However, most wallet software will use a different address, or a change address, for the second of these outputs. Either way, you get the change back to an address owned by you, managed by your wallet software.

      Note that nothing is stated in the outputs regarding the fee. That’s because the transaction sent by your wallet doesn’t explicitly state the fee. Rather, it says, “send 0.1BTC to the first address, send 0.89996BTC to the second address, and keep the change!” And that’s just what the miner who wins the right to add this transaction to the blockchain will do: The mining rig will keep the change as a transaction fee.

      PUBLIC KEY ENCRYPTION

      Cryptography is the crypto in cryptocurrency; it uses what’s known as public key encryption. It’s how you prove that you own the money associated with an address. The person spending the cryptocurrency uses a private key to encrypt the message and then bundles the associated public key with the message. The miner can determine that the address from which the cryptocurrency is coming is associated with the public key, and thus if the public key can decrypt the message, the message must have been created by the person controlling the associated private key. (All three — private key, public key, and address — are mathematically and uniquely associated.) See Chapter 2 for more details.

This transaction information is put into a script, a text message that will be sent out over the crypto network. Your wallet software uses your private key to sign the transaction — that is, it encrypts the transaction information using the private key. It then adds the associated public key to the message and sends the transaction out onto the Bitcoin network. Within seconds, a node will receive the transaction; just as, when you send an email, within seconds your email will be received by a mail server. (You can think of your wallet program as a special form
Скачать книгу