After shadders recent post (The unfuckening of OP_RETURN) there has been a lot of activity on the BSV chain, using the newly increased size limit of OP_RETURN's.
There are some great tools out there, that make this process simple and abstract the user away from the nitty gritty needed to make this happen, so I thought it would be interesting to write a post describing how to do it using the RPC command line.
What you will need for this tutorial:
  • Access to a Bitcoin Node that has a wallet with some funds in it.

The first step is to define what data we want to add to the Blockchain, and then hex encode it. I'm going to add the message: "WhatsOnChain sharing knowledge with the world".
You can use whatever method you like to covert a string to a hex, for simplicity I used a online conversion tool, and the output I get for the above message is: 57686174734f6e436861696e2073686172696e67206b6e6f776c6564676520776974682074686520776f726c64
Next we need to get our UTXO transaction ID and vout. You can do this, using the RPC command line, by running listunspent. Your output will look similar to the following:
[{"txid":"e48e59bcf057a8970c859b90f118bc92f0b0cc00828892d8f9064d68fcf3ee52","vout":1,"address":"1DBekW91DN73f6Q3uNLfdTipnaYD9XJrGq","account":"s","scriptPubKey":"76a91485a52e613113d6db993593db8eb570422dfa93da88ac","amount":0.07575702,"confirmations":12,"spendable":true,"solvable":true,"safe":true}]
Now we need to create a changeaddress for our change to be paid back to. You can do this with the RPC command getrawchangeaddress.
To recap, and to make our next commands simpler, let's create the following variables:
utxo_id=e48e59bcf057a8970c859b90f118bc92f0b0cc00828892d8f9064d68fcf3ee52
utxo_vout=1
rawchangeaddress=15XxnVNkyVT8qzCmtD63pbt7MtNDFDJYXM
datahex=57686174734f6e436861696e2073686172696e67206b6e6f776c6564676520776974682074686520776f726c64

We now have all the pieces of the puzzle, to make our transaction. The first thing we have to do is to make our transaction using the RPC command createrawtransaction. I've simplified it by putting in our variable names above, instead of the values (keep all of the quotation marks as they are, just replace the values).
createrawtransaction '[{"txid":"utxo_id","vout":utxo_vout}]' '{"data":"datahex","rawchangeaddress":0.07575202}'
This command will use the unspent transaction defined in the first parameter (utxo_id & utxo_vout) and will send 0.07575202 to the address rawchangeaddress.
Why 0.07575202? Because I want to send 0.00000500 in fees, and my total UTXO value is 0.07575702 (0.07575702 - 0.00000500 = 0.07575202)
With all the data, my command looks like this:
createrawtransaction '[{"txid":"e48e59bcf057a8970c859b90f118bc92f0b0cc00828892d8f9064d68fcf3ee52","vout":1}]' '{"data":"57686174734f6e436861696e2073686172696e67206b6e6f776c6564676520776974682074686520776f726c64","15XxnVNkyVT8qzCmtD63pbt7MtNDFDJYXM":0.07575202}'

Once you run this RPC command, you will get the hex string of the transaction in return. My hex string was:
020000000152eef3fc684d06f9d892888200ccb0f092bc18f1909b850c97a857f0bc598ee40100000000ffffffff0200000000000000002f6a2d57686174734f6e436861696e2073686172696e67206b6e6f776c6564676520776974682074686520776f726c64a2967300000000001976a91431bb8c624b918e9f116d922b36ffd09218421e3388ac00000000
The next step is to run the signrawtransaction command, passing the hex string returned in the previous step. Because I'm running this on the same Node as my keys, I do not need to pass any additional parameters (and that is out of scope of this tutorial).
Once you have run that command, you will get the hex-encoded raw transaction with signature(s). Again, for illustration purposes, my output was the following (where "hex" is the value I want to keep):
{"hex":"020000000152eef3fc684d06f9d892888200ccb0f092bc18f1909b850c97a857f0bc598ee4010000006a4730440220217a7d99d40b45e1b24aea58a6b21b9a8a17c0014b73af4c995fd68c903f763902202737a9086804b286febb8bac670b4279e1789ce7df28d59d94dea7fa2668a07f412102f2f835f97086f8c2402383773d954046168ef141f2c7192c8bede03fa5414824ffffffff0200000000000000002f6a2d57686174734f6e436861696e2073686172696e67206b6e6f776c6564676520776974682074686520776f726c64a2967300000000001976a91431bb8c624b918e9f116d922b36ffd09218421e3388ac00000000","complete": true}
The last step in the process is to run the sendrawtransaction command, with the hex from the previous step as the parameter.
The output of this command is the transaction hash. My output was 468d564e77e745ebb96270aac1fd90910aeee0f016f2e4d269ff49c9bef04a5d which I can view on WhatsOnChain:

I hope you found this useful and welcome and feedback, good or bad.
 

$4.75
6.0¢

Reviews
2 of 2 reviewers say it's worth paying for

0 of 2 reviewers say it's not worth paying for
Comments
  earned 0.0¢
Thank you.
I will start with founding meaning of all the words I dont understand.
:)

0.0¢
   2mo ago
  earned 0.0¢
Awesome article, very useful!
0.0¢
   2mo ago