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
    Commented Oct 22, 2019 at 15:08
  • I mean this programmingblockchain.gitbook.io/programmingblockchain/… a note relating to that payment.
    – ThirdPrize
    Commented Oct 22, 2019 at 18:28
  • Okay, 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 an OP_RETURN. You would need to create two outputs, one to send the bitcoins, one to create the OP_RETURN. Was that your question? Could you please edit your question post to clarify what your question is?
    – Murch
    Commented Oct 22, 2019 at 21:26
  • 1
    Warning: 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. Commented Oct 23, 2019 at 2:19
  • Edited. So there is no way of including a comment in an payment? That's a bit naff.
    – ThirdPrize
    Commented Oct 23, 2019 at 9:45

1 Answer 1


That's correct, you'd need to create two separate outputs. OP_RETURN and payment outputs are two different output types that cannot be combined. I don't know what you're trying to do, but generally, it should be unnecessary to provide a comment with a payment. All the payment related communication would already have been done out of band with the recipient finally providing an invoice address. Given the payer sending the payment to that invoice address, the payment is clearly associated with the invoice.

Note that any bitcoins included in the OP_RETURN output are burned and become unspendable. (H/T Jose Fonseca)

  • My idea was for an on chain tipping system. I want to send your public address 0.00001 btc for this cool answer. I also want some way of you tracing it back to me and/or me telling you which answer it was i'm tipping for. It's only polite. And, it seems, impossible.
    – ThirdPrize
    Commented Oct 23, 2019 at 16:18
  • @ThirdPrize It's not impossible at all. You can simply use OP_RETURN as indicated, but it is generally unnecessary. Addresses should not be reused so the recipient should give you a unique address. If you send bitcoins, they know it was you. A third option is to sign a message using the private key corresponding to the address you are sending from (if it is just one address). Then send that to the person you want to prove the payment to (via email, etc). Commented Oct 23, 2019 at 16:47
  • Yeah, I agree with Jonathan. The message could just be posted off-chain and each post could have a separate address. Also, note that 1,000 sats are less than one magnitude greater than the cost of spending 1,000 sats. Transaction fees are likely cost-prohibitive for on-chain tipping (at least on Bitcoin).
    – Murch
    Commented Oct 23, 2019 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.