Automatic atomic exchanges across nodes

+2 votes
I need the ability to exchange assets between two addresses that are in wallets on different nodes in an automatic way, how can this be done?    

i.e:  I can issue preparelockunspent, and createrawexchange which outputs some hexdata on one node,  but then that data needs to be available to the appropriate nodes, and there is no way of knowing the node that an address belongs to.  Additionally,  nodes may not have the public keys of addresses on other nodes to do any form of encryption.

Question 1:  When I create an exchange can I specify the partner address(es)?  so that ONLY the addresses specified can sign and complete the transactions without creating a multisig address?
Question 2: Is it secure to store this hexdata on a stream?  perhaps using a key of the destination address
Question 3: if the hexdata is on a stream securely,  and each node can find pending exchanges for addresses in their wallet...  then how would I go about marking that exchange as 'invalid' after completing the exchange so that it does not need to be read from the stream again?
asked May 17, 2018 by Robert

1 Answer

0 votes
1. You cannot do this with the current version of MultiChain. However this will be easy to implement with filters, which are coming soon in MultiChain 2.0. The party making the offer would embed the address permitted inside the offer, and a filter configured on the chain would prevent the offer being completed by anyone else.

2. Yes, you could safely put this on a stream, since no one else would be able to accept it.

3. There are any number of ways of doing this, but one simple one is to add another item to the stream under the same key, and in it reference the previous item (perhaps by txid) saying that it is no longer valid. The reader can confirm that this message was published from the correct address.
answered May 17, 2018 by MultiChain