Author

Topic: Mutually dependent transactions (Read 776 times)

legendary
Activity: 3472
Merit: 4801
February 21, 2013, 12: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).
newbie
Activity: 13
Merit: 0
February 21, 2013, 11:53:10 AM
#5
I was thinking it would be possible if both transactions were in the same block. 
legendary
Activity: 3472
Merit: 4801
February 21, 2013, 10:03:18 AM
#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.
full member
Activity: 148
Merit: 100
February 21, 2013, 04:36:43 AM
#3
https://en.bitcoin.it/wiki/BIP_0010 may be useful, not sure (Multi-Signature Transaction)
staff
Activity: 4284
Merit: 8808
February 21, 2013, 01: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.
newbie
Activity: 13
Merit: 0
February 21, 2013, 01: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
Jump to: