I am using Bitcoin Testnet's command line (and GUI). I am curious how, using my own computer and equipment (I already used a faucet) I could send a transaction easily. I tried https://github.com/coinspark/python-OP_RETURN and it failed because it is a newer version of bitcoin. However, I think I could use the CLI to broadcast a message.
1 Answer
Bitcoin Core allows you to create transactions with up to 80 bytes of arbitrary data in an OP_RETURN output. You do this by using the raw transaction process (using createrawtransaction
or fundrawtransaction
) or the psbt process (using walletcreatefundedpsbt
). For all of those commands, when you specify the outputs, you can specify one that is like: {"data":"<hex string>"}
where <hex string>
is the data you want to send as a hexadecimal string. This will create a transaction with an OP_RETURN output of 0 value with whatever data you specified in <hex string>
. The transaction can then be signed and broadcast just like any other raw transaction or psbt.