0

I play around with transactions and testnet and created (not broadcasted yet) transaction with the following scriptPubKey:
"256 OP_CHECKSEQUENCEVERIFY OP_DROP OP_DUP OP_HASH160 <pkh> OP_EQUALVERIFY OP_CHECKSIG".

Now I'd like to sign a spend. Is there any standard approach or has it not been implemented in bitcoin core? The tool bitcoin-tx seems to be able to sign transactions, although I'm not sure if this is what it was designed for, namely
bitcoin-tx -testnet -create in='<txid>:<vout>:256' outaddr=<val>:<addr> set=prevtxs:'[{..."scriptPubKey":<script-to-spend>...}]' set=privatekeys:'[<privKey>]' sign=ALL

This command ends with no error, but produces not-signed transaction. The program seems not to validate syntax of the script, since if I set as prevtxs["scriptPubKey"] some invalid script, it doesn't throw any error (e.g. swap OP_CHECKSIG (0xac) with OP_CHECKMULTISIG (0xae). I don't know actually why do I need to supply this info.

So I have 2 questions:

  1. Is my initial output script even correct? If not, what is the right way of using CHECKSEQUENCEVERIFY?
  2. How should I spend similar this kind of non-standard outputs? (except hard-coding that spend using bitcoin libraries.)

This behaviour has been observed on Bitcoin Core version v0.16.0

  • You may have to wrap it in a p2sh address – Abdussamad Mar 31 '18 at 19:43
  • This is not problem. Problem is whether I need to understand deeply all stuff like quadratic-hashing and actually sign my transaction manually using some custom-built software just for that purpose or how to actually do that. – jakob Mar 31 '18 at 20:51
  • You'll need to write your own software to sign such a spend. Bitcoin Core can only sign scripts that follow a small number of templates (P2PK, P2WPKH, multisig, and P2SH and P2WSH wrapped versions of those). – Pieter Wuille Apr 1 '18 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.