So instead of entering a receiving address and an amount one would enter '{"data":40_bytes}' ?
Yes, basically it comes down to this.
Here is an example:
1. First, I list unspent outputs of the address I'm going to use.
bitcoin-cli listunspent 0 999999 '["1BxtgEa8UcrMzVZaW32zVyJh4Sg4KGFzxA"]'
[
{
"txid": "7425deeaebc2b13ff6c6d3cac78332693c86f46433403f65aef028bc88050583",
"vout": 4,
"address": "1BxtgEa8UcrMzVZaW32zVyJh4Sg4KGFzxA",
"account": "Sender15",
"scriptPubKey": "76a914784345e76ea29fd7bfe31f6f34622e154d0bb8fc88ac",
"amount": 0.00110691,
"confirmations": 558,
"spendable": true
}
]
2. Then I create the raw transaction. Note that I manually add a change output with a value of 0.00100691, so I pay a fee of exactly 0.0001 BTC. The payload for this transaction is the hex-encoded message "dexX7 @ bitcointalk.org".
bitcoin-cli createrawtransaction '[{"txid":"7425deeaebc2b13ff6c6d3cac78332693c86f46433403f65aef028bc88050583","vout":4}]' '{"data":"6465785837204020626974636f696e74616c6b2e6f7267","1BxtgEa8UcrMzVZaW32zVyJh4Sg4KGFzxA":0.00100691}'
010000000183050588bc28f0ae653f403364f4863c693283c7cad3c6f63fb1c2ebeade25740400000000ffffffff020000000000000000196a176465785837204020626974636f696e74616c6b2e6f726753890100000000001976a914784345e76ea29fd7bfe31f6f34622e154d0bb8fc88ac00000000
3. Then I sign the raw transaction.
bitcoin-cli signrawtransaction 010000000183050588bc28f0ae653f403364f4863c693283c7cad3c6f63fb1c2ebeade25740400000000ffffffff020000000000000000196a176465785837204020626974636f696e74616c6b2e6f726753890100000000001976a914784345e76ea29fd7bfe31f6f34622e154d0bb8fc88ac00000000
{
"hex": "010000000183050588bc28f0ae653f403364f4863c693283c7cad3c6f63fb1c2ebeade2574040000006a47304402206eaf4d9c526a59bc391329dd62b6231035920ed23ba758a4d9b02d7738c0a77b0220404f00253e7d0202e64a7a8288dc83276218b91454d45ab618408f27b7135ba7012103c86e3c49a99dd688c6c6ad05d725b6a04ef19836b13d3e90ef282fc4f2f9ee71ffffffff020000000000000000196a176465785837204020626974636f696e74616c6b2e6f726753890100000000001976a914784345e76ea29fd7bfe31f6f34622e154d0bb8fc88ac00000000",
"complete": true
}
4. And finally I broadcast the signed raw transaction.
bitcoin-cli sendrawtransaction 010000000183050588bc28f0ae653f403364f4863c693283c7cad3c6f63fb1c2ebeade2574040000006a47304402206eaf4d9c526a59bc391329dd62b6231035920ed23ba758a4d9b02d7738c0a77b0220404f00253e7d0202e64a7a8288dc83276218b91454d45ab618408f27b7135ba7012103c86e3c49a99dd688c6c6ad05d725b6a04ef19836b13d3e90ef282fc4f2f9ee71ffffffff020000000000000000196a176465785837204020626974636f696e74616c6b2e6f726753890100000000001976a914784345e76ea29fd7bfe31f6f34622e154d0bb8fc88ac00000000
b394e47f8141f725f25854d57e91fb67d91782dbe581b2f449990ba25a116d2d
5. Here is the result:
https://live.blockcypher.com/btc/tx/b394e47f8141f725f25854d57e91fb67d91782dbe581b2f449990ba25a116d2d/