Hi everyone,
I took the liberty of implementing this idea in the python test harness to familiarize myself with OP_CTV and make things a little more concerete in this thread. Hopefully this can help others that are learning about OP_CTV or be used to hack on other interesting OP_CTV projects. You will find direct links to the test cases embedded in the blog post
I first implemented the original idea by Robin Linus, you can find the test case here
I implemented this logic in a test case here. It seems AJ is correct about the limitations of Robin’s original scheme.
Finally, I took a crack at implementing this. This is a little more tricky than it appears. I believe this would theoretically work, but requires a lot of hacking around producing valid signatures for the scriptSig OP_CHECKSIG operation.
It is my understanding that the scriptcodes are different for the digital signature to satisfy the redeem script and the OP_CHECKSIG embedded in the scriptSignature.
Here is where I believe they are defined
- Input scriptcode (i.e. the script signature including the redeem script?)
- The output scriptcode (i.e. the p2sh script).
I attempted to produce the 2 digital signatures. The p2sh output script was no problem of course as its a standardized script type. Here is where I attempted to produce the scriptSignature’s OP_CHECKSIG operation. Unfortunately, the signrawtransactionwithkey
RPC will not just give you the digital signature back that it produced (this would have saved me a lot of time ). It attempts to place the digital signature in the transaction which only works for standardized transactions that the solver is aware of :/.
Since this is a very nonstandard transaction, it doesn’t give me back anything useful at all - just an the same transaction that you passed to the RPC. I do think this workaround will theoretically work, but the practical barriers in this code base are just too high to continue at this time.
Let me know if you see anything wrong with this analysis or have other use cases you would like to see prototyped with OP_{CTV,CSFS}