Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: mda on June 15, 2016, 06:12:52 AM



Title: Synchronous transactions
Post by: mda on June 15, 2016, 06:12:52 AM
Alice and Bob send each 1 BTC to 2-of-2 multisig address and both transactions happen simultaneously or don't happen at all.
Would it be hard to implement?


Title: Re: Synchronous transactions
Post by: mda on June 15, 2016, 06:50:53 AM
This question is wrong because without it the Lightning Network is impossible and BTC market cap is a solid zero.
The correct question is can it be done already?


Title: Re: Synchronous transactions
Post by: gmaxwell on June 17, 2016, 02:08:18 AM
Sure.

Doing that is easy, just make a joint transaction.

(see the coinjoin thread)


Title: Re: Synchronous transactions
Post by: mda on July 15, 2016, 06:02:09 AM
Thanks for the hint.
I think this code from pybitcointools/README.txt will do the job
Code:
    > h
    [{'output': u'97f7c7d8ac85e40c255f8a763b6cd9a68f3a94d2e93e8bfa08f977b92e55465e:0', 'value': 50000, 'address': u'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'}, {'output': u'4cc806bb04f730c445c60b3e0f4f44b54769a1c196ca37d8d4002135e4abd171:1', 'value': 50000, 'address': u'1CQLd3bhw4EzaURHbKCwM5YZbUQfA4ReY6'}]
    > outs = [{'value': 90000, 'address': '16iw1MQ1sy1DtRPYw3ao1bCamoyBJtRB4t'}]
    > tx = mktx(h,outs)
    > tx2 = sign(tx,0,priv)
    > tx3 = sign(tx2,1,priv)
    > pushtx(tx3)