testnet – How do I transmit an OP_RETURN transaction using bitcoin cli

Bitcoin Core allows you to create transactions with up to 80 bytes of arbitrary data in an OP_RETURN output. To do this, use the unprocessed transaction process (using createrawtransaction or transfer of funds) or the psbt process (using Walletcreatefundedpsbt). For all those commands, when you specify the outputs, you can specify one that is like: {"data":""} where are the data you want to send as a hexadecimal string. This will create a transaction with an OP_RETURN output of value 0 with the data specified in . Then, the transaction can be signed and transmitted as any other transaction without format or psbt.