...
What I don't understand (assuming I've understood everything correctly so far) is how to spend it. Bitcoin Core spends inputs of such transactions with createrawtransaction followed by a signrawtransaction.
To spend the inputs you have 2 of 3 steps, the sendrawtransaction transaction is the real way to spend them, some time ago i made a post in the spanish section explaining this with bash, and here is the example:
a=$(./bitcoin-cli createrawtransaction '[{"txid":"d42065fea1331ecc8e05d4f2d07d12b3b56d61a749e1db8cf56ab7b3ab0aedbc","vout":1}]' '{"1QzkZdiuodaAXoB1XJc3YmihQe7v6bAfxJ":0.17960000}')
b=$(./bitcoin-cli signrawtransaction $a)
./bitcoin-cli sendrawtransaction $(echo $b | cut -d " " -f4 | sed 's/,//g' | sed 's/"//g')
People can create a transaction from any input in the blockchain, but only those with the private keys can sign those transactions. If the private key of the address is loaded in the Bitcoin Core, then the signrawtransaction command will be able to do the magic, but if you don't have the private keys imported in the core, then you can use the signrawtransactionwithkey option:
bitcoin-cli signrawtransactionwithkey "myhex" "[\"key1\",\"key2\"]"
I do create the transaction:
$ bitcoin-cli --testnet createrawtransaction "[{\"txid\":\"9f3e800aeef891ad654aa453bcff843014bec82f0f95bea9beaadf6053b40d76\",\"vout\":0}]" "[{\"tb1q3xyzqkylfj9p5nhulcggwtgdmuy608kdg05c8p\":0.00099}]"
0200000001760db45360dfaabea9be950f2fc8be143084ffbc53a44a65ad91f8ee0a803e9f0000000000ffffffff01b882010000000000160014898820589f4c8a1a4efcfe10872d0ddf09a79ecd00000000
But, I don't know what to submit with
signrawtransactionwithkey. According to the docs, private key(s) are required as an argument,
but I don't want to sign anything. I only want and need to enter the redeemScript. Private keys are required to sign the transactions, let's say you can give that signed transaction to someone else to push it. You can see it as a money check ready to get redeem on the bank.
And that last part is confusing mate, if you don't get at all why you are using signraw if you don't want to sign anything.