Author

Topic: Whey are miners a critical part of the Bitcoin network (Read 519 times)

newbie
Activity: 3
Merit: 0

The miner completes the proof-of-work.

The network is decentralized. There is no single server that is "in charge" to resolve conflicts.

The proof-of-work is how the network resolves conflicts and reaches a consensus on the order of transactions.

Imagine that there are no miners and a user creates a transaction.  Imagine that the user creates his own block and adds the transaction to that block.  Now imagine that the user creates a second transaction that spends the exact same bitcoins. Imagine that the user creates a second block at the same height as his other block but with this other transaction instead. Now imagine that the user sends one of those blocks to half of the nodes on the network, and the other block to the other half of the nodes.  How would the network decide which is the "real" transaction and which is invalid?

Mining solves this problem.

It takes time and effort to "solve a block". The work is done in such a way that the distribution of solved blocks is approximately equal to the miners percentage of the global work being done.  So if a miner has 10% of the global hash power, then he will (on average) solve only 10% of the blocks.

Let's imagine that the same person above is a miner in the system the way it exists today.  Let's immagine that he controls 10% of the global hash power. He completes the proof-of-work on the first block.  During the time that is takes for him to complete the second block, the rest of the netowrk is (on average) going to solve 9 more blocks.  This leaves him with a choice to make.

1) He can broadcast his first solved block immediately, as soon as he solves it. If he does this, he gets to keep the block reward and fees of all transactions that he includes in the block. However, by doing so, the entire network will hear about his first block LONG before he ever solves the second block.  This means that the entire network will already have accepted that the first transaction is the "real" transaction.  The second block will be considered invalid and will be rejected by everyone.

2) He can withhold the first block until he solves the second block.  If he does this, 9 other blocks will already have been added to the chain since he created his two blocks.  The "valid" chain will extend 8 blocks higher than the the height of his two blocks.  Since the network follows the longest chain, his two blocks will BOTH be rejected by everyone.  He'll lose out on the block reward and fees, and he still failed to confuse the network with two incompatible transactions.

In either case, the entire network agrees on the history of the blockchain. They've reached consensus. Unless someone controls more hash power than the entire rest of the world combined, they can't divert the nodes and confuse the system about which transactions and blocks are "valid".



That makes sense.  Thank you for such a clear answer.  I have a lot of work to do in order to understand all this, but it's a lot of fun.
legendary
Activity: 3472
Merit: 4801
I appreciate the education.  Even after reading, its hard to put it all together.  

So then, the miners are creating blocks through the mining process, right?  I didn't realize there was a purposeful restriction on how long it takes to create a block.  You mentioned that the difficulty to create a block will adjust so that we get 1 block about every 10 minutes.  Do you know what the reason for that is?  Why can't a node just create a block from a single signed transaction and place it on the block-chain, without mining.  Is it a size thing?

The miner completes the proof-of-work.

The network is decentralized. There is no single server that is "in charge" to resolve conflicts.

The proof-of-work is how the network resolves conflicts and reaches a consensus on the order of transactions.

Imagine that there are no miners and a user creates a transaction.  Imagine that the user creates his own block and adds the transaction to that block.  Now imagine that the user creates a second transaction that spends the exact same bitcoins. Imagine that the user creates a second block at the same height as his other block but with this other transaction instead. Now imagine that the user sends one of those blocks to half of the nodes on the network, and the other block to the other half of the nodes.  How would the network decide which is the "real" transaction and which is invalid?

Mining solves this problem.

It takes time and effort to "solve a block". The work is done in such a way that the distribution of solved blocks is approximately equal to the miners percentage of the global work being done.  So if a miner has 10% of the global hash power, then he will (on average) solve only 10% of the blocks.

Let's imagine that the same person above is a miner in the system the way it exists today.  Let's immagine that he controls 10% of the global hash power. He completes the proof-of-work on the first block.  During the time that is takes for him to complete the second block, the rest of the netowrk is (on average) going to solve 9 more blocks.  This leaves him with a choice to make.

1) He can broadcast his first solved block immediately, as soon as he solves it. If he does this, he gets to keep the block reward and fees of all transactions that he includes in the block. However, by doing so, the entire network will hear about his first block LONG before he ever solves the second block.  This means that the entire network will already have accepted that the first transaction is the "real" transaction.  The second block will be considered invalid and will be rejected by everyone.

2) He can withhold the first block until he solves the second block.  If he does this, 9 other blocks will already have been added to the chain since he created his two blocks.  The "valid" chain will extend 8 blocks higher than the the height of his two blocks.  Since the network follows the longest chain, his two blocks will BOTH be rejected by everyone.  He'll lose out on the block reward and fees, and he still failed to confuse the network with two incompatible transactions.

In either case, the entire network agrees on the history of the blockchain. They've reached consensus. Unless someone controls more hash power than the entire rest of the world combined, they can't divert the nodes and confuse the system about which transactions and blocks are "valid".
newbie
Activity: 3
Merit: 0
I appreciate the education.  Even after reading, its hard to put it all together. 

So then, the miners are creating blocks through the mining process, right?  I didn't realize there was a purposeful restriction on how long it takes to create a block.  You mentioned that the difficulty to create a block will adjust so that we get 1 block about every 10 minutes.  Do you know what the reason for that is?  Why can't a node just create a block from a single signed transaction and place it on the block-chain, without mining.  Is it a size thing?
staff
Activity: 3458
Merit: 6793
Just writing some code
Mining used to be such that everyone who ran a node could mine. However the difficulty has significantly increased since those times and made it extremely uneconomical for people with just nodes to mine. They would be using their CPUs or GPUs to mine, and with the current difficulty, the probability that someone CPU or GPU mining will find a block is extremely low. As such, the return on that is very low and does not offset the cost of electricity, so people no longer CPU and GPU mine. You can still do so if you want to, you just won't find any blocks or make any money if you are mining with a pool.

The number of miners or the decentralization of mining has nothing to do with how quickly transactions are "processed" (I assume you mean confirmed when you say "processed"). The protocol adjusts the difficulty (aka amount of work required to mine a block) so that blocks are produced every ten minutes, on average. This is the same regardless of whether everyone with a node is CPU mining and difficulty is low or whether all miners use ASICs in large data centers.
newbie
Activity: 3
Merit: 0
I'm looking for a theoretical explanation here.  Can someone explain why a full node installation of Bitcoin can't do the work of processing transactions and adding blocks to the block-chain?  Why is mining a specialized function?  It seems like with so many user nodes, relying on specialized miners to process transactions is a bottleneck.
Jump to: