So the one output would have a value of 0 Satoshis and the script part would just be OP_RETURN + 40 bytes of data?
If this is the preferred dust cleanup transaction I'm happy to know it.
Yes. You are not forced to add 40 bytes of data.
The one-byte-output-script OP_RETURN and zero amount to it will send all your inputs to miner
for example:
https://blockchain.info/tx/3d665c1eb25160444cf053988a0d7d0c3ec5e68e3897a917d59447052788cfc5note, that blockchain.info can not decode this output script to address and shows message "Unable to decode output address - (Unspent)"
I do not know what client is able to create such transactions.
It is quite easy, but I use my own tools.
One follow-up, according to the OP codes listed here
https://en.bitcoin.it/wiki/Script, it seems that OP_RETURN:
Marks transaction as invalid. A standard way of attaching extra data to transactions is to add a zero-value output with a scriptPubKey consisting of OP_RETURN followed by exactly one pushdata op. Such outputs are provably unspendable, reducing their cost to the network. Currently it is usually considered non-standard (though valid) for a transaction to have more than one OP_RETURN output or an OP_RETURN output with more than one pushdata op
This is a little confusing because "valid" seems to be being used more than one way in the same paragraph. I guess this isn't the kind of marking invalid which would cause a node not to relay the transaction? What's the correct understanding of "valid" here?