Bitcoin Forum
May 25, 2024, 08:17:14 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Mutually dependent transactions  (Read 752 times)
pwrgeek (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
February 21, 2013, 06:34:23 AM
 #1

I'm wondering how the network would handle mutually dependent transactions (I'm considering a blockchain based stock exchange).  The question is how the network would handle transactions where the output of each is used as the input (or part of the input of the other.  My idea for the stock system will be in the econ area, but I would like some feedback on the following scenario and what to expect from the network.

Address 1 has 20BTC to start
Address 2 has .1BTC to start
at roughly the same time
Address 1 sends 20.1BTC to Address 2 and
Address 2 sends .2BTC to Address 1

Address 1 has .1BTC to end
Address 2 has 20BTC to end

but these two transactions are intertwined and one is only valid if the other is as well.

I'm wondering how the network would treat such transactions
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4186
Merit: 8424



View Profile WWW
February 21, 2013, 06:51:19 AM
 #2

I'm wondering how the network would handle mutually dependent transactions (I'm considering a blockchain based stock exchange).  The question is how the network would handle transactions where the output of each is used as the input (or part of the input of the other).
Such a transaction can't be written in Bitcoin, it something you can't even express. Perhaps you'll find it fun to figure out why for yourself? I won't ruin it for you.
celkaris
Full Member
***
Offline Offline

Activity: 148
Merit: 100


View Profile
February 21, 2013, 09:36:43 AM
 #3

https://en.bitcoin.it/wiki/BIP_0010 may be useful, not sure (Multi-Signature Transaction)
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
February 21, 2013, 03:03:18 PM
 #4

- snip -
Address 1 has 20BTC to start
Address 2 has .1BTC to start
at roughly the same time
Address 1 sends 20.1BTC to Address 2 and
Address 2 sends .2BTC to Address 1

Address 1 has .1BTC to end
Address 2 has 20BTC to end
- snip -

What you are proposing technically can't be done in the way you describe it.

Either the parties wold have to recognize that the end result is "Address 1 sends 19.9 BTC to Address 2" and agree on that transaction.

or

Both parties would have to turn control of their bitcoins over to a third party (escrow?) who would determine the net result of the intended transaction and then send the appropriate amounts back to each individual.

Think of it as a currency.

If I have $20.00 in my pocket, and you have $0.10 in your pocket. . .

There is no way for me to simultaneously hand you $20.10 while you hand me $0.20.  We are both missing the dime that is needed to accomplish that.
pwrgeek (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
February 21, 2013, 04:53:10 PM
 #5

I was thinking it would be possible if both transactions were in the same block. 
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
February 21, 2013, 05:45:19 PM
 #6

I was thinking it would be possible if both transactions were in the same block.  

No.  You'll have to get a better understanding about how bitcoin works.

Like I said, it operates more like a physical currency.

If I have a $20 bill in my pocket and you have a $0.10 dime in yours, there is no way for me to give you $20.10 while you give me $0.20 simultaneously even if we do it at the exact same moment.

Of course we could discuss our plans and agree that the net change is me with a dime and you with a $20 bill, then we could exchange what we each have instead of trying to give each other extra (this could be done in the blockchain).

We also could call over a third party, both give that party what we have, tell them what we plan to exchange, and then let them settle the difference for us (the transactions to and from the third party could be done in the blockchain).
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!