How to use preparelockunspentfrom with external keys

+1 vote

Hi Guys, i needed use preparelockunspentfrom with the external private key, it's possible?

asked Aug 24, 2018 by rafaeltokyo

1 Answer

0 votes

The preparelockunspentfrom command cannot be used with an external private key, since it's one of the high level APIs. However you can perform the equivalent action as follows:

  1. Use createrawsendfrom to prepare a transaction sending the appropriate amount back to the same address.
  2. Use signrawtransaction and sendrawtransaction in the usual way to get this transaction signed using the external private key, and then sent.
  3. The amount you want (equivalent to preparelockunspent output) will be in the transaction output with the txid given by the output from the previous step, and with vout 0 (zero).
  4. Use the lockunspent API to lock this transaction output.
That's it. You'll now be in the exact same situation as if you'd used preparelockunspentfrom.
answered Aug 25, 2018 by MultiChain
...