1
I am using NBitcoin to write some code. I want to send some bitcoin to an address AND include a message with it. The message could say who the payment came from or why it was sent. According to the demos, a txOut can have a destination or a message but not both. Both are stored in the ScriptPubKey.
Edit. Someone suggested I could use two Outputs, one for the payment and one for the message, but that doesn't seem to suggest there is a link between the two.
What do you mean with "message"? Are you talking about an
OP_RETURN? – Murch – 2019-10-22T15:08:14.117I mean this https://programmingblockchain.gitbook.io/programmingblockchain/bitcoin_transfer/spend_your_coin#message-on-the-blockchain a note relating to that payment.
– ThirdPrize – 2019-10-22T18:28:41.223Okay, I had a look and what you linked appears to refer to an
OP_RETURN, so I added the tag. What you state is correct, you can either send an amount to an address in an output, or send anOP_RETURN. You would need to create two outputs, one to send the bitcoins, one to create theOP_RETURN. Was that your question? Could you please edit your question post to clarify what your question is? – Murch – 2019-10-22T21:26:51.5571Warning: Make sure to include the amount in a different output than the message. Do not include the amount you wish to send in the OP_RETURN output or you'll burn all the BTC in that output. – Jose Fonseca – 2019-10-23T02:19:42.237
Edited. So there is no way of including a comment in an payment? That's a bit naff. – ThirdPrize – 2019-10-23T09:45:04.557