<ol>
<li><p>The <strong>Unspent</strong> Transaction Output (UTXO) set only includes valid transaction outputs that <em>have not been spent yet</em>.  Once a TXO is used, it is removed from the UTXO set. So, to check if an output exists and is spendable, you see whether it is <strong>in</strong> the UTXO set.<br>
This actually makes discovering a double-spend attempt of "aged transactions" much easier than finding double-spend attempts in unconfirmed transactions.</p></li>
<li><p>A majority attack is not only theoretical, unless you deem someone acquiring 51% of the hashing power a theoretical possibility. But it's really expensive and would probably disintegrate Bitcoin value, so one could argue that it is unlikely to happen.</p></li>
<li><p>It puts the risk of reversal below 0.1% with an attacker that has 10% of the hashing power. <a href="https://bitcoin.stackexchange.com/q/1170/5406">Why is 6 the number of confirms that is considered secure?</a></p></li>
</ol>

CC BY-SA 3.0
2016-09-02T11:54:27.473Z
thanks. Just a follow-up Q. In fork/longer length scenarios how far back can back-tracking be done, to discard shorter blocks? Is there a limit (imposed or settled to) ?
RajCherla
CC BY-SA 3.0
2016-09-02T12:03:45.290Z
I don't think that there is a formal limit, but according to [What is the longest blockchain fork that has been orphaned to date?](http://bitcoin.stackexchange.com/q/3343/5406), the longest natural reorganization was 4 blocks long (although the answer might be outdated now). There was a reorganization of 31 depth due to a bug that split the network once.
Murch
CC BY-SA 3.0
2016-09-02T14:51:53.553Z
51-attack is not extraordinary expensive. And it *will* happen when the profit (in fiat currency) will be more than expenses. Nobody would care about desintegrating crypto performing it :)
amaclin
CC BY-SA 3.0
2016-09-02T15:00:41.920Z
amaclin: I disagree because it's against the interest of the major mining pools, so you'd have to compete with their hashpower.
Murch
CC BY-SA 3.0
2016-09-02T17:12:21.263Z
A thought : Can the block chain be compacted by purging contiguous  blocks from  height 1 to N, having no  transactions with unspent outputs. Replace N blocks with a single header Block. Maybe only miner nodes have complete block chain for and others get it if they want it. Saves space. Assumes there are no unused coins buried in the earlier blocks.
RajCherla
CC BY-SA 3.0
2016-09-02T17:57:06.217Z
@RajCherla: What you're describing is called ["Pruning mode"](http://bitcoin.stackexchange.com/a/38847/5406)
Murch
CC BY-SA 3.0
2016-09-03T04:06:14.867Z
Re-read Satoshi paper and it does cover pruning and role of Merkle Tree in it.
RajCherla
CC BY-SA 3.0
2016-09-02T09:15:02.523Z
2016-09-02T09:52:25.313Z
2017-04-13T12:47:33.610Z
Murch
<p>This is just to verify my understanding of Bitcoin double spend detection. </p>

<p>1) Use of UTXO indexes : This ensures that there as been no spend from that output (transferred to recipient in Block of height N)  in any of the subsequent transactions, up till last confirmed Block in chain (from N till current height). So the binary search if UTXO indexes is necessarily done for all transactions, right?</p>

<p>2) A con could theoretically double spend by garnering enough (51%) computing power to generate longer blocks that don't include his first (legit) spend', and pay himself or partner with from same output (since smaller length with legit transaction would be rejected). But this is only a theoretical possibility. right?</p>

<p>2) A wait of 6 confirmed blocks is recommended for high value transactions, as it is less likely for your confirmed transaction to get dropped from chain after that, even if con has upto 10% computing power. right ? </p>

CC BY-SA 3.0
2016-09-06T11:42:20.690Z
Possible duplicate of [How do I detect a double-spend?](http://bitcoin.stackexchange.com/questions/13370/how-do-i-detect-a-double-spend)
rny
<doublespend>
Detection of double spend in Bitcoin for aged transactions
RajCherla
# Detection of double spend in Bitcoin for aged transactions

(Asked by: username_0 on 2016-09-02)

This is just to verify my understanding of Bitcoin double spend detection.

1) Use of UTXO indexes : This ensures that there as been no spend from that output (transferred to recipient in Block of height N) in any of the subsequent transactions, up till last confirmed Block in chain (from N till current height). So the binary search if UTXO indexes is necessarily done for all transactions, right?

2) A con could theoretically double spend by garnering enough (51%) computing power to generate longer blocks that don't include his first (legit) spend', and pay himself or partner with from same output (since smaller length with legit transaction would be rejected). But this is only a theoretical possibility. right?

2) A wait of 6 confirmed blocks is recommended for high value transactions, as it is less likely for your confirmed transaction to get dropped from chain after that, even if con has upto 10% computing power. right ?

**Tags:** doublespend

> **Comments:**
> **username_1**: Possible duplicate of [How do I detect a double-spend?](http://bitcoin.stackexchange.com/questions/13370/how-do-i-detect-a-double-spend)  

---

## 1 answers

### Answer by username_2 on 2016-09-02. Score: 1

1. The **Unspent** Transaction Output (UTXO) set only includes valid transaction outputs that *have not been spent yet*. Once a TXO is used, it is removed from the UTXO set. So, to check if an output exists and is spendable, you see whether it is **in** the UTXO set.  
   This actually makes discovering a double-spend attempt of "aged transactions" much easier than finding double-spend attempts in unconfirmed transactions.
2. A majority attack is not only theoretical, unless you deem someone acquiring 51% of the hashing power a theoretical possibility. But it's really expensive and would probably disintegrate Bitcoin value, so one could argue that it is unlikely to happen.
3. It puts the risk of reversal below 0.1% with an attacker that has 10% of the hashing power. [Why is 6 the number of confirms that is considered secure?](https://bitcoin.stackexchange.com/q/1170/5406)

> **Comments:**
> **username_0**: thanks. Just a follow-up Q. In fork/longer length scenarios how far back can back-tracking be done, to discard shorter blocks? Is there a limit (imposed or settled to) ?  
> **username_2**: I don't think that there is a formal limit, but according to [What is the longest blockchain fork that has been orphaned to date?](http://bitcoin.stackexchange.com/q/3343/5406), the longest natural reorganization was 4 blocks long (although the answer might be outdated now). There was a reorganization of 31 depth due to a bug that split the network once.  
> **username_3**: 51-attack is not extraordinary expensive. And it *will* happen when the profit (in fiat currency) will be more than expenses. Nobody would care about desintegrating crypto performing it :)  
> **username_2**: username_3: I disagree because it's against the interest of the major mining pools, so you'd have to compete with their hashpower.  
> **username_0**: A thought : Can the block chain be compacted by purging contiguous  blocks from  height 1 to N, having no  transactions with unspent outputs. Replace N blocks with a single header Block. Maybe only miner nodes have complete block chain for and others get it if they want it. Saves space. Assumes there are no unused coins buried in the earlier blocks.  
> **username_2**: @username_0: What you're describing is called ["Pruning mode"](http://bitcoin.stackexchange.com/a/38847/5406)  
> **username_0**: Re-read Satoshi paper and it does cover pruning and role of Merkle Tree in it.  

---

