Atomic transactions

+1 vote
I'm trying to set up atomic transactions but it seems the server address always ends up with the assets of both sides. This is the flow I'm executing:

UserAAA wants to exchange 10 EUR for 10 DOL with UserBBB

Do a preparelockunspentfrom 10 EUR of UserAAA => gives us txid1 and vout1
Do a preparelockunspentfrom 10 DOL of UserBBB => gives us txid2 and vout2

createrawexchange with txid1 en vout1 for 10 DOL => gives us hex1
appendrawexchange of hex1 with txid2 en vout2 for 10 EUR => gives hex2 and complete

If complete is true then do a sendrawtransaction of hex2

If I have a look at the overview of all asset balances I now see UserAAA lost 10 EUR and UserBBB lost 10 DOL, and only the server gained 10 EUR and 10 DOL.
asked Oct 22, 2015 by kamme

1 Answer

0 votes

When you say the server gained 10 EUR and 10 DOL, what do you mean by "the server"? There are only addresses belonging to different nodes. So maybe the problem is that the destination address for createrawexchange and appendrawexchange cannot be specified, so it just goes to any address on the node. If so this is something we need to improve - I will check and get back to you.

answered Oct 22, 2015 by MultiChain
By the server I do mean the address of the node I'm issuing the commands, yes. I was kind of assuming the createrawexchange knows the address to send the assets to because of the txid, but yes, I think that might be the issue.
OK, we should have fixed this in alpha 9 just released, so that createrawexchange and appendrawexchange set the same address in the output they create as the input which they are using. Please let us know if it helps.
I just tested it and alpha 9 fixed it. When I follow the flow I explained in the issue both parties now receive the funds. Thank you for your help and the (very) quick fix!
Great, thanks for letting us know!
...