Bitcoin Forum
December 08, 2016, 12:35:17 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Double spending attack and defense - need an illustration and some pointers  (Read 709 times)
ihadanny
Newbie
*
Offline Offline

Activity: 9


View Profile
July 11, 2011, 09:44:46 PM
 #1

Hey,
Admittedly ultra-noob, but believe me that I've done my research before asking.

1. I understand the cool concept of double-spending prevention by all nodes agreeing on the block (and tx order), but only when it involves discrete, indivisible bitcoins. I fail to understand it when we're talking about fractions of bitcoins. Can you give me an illustration of a double spendning attack with fractions of bitcoins? what does it mean? do I have to spend exactly the same amount? or a fraction of a coin I already spent?

2. Where can I look for the code that scrutinize a newly arrived block? Is it part of the client I downloaded? I want to have a deeper look in it, and maybe that can shed a light on my 1st question.

Thanks, good luck with this amazing technical-economic experiment, Ido
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481157317
Hero Member
*
Offline Offline

Posts: 1481157317

View Profile Personal Message (Offline)

Ignore
1481157317
Reply with quote  #2

1481157317
Report to moderator
vector76
Member
**
Offline Offline

Activity: 70


View Profile
July 11, 2011, 10:10:56 PM
 #2

Each transaction has inputs and outputs.  The sum of the outputs must not be more than the sum of the inputs.

The outputs of a transaction can be used as the inputs to a subsequent transaction.  When an output of a transaction is used, it can never be used again.  The entire value of the output contributes to the subsequent transaction, so if you wish to transfer smaller amount, you must add an additional output on the second transaction to send the remainder back to yourself.

Example:
Tx1 input 1 comes from a previous tx with a value of 1
Tx1 input 2 comes from a previous tx with a value of 2
Tx1 output 1 has a value of 2.5 and requires key A to be claimed.
Tx1 output 2 has a value of 0.5 and requires key B to be claimed.

Person with key A creates a transaction and submits it to the miners:
Tx2 input 1 comes from Tx1/output 1.
Tx2 output 1 has a value of 2.0 and requires key C to be claimed
Tx2 output 2 has a value of 0.5 and requires key A to be claimed

Other nodes observe that Tx1/output 1 has not yet been spent and has a value of 2.5.  They verify that the outputs are not greater than 2.5.  They mark Tx1/output1 as used.

Person with key A creates another (double spend) transaction:
Tx3 input 1 comes from Tx1/output 1
Tx3 output 1 has a value of 1.0 and requires key D to be claimed
Tx3 output 2 has a value of 1.5 and requires key E to be claimed

Other nodes observe that Tx1/output 1 has already been spent, and they reject this transaction.


The value sits in the transaction outputs until another transaction refers to it as an input.  The value at an address (which represents a key) is the total value in all outputs that can be claimed by that key.
ihadanny
Newbie
*
Offline Offline

Activity: 9


View Profile
July 12, 2011, 08:04:32 AM
 #3

Thanks!
so for scrutinizing transactions in a new block, we must reverse trace each of them thru the series of output to input, until we reach a transaction that is acknowledged (sits in an acknowledged block), right?
Where can I see the code for this scrutinizing?
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!