I am trying to create a transaction using this as my template here (I'm using Bitcoin Core 0.20.1 testnet)
The RPC "createrawtransaction" of Bitcoin Core 0.12 will be extended, and directly supports to create OP_RETURN transactions as follows:
bitcoin-cli "createrawtransaction" '[{"txid":"hash","vout":n}, ...] '{"data": "0123..."}'
When I create the raw transaction, my node is giving me an error about the data I want to include.
For example, I tried to convert "I am FractalEncrypt" to hex and I get this:
4920616d204672616374616c456e6372797074
When I try to insert this string into the data field below I get
Error: Error parsing JSON:
createrawtransaction \
'[{"txid": "txid1", "vout": vout1},
{"txid": "txid2", "vout": vout2}]' \
'{"address1": Amount1,
"address2": Amount2,
"address3": Amount3,
"data": 4920616d204672616374616c456e6372797074}'
If instead of 4920616d204672616374616c456e6372797074, I just use 49 (the first two digits)
Immediately, createrawtranstion works, and I get my raw tx hex.
I tested the same thing with "hello world"
68656c6c6f20776f726c64
This gives the JSON error, but if I only use the first 2 digits, 68, then it works.
So obviously I am converting from text to the hex strings incorrectly, I'm using "text to hexadecimal" converters online, I've tried 2, they give identical results...
Here's one -
https://www.rapidtables.com/convert/number/ascii-to-hex.htmlHere's the other -
https://www.online-toolz.com/tools/text-hex-convertor.php