Transaction pending on action (Trigger)

+1 vote
I want to transfer asset from X to Y, but I want to let Y get the chance to accept this asset meanwhile Y has no hand in transaction building as initiative and signing will be by X. So how can let Y accept or reject (trigger transaction )or taking an action on transaction using multichain ?
asked Oct 24, 2018 by mina

1 Answer

0 votes
What you want to happen to the asset if Y rejects it? If the answer is that it goes back to X, then why not just have Y send it back to X in a normal transaction? Is there any difference between Y doing that and "rejecting" the transaction?
answered Oct 24, 2018 by MultiChain
If Y rejects it, nothing will happen as it is not taken from X to go back to X. I want that the asset will only transfer if X release it and Y accept. This is related to business logic of letting Y accept asset ( or reject ) or we can say trigger the transaction to be completed .
OK, so here's how I think you need to do it. First you should use MultiChain 2.0 (alpha) for its Smart Filters feature. Then Y can use verifymessage to sign a message saying they approve the transfer (you can decide on the format of this message and whether it contains a timestamp). Y needs to get this message to X somehow (on-chain or off-chain, it doesn't matter). Then X needs to embed this approval and the signature from verifymessage in a metadata output as part of its transfer to Y. And the Smart Filter enforces the rule that any transfer from X to Y has to include an approval by Y.
Thank you very much for this proposal and appreciate your support for the below:
-(Y can use verifymessage to sign a message) Do you mean using signmessage RPC to build approval message? if yes appreciate example for the message format(JSON or hexadecimal data structure)
-(Y needs to get this message to X) how to do messaging exchange between 2 addresses
-(X needs to embed this approval) what is JSON-RPC can I use to embed approval in the transaction taking in our consideration that the approval come after transaction initiation from X[ Generally speaking embed data in the transaction after X initiate transfer using sendfrom JSON RPC]
Yes, I mean using signmessage. You would have to decide on the format of the signed message yourself, e.g. a comma-delimited string <address>,<amount>,<expiry-time>

In MultiChain there isn't currently a way to send a message from one address to another over the blockchain, without that message being in the chain itself. So you could either put this in a stream (making it on-chain) or else use some non-blockchain way, such as email, web API, etc...

You can embed the approval using the sendwithdata API - the approval will go into an extra metadata output. You can use a JSON structure that contains four fields: address, amount, expiry-time and then the signature itself. The Smart Filter then verifies that (a) the transaction is allowed according to the first 3 fields, and (b) the signature in the 4th field matches the first 3 fields.
...