2

I’m very much new to understanding this whole bitcoin concept. As far as I’m concerned, nodes mine for a nonce that, when paired with the data of the block, result in a hash that suffices some requirement (like it needs to start with six 0s). I’m also under the impression that this process is what verifies the user isn’t ‘double-spending’ and has sufficient funds. How does doing this help confirm that?

Edit: and also a block is just a bunch of unverified transactions along with some additional data, right?

2 Answers 2

2

The purpose of mining is not verification but putting transactions into a sequence, a specific order.

Miners publish blocks of transactions in order.

If two or more miners publish a block at the same time, other nodes will eventually choose the block that forms the chain with the most work. The hash must be less than the current target independently calculated by every node.

When a transaction is included in a block, we say it is confirmed. Confirmation is not verification. Confirmation is of the order of transactions.

Verification is a checking of correctness performed by every Bitcoin node, including wallets. It is not a service performed for others. One of the checks is that a transaction does not spend money already spent by a transaction earlier in the order.

3
  • This whole bitcoin thing confuses me. What's the point of a blockchain and why does it need to be maintained? How does one 'double spend' and how can they be prevented from doing so? I swear I've read so much on it and it just seems like words to me. You don't have to answer all the questions, I'm just being expressively confused and frustrated
    – Johnafoon
    Commented Oct 13, 2023 at 10:05
  • 1
    @Johnafoon: Try the search facility here, there are probably good answers to those questions. Commented Oct 13, 2023 at 10:09
  • Nodes extend their best chain with the first block they hear about. They will only reorganize if they learn about a chaintip with more work. As long as two chaintips are tied in work, nodes will stick to whatever chaintip they first heard about. If a lower hash were a tie breaker between competing chaintips that would enable selfish-mining and a variant of the Finney attack: bitcoin.stackexchange.com/q/53825/5406
    – Murch
    Commented Oct 13, 2023 at 17:52
1

You can think of transactions as destroying bills and creating new bills of total same value. Nodes maintain a current database of active bills, and will reject a transaction trying to use an old bill. That's the double-spend check. It requires look-up / delete / insert operations with the UTXO database.

Popular belief is that miners get paid for the job of verifying and assembling transactions into blocks, but that is wrong. That is a job any node is capable of doing and it doesn't cost them much. Your RPi node can assemble transactions into a "block template", but it just can't fill in the 1 blank that will satisfy the last consensus rule it needs to satisfy to be a valid block - the PoW difficulty check. That's why you can't simply kick out one block and replace it with another, because finding that nonce takes time. PoW's purpose is to increase the cost of undo.

Miners get paid for the job of filling in the nonce that will produce a satisfying block header hash, they get paid for the hashes because the only way to find a satisfying nonce is to make lots of guesses and hash the guesses. The network essentially bids for the hashes with block reward subsidy and users bid for the hashes with their transaction fees, and the more total reward the more secure the whole network becomes* since the cost of "undoing" a block will be bigger because difficulty will grow higher. (*assuming constant price)

Each transaction is a business transaction with a miner, they're the recipient of the implicit output (the fee), which is a payment from user for the service of maintaining the immutability property of the ledger! Of course miners would include their own business transactions into blocks they create!

During the early days of Bitcoin, nodes did all these jobs:

  1. Verified incoming transactions and blocks
  2. Made their own transactions and broadcast them to the network
  3. Assembled transactions into a block template (full block, with just the nonce missing)
  4. Filled in the nonce to make the block header pass the PoW check

Since then, the jobs have been separated.

Now it's mostly pools who do 1-3, and "miners" are just blindly doing the 4.: getting 80 bytes of block header from the pool and grinding the nonce. How do the miners verify what they're mining? Well, they have to get paid eventually, right?

Miners get paid their reward from the pool, so to independently verify they're getting paid correctly in proportion to their work, they also need to have some regular node, which can be off-site and doesn't need to be involved in mining! In that case they run a node to verify they themselves got paid for some past work in the right currency! This gives pools the power to direct hash-power of many as they like, but the pool can't really hide what they're doing, so everyone's on good behavior.

Note that "miners" are not exclusive to a single blockchain network. All Bitcoin miners are sha256d miners, but not all sha256d miners are Bitcoin miners! The era of one blockchain is long gone. Networks bid for the hashes, miners sell the hashes.

What happens if a subset of nodes changes the rules? All nodes under old rules will reject changed rules, and all nodes with changed rules will reject old rules. This happened in 2017 with the BCH fork. If both will be mined, then both will continue to exist independently. Which will get more hashes? It will depend on market price.

Miners pay for their energy usage and hardware in some external currency, they have to exchange it to pay the bills. If they can exchange the blockchain's native currency (BTC, BCH) for the cost currency (USD, CNY), and still have something left -- then they can make a profit. Their profit depends on there being liquidity for the native currency and the native currency having value! So they don't just arbitrarily decide which network to mine. They have strong incentive to get a ROI on their hardware, and optimal mining is to mine ALL networks which have a liquid market for the rewards, and in proportion to market value of their block rewards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.