signrawtransaction manually for publishing to stream

+1 vote

I am trying to publish to stream, but my keys are off of the node. I am following the "Publishing to streams" section in up until appendrawdata. I am trying to sign the transaction off the node, but I am not sure how to proceed. I am able to sign a transaction involving assets off the node, but I don't know how it works with just metadata. Do I need a ScriptPubKey? Where would I get it? For assets, I got the scriptPubKey from the utxos of the asset I was trying to spend, but in this case there are no assets involved. How do I generate the scriptSig for this transaction?

Thanks in advance!
asked Aug 30, 2017 by veronica

1 Answer

0 votes

In this case, the UTXO you are spending is the one which was output by preparelockunspent, and it will contain zero assets. Apart from that the signing is an identical process as for spending an asset.

answered Aug 30, 2017 by MultiChain
When I call preparelockunspent, it only returns a txid and vout. Where do I get the scriptPubKey?
Actually, is the scripPubKey from listunspent? I saw the same txid when I did listunspent. Also would there be a case with multiple scriptPubKeys or will there always only be one?
First if the node is tracking that address (having imported it with importaddress), you don't need to pass the scriptPubKey to signrawtransaction. Otherwise, you can obtain the scriptPubKey from the decoded details of the transaction that was created by preparelockunspent, based on the output you're spending.