The thing to remember here is that a Bitcoin is valid if people think it is valid (i.e. is willing to accept it as payment). When you mine a block, you get coins, no matter where the block is in the blockchain (even if you fork it into a block-tree). However, these coins you just minted are only valuable to people who think they are valuable. Bitcoin has a general rule that one should consider the longest blockchain (or, more precisely, the highest difficulty blockchain) to be the best.
If you tried to fork the blockchain by mining your own block out of the middle of the chain, rather than the end, you would mine coins, but find it hard to actually spend them. Few people (if any) would be willing to accept your coins as payment because there is a much longer blockchain out there (the main block chain), so it is highly unlikely that your coins will be recognized as useful tender.
Added to this, the proof of work for bitcoin does not benefit in any way from partial work. If you are 99.9999999999% of the way to mining a block and someone announces a block before you get there, it is still in your best interest to start mining off of their block immediately, because there's 0 advantage to continuing to mine your old block, and plenty of disadvantages. In fact, you don't even know how close you are to mining a block, due to the randomness of the process.
(At least, this is true assuming all blocks are worth the same. If, for some reason, one individual transaction had some massive transaction fee on it (say, 1000BTC), and someone else just nabbed it, it might be worth trying to finish mining the block yourself and fight them for that block. You would, however, be fighting an uphill battle since they announced it first. But those are edge cases)
Thanks but I'm not asking about the incentive to mine I'm asking about why the incentive for other non-mining nodes to accept a newly mined block on teh current longest chain. I mean could they theoretically all be a-holes and say, "Hey we don't like you so we're going to reject your block and let someone else mine hte current longest chain." – Dave – 2017-12-31T23:04:48.413
2There is no direct incentive. Nodes could arbitrarily reject blocks, but it's not possible to know their point of origin with any certainty. A node couldn't reliable keep rejecting a single miners blocks. – Matthew Charles Stannard – 2017-12-31T23:10:26.930
There is a lot of risk to rejecting the longest chain. If you decide to reject the most recent block and try to mine your own version of it, there is no guarantee that the network will choose your block over the first one. It is more likely that the first one will be chosen because nodes will only accept the first block they see at a given block height. So there's risk there that you are just wasting energy on a block that won't be accepted and thus you don't get paid. – Andrew Chow – 2018-01-01T18:55:16.063
@AndrewChow, when you say, "nodes will only accept the first block they see at a given block height" ... why? Is this part of the Bitcoin software? What guarantees that this is the case? – Dave – 2018-01-02T02:47:21.117
1@Dave Bitcoin primarily works on a first come first serve basis. Of course there are exceptions to that, but generally the first thing that a node receives is what it accepts as true. In the case of blocks, this is overridden by the most work chain rule, but until that happens, it sticks with the first block it sees. There is no guarantee that that becomes part of the most work chain, and if it does not, then it will switch to the competing block at that height that is part of the most work chain. It is part of the software and has been since Bitcoin's creation. – Andrew Chow – 2018-01-02T03:04:39.070
Ok, thanks for that clarification, that makes sense. – Dave – 2018-01-02T21:03:49.613
1I'm curious if there's any game theoretic explanation for this. E.g. would we reach a nash equilibrium if everybody accepts proper blocks mined by other miners. – Bitswazsky – 2018-01-09T07:58:27.573
Interestingly enough, since answering the question I was introduced to this paper which shows that my answer only applies when there is a constant block reward. When the income of miners is dependent on transaction fees with a potentially high variance, then the incentives to behave honestly breakdown and miners are likely to engage in Undercutting strategies.
– Matthew Charles Stannard – 2018-01-09T17:49:28.160Funny how Andrew Chow’s first comment is the closest thing to actually addressing the question. – Ash – 2018-08-13T22:21:21.217