<p>There are multiple definitions of the term "double spending" at play here. First, there is the actual definition of double spending: to spend the same money multiple times. A simple example of this is the coin on a string in a vending machine. You put tie a string to a coin, when you put the coin in the machine, it thinks you paid, you get whatever you want from the machine, then you use the string to pull the coin back out so that it can be spent again somewhere else.</p>

<p>By this definition, the exchange of goods has occurred, but the money used to pay for it is used by the payer to pay for another good later. In effect, you created multiple transactions that conflicted with each other and they are all considered to be settled (i.e. final and irreversible) in the accounting system of that money.</p>

<p>Then there is the definition of "double spending" in the context of Bitcoin transactions. Double spending is often used to say that there are multiple unconfirmed transactions which conflict with each other. But unconfirmed transactions are not considered to be settled, so you have conflicting unsettled transactions under this definition.</p>

<p>The goal of the blockchain is to resolve these conflicting unsettled transactions. It's purpose is to ensure that all transactions do not conflict with each other and to make them considered settled. So to not have double spends, you need two properties for transactions: irreversible, and non-conflicting.</p>

<p>The non-conflicting part is handled by nodes. Nodes validate blocks and transactions. They reject blocks if they contain transactions that conflict with other transactions in that block or in the blockchain. So the thing that prevents the conflict aspect of double spends are nodes.</p>

<p>The Proof of Work is what allows for the irreversible aspect. It requires that miners expend time and energy in order to create a block. In order to change the contents of a block, one must expend time and energy to create a new block which conflicts with one that already exists.</p>

<p>The Proof of Work is also used to resolve blockchain conflicts. If there are multiple candidate blockchains that stem from a common forking point, nodes follow the one that has the most cumulative work because that chain is the one where the most energy was expended to create.</p>

<p>The chain part of the blockchain creates a compounding factor so that in order to replace a block in the blockchain, you must also replace the blocks that are on top of it thus expending far more time and energy. Because there are other people mining on the original blockchain, you must also be able to mine faster than them in order for your blockchain to have more work than the original for yours to be accepted by everyone else.</p>

<p>Because replacing blocks requires significant time and energy expenditure, one can reasonably assume that a block and the transactions it contains will never change once multiple blocks have been mined on top of it. This gives us the irreversible aspect. This is why it is said that confirmed transactions are irreversible.</p>

<blockquote>
  <p>why can't we replace PoW with an automatic 10 minute block-addition based on a simple timestamp?</p>
</blockquote>

<p>Because that is not decentralized. Who creates the blocks? If multiple people can create blocks like with mining, by what mechanism are ties broken? How do you resolve two different people creating different blocks? What stops someone from spoofing timestamps and replacing the blockchain with their own version?</p>

<p>The easiest way to resolve these is to make blocks only produced by a limited and trusted group of people. So it is now centralized. Congrats, you created Paypal, but less efficient.</p>

<p>The whole purpose of the Proof of Work is to allow for a decentralized system where everyone can agree on the truth without some central authority dictating what that truth is. If everyone follows the same rules, then everyone will eventually conclude on what the truth is. The use of energy expenditure in the Proof of Work prevents someone from rewriting history with different blocks because it is expensive to do so. The tie breaking of using the chain with the most work allows nodes to converge on the same blockchain. Use of the Proof of Work answers the questions I gave above without relying on a central authority.</p>

<p>In conclusion, the Proof of Work allows transactions to become settled and irreversible. It allows nodes to converge onto the same blockchain and makes it extremely expensive, to the point of impossible expensive, to rewrite history thus making transactions in the blockchain irreverisble. The actual ensuring that no conflicting transactions exist in the blockchain and thus actually preventing true double spends is left to the nodes that validate the blockchain.</p>

CC BY-SA 4.0
2019-08-04T03:46:19.803Z
thanks for giving such a comprehensive answer!
d3wannabe
CC BY-SA 4.0
2022-08-15T10:09:33.553Z
@Andrew Chow thank you for the great explanation.  I still have some doubt about the usefulness of the PoW. What if there is an obvious and unquestionable truth for each conflict of blocks, and therefore we don't need consensus anymore. In this situation, do we still need the PoW?
swampcypress
CC BY-SA 4.0
2022-08-15T10:14:59.300Z
by obvious and unquestionable truth I mean when there's a conflict of blocks, each node can undoubtedly conclude on the same truth about which one is the correct, just like we can always conclude that two bigger than one is true.
swampcypress
CC BY-SA 4.0
2022-08-15T14:46:25.600Z
@swampcypress Sure, if there were a decentralized way of doing that, then we would not need PoW.
Ava Chow
CC BY-SA 4.0
2019-08-04T03:12:24.307Z
2019-08-04T03:12:24.307Z
Ava Chow
<p>I know similar questions have been asked before (e.g. <a href="https://bitcoin.stackexchange.com/questions/61385/how-proof-of-work-prevents-double-spend">How proof of work prevents double spend</a>) but I'm struggling to visualise the solution to double-spending being directly reliant on proof of work.</p>

<p>Imagine a miner, Bob, trying to double-spend 1 BTC by sending to both Alice and Jim.  Either he can include both transactions to Alice and Jim in a single bad block that he mines - in which case the block will be rejected even with a valid PoW.  Or he can broadcast his first (valid) transaction to Alice and let someone else mine it and then mine his own bad block later with the transaction to Jim which again will be rejected regardless of having valid Proof-of-work.  So double-spending is really protected against on the level of transaction-validation which every full node on the network performs?  Meaning PoW doesn’t really directly stop double-spending - what stops double-spending is simply the nodes being aware of previously confirmed transactions.  And the reason we can trust all transactions on the blockchain are "confirmed" is PoW?</p>

<p>If that's right, and PoW is more of a high-level system-wide solution, here's a final question I'm hoping someone can clarify: why can't we replace PoW with an automatic 10 minute block-addition based on a simple timestamp?  Is it because it's such a mission-critical task (involving the trust of the whole system), that unlike Difficulty calculation (where we rely on timestamps), we must find an alternative where no time value can be spoofed? (even though if it was, individual nodes would presumably be able to reject it fake times).  Is it wrong to think of Proof-of-work as basically a replacement for trusting a (hackable/spoofable) timestamp server that could regulate 'blocks every 10 minutes'.</p>

<blockchain><proof-of-work><doublespend>
Does proof-of-work contribute directly to prevent double-spending?
d3wannabe
# Does proof-of-work contribute directly to prevent double-spending?

(Asked by: username_0 on 2019-08-04)

I know similar questions have been asked before (e.g. [How proof of work prevents double spend](https://bitcoin.stackexchange.com/questions/61385/how-proof-of-work-prevents-double-spend)) but I'm struggling to visualise the solution to double-spending being directly reliant on proof of work.

Imagine a miner, Bob, trying to double-spend 1 BTC by sending to both Alice and Jim. Either he can include both transactions to Alice and Jim in a single bad block that he mines - in which case the block will be rejected even with a valid PoW. Or he can broadcast his first (valid) transaction to Alice and let someone else mine it and then mine his own bad block later with the transaction to Jim which again will be rejected regardless of having valid Proof-of-work. So double-spending is really protected against on the level of transaction-validation which every full node on the network performs? Meaning PoW doesn’t really directly stop double-spending - what stops double-spending is simply the nodes being aware of previously confirmed transactions. And the reason we can trust all transactions on the blockchain are "confirmed" is PoW?

If that's right, and PoW is more of a high-level system-wide solution, here's a final question I'm hoping someone can clarify: why can't we replace PoW with an automatic 10 minute block-addition based on a simple timestamp? Is it because it's such a mission-critical task (involving the trust of the whole system), that unlike Difficulty calculation (where we rely on timestamps), we must find an alternative where no time value can be spoofed? (even though if it was, individual nodes would presumably be able to reject it fake times). Is it wrong to think of Proof-of-work as basically a replacement for trusting a (hackable/spoofable) timestamp server that could regulate 'blocks every 10 minutes'.

**Tags:** blockchain, proof-of-work, doublespend


---

## 1 answers

### Answer by username_1 on 2019-08-04. Score: 11 | Accepted answer

There are multiple definitions of the term "double spending" at play here. First, there is the actual definition of double spending: to spend the same money multiple times. A simple example of this is the coin on a string in a vending machine. You put tie a string to a coin, when you put the coin in the machine, it thinks you paid, you get whatever you want from the machine, then you use the string to pull the coin back out so that it can be spent again somewhere else.

By this definition, the exchange of goods has occurred, but the money used to pay for it is used by the payer to pay for another good later. In effect, you created multiple transactions that conflicted with each other and they are all considered to be settled (i.e. final and irreversible) in the accounting system of that money.

Then there is the definition of "double spending" in the context of Bitcoin transactions. Double spending is often used to say that there are multiple unconfirmed transactions which conflict with each other. But unconfirmed transactions are not considered to be settled, so you have conflicting unsettled transactions under this definition.

The goal of the blockchain is to resolve these conflicting unsettled transactions. It's purpose is to ensure that all transactions do not conflict with each other and to make them considered settled. So to not have double spends, you need two properties for transactions: irreversible, and non-conflicting.

The non-conflicting part is handled by nodes. Nodes validate blocks and transactions. They reject blocks if they contain transactions that conflict with other transactions in that block or in the blockchain. So the thing that prevents the conflict aspect of double spends are nodes.

The Proof of Work is what allows for the irreversible aspect. It requires that miners expend time and energy in order to create a block. In order to change the contents of a block, one must expend time and energy to create a new block which conflicts with one that already exists.

The Proof of Work is also used to resolve blockchain conflicts. If there are multiple candidate blockchains that stem from a common forking point, nodes follow the one that has the most cumulative work because that chain is the one where the most energy was expended to create.

The chain part of the blockchain creates a compounding factor so that in order to replace a block in the blockchain, you must also replace the blocks that are on top of it thus expending far more time and energy. Because there are other people mining on the original blockchain, you must also be able to mine faster than them in order for your blockchain to have more work than the original for yours to be accepted by everyone else.

Because replacing blocks requires significant time and energy expenditure, one can reasonably assume that a block and the transactions it contains will never change once multiple blocks have been mined on top of it. This gives us the irreversible aspect. This is why it is said that confirmed transactions are irreversible.

> why can't we replace PoW with an automatic 10 minute block-addition based on a simple timestamp?

Because that is not decentralized. Who creates the blocks? If multiple people can create blocks like with mining, by what mechanism are ties broken? How do you resolve two different people creating different blocks? What stops someone from spoofing timestamps and replacing the blockchain with their own version?

The easiest way to resolve these is to make blocks only produced by a limited and trusted group of people. So it is now centralized. Congrats, you created Paypal, but less efficient.

The whole purpose of the Proof of Work is to allow for a decentralized system where everyone can agree on the truth without some central authority dictating what that truth is. If everyone follows the same rules, then everyone will eventually conclude on what the truth is. The use of energy expenditure in the Proof of Work prevents someone from rewriting history with different blocks because it is expensive to do so. The tie breaking of using the chain with the most work allows nodes to converge on the same blockchain. Use of the Proof of Work answers the questions I gave above without relying on a central authority.

In conclusion, the Proof of Work allows transactions to become settled and irreversible. It allows nodes to converge onto the same blockchain and makes it extremely expensive, to the point of impossible expensive, to rewrite history thus making transactions in the blockchain irreverisble. The actual ensuring that no conflicting transactions exist in the blockchain and thus actually preventing true double spends is left to the nodes that validate the blockchain.

> **Comments:**
> **username_0**: thanks for giving such a comprehensive answer!  
> **username_2**: @Andrew username_1 thank you for the great explanation.  I still have some doubt about the usefulness of the PoW. What if there is an obvious and unquestionable truth for each conflict of blocks, and therefore we don't need consensus anymore. In this situation, do we still need the PoW?  
> **username_2**: by obvious and unquestionable truth I mean when there's a conflict of blocks, each node can undoubtedly conclude on the same truth about which one is the correct, just like we can always conclude that two bigger than one is true.  
> **username_1**: @username_2 Sure, if there were a decentralized way of doing that, then we would not need PoW.  

---

