Is it possible to broadcast two separate rawexchanges atomically?

+2 votes


I have two separate rawexchanges that are both ready to be transmitted to the network by one participant to complete two atomic swaps.

They can individually be broadcast using sendrawtransaction hexstring 

Is it possible to send both in a single transaction or for them to be grouped somehow so that both swaps either succeed or fail as a whole?

asked May 25, 2016 by John

1 Answer

0 votes
Best answer

The way to do this would be to construct the entire 4-way exchange in a single transaction - that way they will be treated atomically by the blockchain. You can do this by calling appendrawexchange repeatedly after createrawexchange, to add each branch of the exchange on. Would this work for you?

answered May 25, 2016 by MultiChain
selected May 25, 2016 by John
Thanks, I have been able to build up the exchange the way you've suggested but I'm not sure it's what I need for the model I'm investigating.

There is an issuer of an asset.
Other participants on the network are aware of the new asset creation and start to make exchange offers to the issuer.
The issuer can pick and choose the offers he likes, and he also wants to swap the entire quantity of the asset or not at all.

Instead of completing the other side of the exchanges available to him the Issuer would need to create a new exchange made up of everything he wants out of the original offers and send that to all the involved parties (possibly using a stream).
I think this approach introduces a bit of overhead with something required to coordinate all the parties involved and decide what order they append to the exchange to correctly add on each branch.

I realise that the first approach I proposed may not be possible but the main benefit I saw was that each party would only be interacting with just the Issuer
Ah, understood. In that case it is a little more complicated. After createrawexchange, the issuer could publish the offer, then anyone who wants to take part of it can call appendrawexchange for their part and publish the amended offer, then others can add to that, etc..., until someone has completed the exchange.
Ok, that makes sense. Thanks for the quick response