<p>I mistakenly added an OP_PUSHDATA(0x4c) before the second byte of the redeem script and got a wrong hash. The problem is solved...</p>

CC BY-SA 3.0
2018-03-11T01:12:16.107Z
You're doing great. If this is the correct answer you can help by making it as accepted so that the question does not remain as "unanswered".
Willtech
CC BY-SA 3.0
2018-03-11T01:20:56.157Z
I couldn't... It says "You can accept your own answer in 2 days".
Rod Lin
CC BY-SA 3.0
2018-03-11T01:21:48.583Z
Ahh, okay. Good work then, I haven't come across that.
Willtech
CC BY-SA 3.0
2018-03-11T01:30:16.617Z
Probably because of my low reputation haha.
Rod Lin
CC BY-SA 3.0
2018-03-11T00:57:52.757Z
2018-03-11T00:57:52.757Z
Rod Lin
<p>I came across this <a href="https://testnet.blockchain.info/tx/255942b1a9217ce91ce5ff865913e44a65ed6252470b84c0a817c12c84121e1c" rel="nofollow noreferrer">P2SH multisig transactions 255942b1...</a> on the testnet chain that I failed to verify.</p>

<p>I just couldn't find any matching signatures and public keys in the list provided and there seems to be an empty public key(OP_0 in the pub key script) given in the redeem script.</p>

<p>The scripts I found was</p>

<pre><code>sig script:
OP_0 
3046022100a6ad0304388a4df35b444cb96ffee0b393700a6a8612f1e35cc3dc131314f893022100bcc8b2849b04dee59dcedc4fb21a96dda3fd067a381522f37a2b6813c4e1581d01
30450220371b8ee29370e0d23f547163e3c238a40fe279e8edb2b838811cfca7bf5778e0022100f7e81c88ff7ea1c8da2666cae90c6a3c73a6817070c657068c678254fdb0b3f501
520021039039f617d4bd3751bc0550d38e138e7ddd2042f2b137050c872e1be8df4d6aae2103a2b5af230018a36044a0638916829ed8cf6bf745a608fe6dd22ea266a7408e7e53ae

pub key script:
HASH160 bcce3f7e690e5f3bbd1ed6db54dc7317659fa87c EQUAL

redeem script:
2 OP_0
039039F617D4BD3751BC0550D38E138E7DDD2042F2B137050C872E1BE8DF4D6AAE 
03A2B5AF230018A36044A0638916829ED8CF6BF745A608FE6DD22EA266A7408E7E
3 OP_CHECKMULTISIG

signature msg:
54481C2DE6433EA934EB5F46B7E5D1A60FDC584873FC0210991C692058E26D4E
</code></pre>

<p>And my rebuilt tx for signing(same for both public keys) is</p>

<pre><code># version
01000000

01

# input 0
46CEA01182F6B49A49BA06C7BA4C7A95F66B0E5B5FD32B29E7BA2F1DF952E6B8 01000000

49

# sig script(now pkscript)
524C0021 039039F6 17D4BD37 51BC0550
D38E138E 7DDD2042 F2B13705 0C872E1B
E8DF4D6A AE2103A2 B5AF2300 18A36044
A0638916 829ED8CF 6BF745A6 08FE6DD2
2EA266A7 408E7E53 AE

FFFFFFFF

02

# output 0
E07CD50400000000
19
76A914ED99B585A4C7B1578A08C599BF7E87351FE3E78E88AC

# output 1
0C57060000000000
17
A914BCCE3F7E690E5F3BBD1ED6DB54DC7317659FA87C87

00000000
01000000
</code></pre>

<p>Could anyone please help me check this transaction? Thanks!</p>

CC BY-SA 3.0
2018-03-10T14:36:51.717Z
Transaction validity is identical between prodnet and testnet.
Claris
CC BY-SA 3.0
2018-03-10T15:36:39.140Z
@eponymous I see... double checking now.
Rod Lin
CC BY-SA 3.0
2018-03-10T16:17:22.523Z
oh, you have edited the question, and removed the first part :-) On this second part, I'd like to know how you came to the sig message? The tx would have to be rebuilt, the sigscript removed, pkscript inserted and length updated. But which of the two outputs?
pebwindkraft
CC BY-SA 3.0
2018-03-11T00:37:55.787Z
sorry about the editing... I realized that it was me putting the signature in the wrong order in the first tx... I edited the question to include my rebuilt tx for signing. I think I used the redeem script instead of pkscript.
Rod Lin
CC BY-SA 3.0
2018-03-11T00:45:35.580Z
@pebwindkraft ah... silly me, my program added an OP_PUSHDATA in the second byte of redeem script so the script is actually different from the original one... Sorry about the trouble. It's solved now.
Rod Lin
CC BY-SA 3.0
2018-03-11T00:49:41.040Z
You can help the site by writing up your solution as an answer and marking it as accepted so that the question does not remain as "unanswered".
Willtech
<transactions><testnet>
**SOLVED** Failed to verify this transaction?
Rod Lin
# **SOLVED** Failed to verify this transaction?

(Asked by: username_0 on 2018-03-10)

I came across this [P2SH multisig transactions 255942b1...](https://testnet.blockchain.info/tx/255942b1a9217ce91ce5ff865913e44a65ed6252470b84c0a817c12c84121e1c) on the testnet chain that I failed to verify.

I just couldn't find any matching signatures and public keys in the list provided and there seems to be an empty public key(OP\_0 in the pub key script) given in the redeem script.

The scripts I found was

```
sig script:
OP_0 
3046022100a6ad0304388a4df35b444cb96ffee0b393700a6a8612f1e35cc3dc131314f893022100bcc8b2849b04dee59dcedc4fb21a96dda3fd067a381522f37a2b6813c4e1581d01
30450220371b8ee29370e0d23f547163e3c238a40fe279e8edb2b838811cfca7bf5778e0022100f7e81c88ff7ea1c8da2666cae90c6a3c73a6817070c657068c678254fdb0b3f501
520021039039f617d4bd3751bc0550d38e138e7ddd2042f2b137050c872e1be8df4d6aae2103a2b5af230018a36044a0638916829ed8cf6bf745a608fe6dd22ea266a7408e7e53ae

pub key script:
HASH160 bcce3f7e690e5f3bbd1ed6db54dc7317659fa87c EQUAL

redeem script:
2 OP_0
039039F617D4BD3751BC0550D38E138E7DDD2042F2B137050C872E1BE8DF4D6AAE 
03A2B5AF230018A36044A0638916829ED8CF6BF745A608FE6DD22EA266A7408E7E
3 OP_CHECKMULTISIG

signature msg:
54481C2DE6433EA934EB5F46B7E5D1A60FDC584873FC0210991C692058E26D4E

```

And my rebuilt tx for signing(same for both public keys) is

```
# version
01000000

01

# input 0
46CEA01182F6B49A49BA06C7BA4C7A95F66B0E5B5FD32B29E7BA2F1DF952E6B8 01000000

49

# sig script(now pkscript)
524C0021 039039F6 17D4BD37 51BC0550
D38E138E 7DDD2042 F2B13705 0C872E1B
E8DF4D6A AE2103A2 B5AF2300 18A36044
A0638916 829ED8CF 6BF745A6 08FE6DD2
2EA266A7 408E7E53 AE

FFFFFFFF

02

# output 0
E07CD50400000000
19
76A914ED99B585A4C7B1578A08C599BF7E87351FE3E78E88AC

# output 1
0C57060000000000
17
A914BCCE3F7E690E5F3BBD1ED6DB54DC7317659FA87C87

00000000
01000000

```

Could anyone please help me check this transaction? Thanks!

**Tags:** transactions, testnet

> **Comments:**
> **username_1**: Transaction validity is identical between prodnet and testnet.  
> **username_0**: @eponymous I see... double checking now.  
> **username_2**: oh, you have edited the question, and removed the first part :-) On this second part, I'd like to know how you came to the sig message? The tx would have to be rebuilt, the sigscript removed, pkscript inserted and length updated. But which of the two outputs?  
> **username_0**: sorry about the editing... I realized that it was me putting the signature in the wrong order in the first tx... I edited the question to include my rebuilt tx for signing. I think I used the redeem script instead of pkscript.  
> **username_0**: @username_2 ah... silly me, my program added an OP_PUSHDATA in the second byte of redeem script so the script is actually different from the original one... Sorry about the trouble. It's solved now.  
> **username_3**: You can help the site by writing up your solution as an answer and marking it as accepted so that the question does not remain as "unanswered".  

---

## 1 answers

### Answer by username_0 on 2018-03-11. Score: 1 | Accepted answer

I mistakenly added an OP\_PUSHDATA(0x4c) before the second byte of the redeem script and got a wrong hash. The problem is solved...

> **Comments:**
> **username_3**: You're doing great. If this is the correct answer you can help by making it as accepted so that the question does not remain as "unanswered".  
> **username_0**: I couldn't... It says "You can accept your own answer in 2 days".  
> **username_3**: Ahh, okay. Good work then, I haven't come across that.  
> **username_0**: Probably because of my low reputation haha.  

---

