Publishing off chain data with a wallet address

+2 votes
How to publish something as a off chain data by using a wallet address or a non-node address?

I am working with create raw transaction, signrawtransaction and sendrawtransaction apis to publish data from a non-node address into the blockchain. But if i want to upload it as a offchain data then what is the work around for that?
asked Mar 19, 2019 by gimmick

1 Answer

+1 vote
Best answer

First you should probably use createrawsendfrom rather than createrawtransaction, since that will automatically select the inputs to spend for you. In order to do this the address from which you're preparing the transaction to send needs to be added to the node using importaddress.

To do this for publishing offchain data, specify the createrawsendfrom command's data parameter as an array with a single element that follows one of the stream item formats in this section:

As described in that section, add "options":"offchain" in the stream item object to publish as an off-chain item. At the time of calling createrawsendfrom the off-chain data will be added to the local node's storage, and the transaction prepared (but not yet signed) will include the hash referencing that data.

answered Mar 19, 2019 by MultiChain
selected Mar 20, 2019 by gimmick
Okay, so I just have to add one more parameter(options) in the stream form metadata object.

Yes, that helps. Thanks for the help.