1

I'm playing around on regtest to build a flow for P2SH multisig. I'm getting "missing inputs" back from the sendrawtransaction RPC call, but I see inputs when I put it in a decoder. They each have a parent txid along with the index of the transaction they're trying to spend. Also the sigscript is two of the three sigs required, with the redeem script after.

It's a transaction that signs two multisigs and sends the coins to two addresses.

I get the feeling there's something I've misunderstood or added in the wrong place. Particularly the OP_0 which I understood to be a baked in bug from way back seems to appear in my script but not in other's.

Also I'm unclear about what the signature script needs to contain? I read that you need the original redeem script preceeded by the signatures. But mine seems to be a lot longer than examples I've found.

Here's a sample HEX of my transaction:

0100000002c7aa6e8710e39a51633e8a7dd76b9e8f6781753b99c26f2c3cc4193d4bdd6bae00000000fdfd0000483045022100e5837a236b445e9c93252aada919af04ec3c0242a69b9596a9a6e3998a874a4c02201d5075a35698230584a5ba3e71ef65f457c2ae98be130d9c79447c13d068e2e60147304402204afbb74994287fb09384836aef0b48b254f3ae595c7353ef3ba9b72625506d97022046d99158aad1198b70d04a0195e8e65b0115218ee529061e35b66090c0d82a65014c695221037e57f9f2a4b858ceeecb7b8c443dba0c8a15a01fa2f0ff67101a89aa38bb240d21037e722d46da6fabaf28ec4d52eeb52b4589ed6aa71838eb52bcb3293caf310d3921038d1924d2e0e895b198c653861f78c0f65709961b1c6fee5498a337f952bf9e0353aeffffffff326a67f8668570fb0a60af8ebcf2ab0793dd4ba272ff6c7c3cf4eb2b62c19d6201000000fdfd000047304402201efed43a1a9bc3286745628adc829ee75716a3cc9e5d96bbace2e77cd61c210602205dd6e1e903b0186538978a327f7c206b1107d575b0fc8db201bf0bae2535882401483045022100dce634a29da4cf08e3b6b16b3ca7c8abf8900d1e8976f3b14a120d8b85e6034402205b11fd15cfa7d29681a59408bf67540a48c32fca7ebe3b24c7a2d695e5ea3765014c6952210233ca1ca0da0e46decd7a89d7c37ec30d60850a96c2ccf0a7c58dd9c016f1bf9c21025b7f36a085d039a5a394ec9948418ffb16438d2463a8a3647c58e0b4e42bd7ed2103001fb69eedda91acf8cc93895334616523370f629ec864a0da9b2d3e8a2fa3ca53aeffffffff0200e1f5050000000017a914f71e30b65d23124daf513943a07b6f9f54f0c9cd870065cd1d0000000017a91484fdbb3c611311033208cb3aacb8d60392095f558700000000

And here's what Bitcoind thinks it decodes to:

{
    txid=531157efd4cbb1561e13aa1f39b31cae87f463f7f84ba04373b794a73784dc23,
    hash=531157efd4cbb1561e13aa1f39b31cae87f463f7f84ba04373b794a73784dc23,
    version=1,
    size=666,
    vsize=666,
    weight=2664,
    locktime=0, 
    vin=
    [
        {
            txid=ae6bdd4b3d19c43c2c6fc2993b7581678f9e6bd77d8a3e63519ae310876eaac7,
            vout=0,
            scriptSig=
            {
                asm=0 3045022100e5837a236b445e9c93252aada919af04ec3c0242a69b9596a9a6e3998a874a4c02201d5075a35698230584a5ba3e71ef65f457c2ae98be130d9c79447c13d068e2e6[ALL] 304402204afbb74994287fb09384836aef0b48b254f3ae595c7353ef3ba9b72625506d97022046d99158aad1198b70d04a0195e8e65b0115218ee529061e35b66090c0d82a65[ALL] 5221037e57f9f2a4b858ceeecb7b8c443dba0c8a15a01fa2f0ff67101a89aa38bb240d21037e722d46da6fabaf28ec4d52eeb52b4589ed6aa71838eb52bcb3293caf310d3921038d1924d2e0e895b198c653861f78c0f65709961b1c6fee5498a337f952bf9e0353ae,
                hex=00483045022100e5837a236b445e9c93252aada919af04ec3c0242a69b9596a9a6e3998a874a4c02201d5075a35698230584a5ba3e71ef65f457c2ae98be130d9c79447c13d068e2e60147304402204afbb74994287fb09384836aef0b48b254f3ae595c7353ef3ba9b72625506d97022046d99158aad1198b70d04a0195e8e65b0115218ee529061e35b66090c0d82a65014c695221037e57f9f2a4b858ceeecb7b8c443dba0c8a15a01fa2f0ff67101a89aa38bb240d21037e722d46da6fabaf28ec4d52eeb52b4589ed6aa71838eb52bcb3293caf310d3921038d1924d2e0e895b198c653861f78c0f65709961b1c6fee5498a337f952bf9e0353a
            }, 
            sequence=4294967295
        }, 
        {
            txid=629dc1622bebf43c7c6cff72a24bdd9307abf2bc8eaf600afb708566f8676a32,
            vout=1,
            scriptSig=
            {
                asm=0 304402201efed43a1a9bc3286745628adc829ee75716a3cc9e5d96bbace2e77cd61c210602205dd6e1e903b0186538978a327f7c206b1107d575b0fc8db201bf0bae25358824[ALL] 3045022100dce634a29da4cf08e3b6b16b3ca7c8abf8900d1e8976f3b14a120d8b85e6034402205b11fd15cfa7d29681a59408bf67540a48c32fca7ebe3b24c7a2d695e5ea3765[ALL] 52210233ca1ca0da0e46decd7a89d7c37ec30d60850a96c2ccf0a7c58dd9c016f1bf9c21025b7f36a085d039a5a394ec9948418ffb16438d2463a8a3647c58e0b4e42bd7ed2103001fb69eedda91acf8cc93895334616523370f629ec864a0da9b2d3e8a2fa3ca53ae,
                hex=0047304402201efed43a1a9bc3286745628adc829ee75716a3cc9e5d96bbace2e77cd61c210602205dd6e1e903b0186538978a327f7c206b1107d575b0fc8db201bf0bae2535882401483045022100dce634a29da4cf08e3b6b16b3ca7c8abf8900d1e8976f3b14a120d8b85e6034402205b11fd15cfa7d29681a59408bf67540a48c32fca7ebe3b24c7a2d695e5ea3765014c6952210233ca1ca0da0e46decd7a89d7c37ec30d60850a96c2ccf0a7c58dd9c016f1bf9c21025b7f36a085d039a5a394ec9948418ffb16438d2463a8a3647c58e0b4e42bd7ed2103001fb69eedda91acf8cc93895334616523370f629ec864a0da9b2d3e8a2fa3ca53ae
            },
            sequence=4294967295
        }
    ], 
    vout=
    [
        {
            value=1.00000000,
            n=0,
            scriptPubKey=
            {
                asm=OP_HASH160 f71e30b65d23124daf513943a07b6f9f54f0c9cd OP_EQUAL,
                hex=a914f71e30b65d23124daf513943a07b6f9f54f0c9cd87,
                reqSigs=1,
                type=scripthash,
                addresses=[2NFms4Kj7Jqa3ozPffoHg2NVzuYvH7sAGTN]
            }
        }, 
        {
            value=5.00000000,
            n=1,
            scriptPubKey=
            {
                asm=OP_HASH160 84fdbb3c611311033208cb3aacb8d60392095f55 OP_EQUAL,
                hex=a91484fdbb3c611311033208cb3aacb8d60392095f5587,
                reqSigs=1,
                type=scripthash,
                addresses=[2N5NR9Aua54wSwHbdmRhjPwPtqc1v1zYyze]
            }
        }
    ]
}

Here's what Bitcoinj thought it was sending:

SpendObj aftr sigs:

[
    Transaction
    {
        531157efd4cbb1561e13aa1f39b31cae87f463f7f84ba04373b794a73784dc23
        purpose: UNKNOWN
        in   0[] PUSHDATA(72)[3045022100e5837a236b445e9c93252aada919af04ec3c0242a69b9596a9a6e3998a874a4c02201d5075a35698230584a5ba3e71ef65f457c2ae98be130d9c79447c13d068e2e601] PUSHDATA(71)[304402204afbb74994287fb09384836aef0b48b254f3ae595c7353ef3ba9b72625506d97022046d99158aad1198b70d04a0195e8e65b0115218ee529061e35b66090c0d82a6501] PUSHDATA1[5221037e57f9f2a4b858ceeecb7b8c443dba0c8a15a01fa2f0ff67101a89aa38bb240d21037e722d46da6fabaf28ec4d52eeb52b4589ed6aa71838eb52bcb3293caf310d3921038d1924d2e0e895b198c653861f78c0f65709961b1c6fee5498a337f952bf9e0353ae]
            unconnected  outpoint:ae6bdd4b3d19c43c2c6fc2993b7581678f9e6bd77d8a3e63519ae310876eaac7:0
        in   0[] PUSHDATA(71)[304402201efed43a1a9bc3286745628adc829ee75716a3cc9e5d96bbace2e77cd61c210602205dd6e1e903b0186538978a327f7c206b1107d575b0fc8db201bf0bae2535882401] PUSHDATA(72)[3045022100dce634a29da4cf08e3b6b16b3ca7c8abf8900d1e8976f3b14a120d8b85e6034402205b11fd15cfa7d29681a59408bf67540a48c32fca7ebe3b24c7a2d695e5ea376501] PUSHDATA1[52210233ca1ca0da0e46decd7a89d7c37ec30d60850a96c2ccf0a7c58dd9c016f1bf9c21025b7f36a085d039a5a394ec9948418ffb16438d2463a8a3647c58e0b4e42bd7ed2103001fb69eedda91acf8cc93895334616523370f629ec864a0da9b2d3e8a2fa3ca53ae]
            unconnected  outpoint:629dc1622bebf43c7c6cff72a24bdd9307abf2bc8eaf600afb708566f8676a32:1
        out  HASH160 PUSHDATA(20)[f71e30b65d23124daf513943a07b6f9f54f0c9cd] EQUAL  1.00 BTC
            P2SH addr:2NFms4Kj7Jqa3ozPffoHg2NVzuYvH7sAGTN
        out  HASH160 PUSHDATA(20)[84fdbb3c611311033208cb3aacb8d60392095f55] EQUAL  5.00 BTC
            P2SH addr:2N5NR9Aua54wSwHbdmRhjPwPtqc1v1zYyze
    }
]

The example to compare to is here:

https://blockchain.info/rawtx/ca1884b8f2e0ba88249a86ec5ddca04f937f12d4fac299af41a9b51643302077

It is spent by this:

https://blockchain.info/rawtx/19f589be5fda5a97b5a26158abd1fa02e68a15e5a6a4d83791935f882dbe0492

  • Seems to me that the transaction outputs referenced in the inputs cannot be found – sea212 Feb 29 at 23:39
  • They're on regtest on my local machine. I've called the RPC client to print them out and I see them. – Carlos Feb 29 at 23:53
  • 1
    I checked the first input script and it is correctly formed. You use a clean unlocking script, including the OP_0 at the beginning and correctly pushing 2 signatures and the redeem script onto the stack. The redeem script is a valid 2-of-3 multisig script. – sea212 Mar 1 at 0:51
  • 1
    Your second input script is also a correctly formed 2-of-3 multisig script. – sea212 Mar 1 at 0:57
  • 1
    I think I figured it out. I've swapped some sigs around. That's why it looks correctly formed, but is invalid. – Carlos Mar 2 at 11:08

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.