I am creating a Bitcoin transaction in C# using NBitcoin library. How do I pass data when building a transaction using "Transaction" class? I can see the parameters for inputs and outputs but do not see any functions for passing the data.

  • 2
    By data are you referring to op_return? See github.com/MetacoSA/NBitcoin/issues/603#issuecomment-442325167
    – m1xolyd1an
    Nov 20 at 4:19
  • Like the createrawtransaction method having an option to pass data along with the output addresses. developer.bitcoin.org/reference/rpc/createrawtransaction.html
    – spk
    Nov 22 at 3:13
  • @spk: I don't understand your question. Could you please provide an example of what kind of data, or how it's supposed to get used?
    – Murch
    Nov 22 at 14:17
  • @Murch: When you create a raw transaction in the ouputs there is an option to send ‘data’ element as a message. createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime replaceable ) Looking for the similar option when creating a transaction offline using NBitcoin library.
    – spk
    Nov 22 at 18:04
  • It sounds like you answered your own question. You can provide inputs and outputs. That should cover anything except for the transaction version and locktime. What data are you trying to pass in addition?
    – Murch
    Nov 22 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.