Bitcoin Forum
December 03, 2016, 12:41:16 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Transaction verification, computationally expensive?  (Read 510 times)
int
Newbie
*
Offline Offline

Activity: 5


View Profile
July 11, 2011, 10:45:17 PM
 #1

I have a question about transaction verification.

Let's say TX1 transfers some bitcoins from person A to B, and then say 5 years later I create a transaction TX2 (from A to C) that references the same output as TX1 did, for the same amount. This would be double spending, but to prevent it, wouldn't you need to go through all the blocks (and all the transactions) in history, in order to find TX1 and thus disqualify TX2?

Suppose A had 10 coins to begin with. TX1 transferred 8 coins A->B. TX2 wants to transfer 2 coins to A->C. In this case TX2 would be valid. To validate TX2 you would have to search through all the transactions in all the blocks after TX1 was posted, and check that there wasn't a TX3 that depleted A's balance to below 2 coins.

If TX1 and TX2 are years apart, then the number of transactions to check can be extremely large. It would grow as O(n), where n is the number of transactions historically. Wouldn't this cause a problem?
1480725676
Hero Member
*
Offline Offline

Posts: 1480725676

View Profile Personal Message (Offline)

Ignore
1480725676
Reply with quote  #2

1480725676
Report to moderator
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480725676
Hero Member
*
Offline Offline

Posts: 1480725676

View Profile Personal Message (Offline)

Ignore
1480725676
Reply with quote  #2

1480725676
Report to moderator
Maged
Legendary
*
Offline Offline

Activity: 1260


View Profile
July 11, 2011, 10:50:03 PM
 #2

Whenever an output is spent, it is entirely spent. The remaining amount is returned to you at a new address in that transaction. Once a spent transaction is buried under enough blocks, it can be safely deleted, should your client choose to delete it.

int
Newbie
*
Offline Offline

Activity: 5


View Profile
July 11, 2011, 11:21:12 PM
 #3

Whenever an output is spent, it is entirely spent. The remaining amount is returned to you at a new address in that transaction. Once a spent transaction is buried under enough blocks, it can be safely deleted, should your client choose to delete it.

A has 10 coins sitting at a certain output O1. To transfer 8 coins to B from that output, you create a transaction TX1 that references it (and thus entirely spends it) as input, and lists two new outputs : 8 coins to B and 2 coins back to A.

Then A decides to double spend, and creates TX2 where he references O1 again as input. To verify TX2 you still need to know if O1 was spent or not. How would you know that without going through all the historical blocks/transactions to find TX1, the transaction that spends it?
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!