send RPC call has a parameter in the JSON dictionary of the first argument to allow you to specify arbitrary hex data for an address (which I assume represents a locking script).
Yes, but you can only input an address there. P2PKH, P2SH, P2WPKH, P2WSH and P2TR (that I have forgotten to mention in OP). Not a custom script.
As you can see, it does not specifically define the function of "data", nor gives any examples that use it, so this is my best-guess assumption.
The value of
data is taken as OP_RETURN data.
(network: testnet)
input: 46f1bfbe99e12841841e131b8ce04c4708881d8facc4729c16c97d78bcfad3c8
vout: 0
data: aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000087 (OP_HASH256 OP_PUSHBYTES_32 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 OP_EQUAL)
createrawtransaction "[{\"txid\":\"46f1bfbe99e12841841e131b8ce04c4708881d8facc4729c16c97d78bcfad3c8\",\"vout\":0}]" "[{\"data\":\"aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000087\"}]"
0200000001c8d3fabc787dc9169c72c4ac8f1d8808474ce08c1b131e844128e199bebff1460000000000ffffffff010000000000000000256a23aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000008700000000
decoderawtransaction 0200000001c8d3fabc787dc9169c72c4ac8f1d8808474ce08c1b131e844128e199bebff1460000000000ffffffff010000000000000000256a23aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000008700000000
{
"txid": "b5a051fa0281d3f6b1023c8517f47011faef9e2de6e315cd71ed60ded9aee8f0",
"hash": "b5a051fa0281d3f6b1023c8517f47011faef9e2de6e315cd71ed60ded9aee8f0",
"version": 2,
"size": 97,
"vsize": 97,
"weight": 388,
"locktime": 0,
"vin": [
{
"txid": "46f1bfbe99e12841841e131b8ce04c4708881d8facc4729c16c97d78bcfad3c8",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00000000,
"n": 0,
"scriptPubKey": {
"asm": "OP_RETURN aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000087",
"hex": "6a23aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000087",
"type": "nulldata"
}
}
]
}
See?
My assumption is the "data" key-value pair in the output is just OP_RETURN, it wont process scripts;
Reason is, it automatically prepend 0x6A to the value which is OP_RETURN.
Exactly.
If you want to spend a custom script's UTXO [...]
I don't want to spend
a custom script's UTXO. I want to
create the custom script's UTXO.