Timebased lockunspent assets

+2 votes
Just curious to know if there is any provision of locking the asset on the chain only of the certain period of time.
So that if someone is not completing the Atomic-swap the assets automatically should go back to initial owners wallet instead of sitting as locked-but-unspent assets in the wallet.
asked Mar 25 by Pavan123

1 Answer

0 votes

The act of locking a transaction output is not a blockchain-level event and only occurs internally within a node's wallet. The purpose is to ensure that this transaction output is not spent by other APIs, such as send. So you can unlock it at any time using the lockunspent command, passing true for the unlock parameter.

answered Mar 25 by MultiChain
So there is no scope of HTLC in Multichain?
It is certainly possible to implement HTLC (for others, hash time locked contracts) using inline metadata + a transaction filter. To make a HTLC output, use a 1-of-2 multisignature address, so that either the recipient or original sender can claim it at the MultiChain protocol level. Then include inline metadata as a JSON representing the conditions of spending (for example, the time after which one recipient can spend the output, or a hash that the other recipient has to provide the preimage for). And have a transaction filter installed on the chain which enforces the rules so that the output can only be spent under the appropriate circumstances, either if the time (as obtained from the getlastblockinfo callback) has been reached, or if the preimage is provided in a metadata output of the spending transaction.