Discrepancy in P2SH Redeem Script: Locktime encoding or padding issue (ab vs ad hash result)
Discrepancy in P2SH Redeem Script: Locktime encoding or padding issue (ab vs ad hash result)
Loading saved threads...
Pedro Bonilla · External communityPost link
External question — Bitcoin Stack Exchange
Author: Pedro Bonilla
Original post: https://bitcoin.stackexchange.com/questions/130646
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Background:
I am trying to reconstruct a P2SH redeem script created in early 2026. I have the base data, but there is a 1-bit discrepancy in the resulting Hash160.
The Data:
Target Hash160 (Blockchain): 8d2c7a6a124d1551884798d76c8aedab36908bf3.
Current Script (pt_hex): 0400f6f87bb17576a91470b38fc510ae4a633b4410a25a17c16bbd215cd888ac.
Calculated Hash from pt_hex: 8d2c7a6a124d1551884798d76c8aedad36908bf3 (Note the 'd' vs 'b' difference).
Quote
Report
RedGrittyBrick · External communityPost link
External answer — Bitcoin Stack Exchange
Author: RedGrittyBrick
Original post: https://bitcoin.stackexchange.com/a/130651
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
The situation described in the question is
Preimage
Hash
unknown
8d2c7a6a124d1551 884798d76c8aedab 36908bf3
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
8d2c7a6a124d1551 884798d76c8aedad 36908bf3
There is no way to compute the "unknown" preimage because the hashing algorithm is designed to prevent exactly this.
This is true
even if you know of a preimage that produces a very similar hash
.
Any change in a preimage, even a tiny change, will produce a
completely different hash
1
, not just a hash with a one-bit difference. If this were not so, anyone could use a hill-climbing algorithm or some other process to steal all the money in the blockchain destroying Bitcoin and breaking many other important systems using the same hash algorithm.
Therefore the 1-bit difference can only be explained as a transcription error when transcribing the hash (or less-likely, as a rare 1-bit error in computer hardware, for example those very occasionally produced by cosmic rays high in the atmosphere or in space).
It is entirely possible that there is no possible Bitcoin script that will hash to the first hash value. I'm no mathematician but I wouldn't be surprised if the likelihood is incredibly small that a usable preimage even exists.
The end result is that the money associated with the first hash is forever unspendable.
Addendum
I
computed hashes for all possible 1-bit variations
to show that even small changes to the preimage will cause a large, unpredictable, seemingly random, effect on the hash:
bit
Preimage
Hash160
Difference
unknown
8d2c7a6a124d1551 884798d76c8aedab 36908bf3
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
8d2c7a6a124d1551 884798d76c8aedad 36908bf3
1
1
0500f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
de8ad800d2fdd360 5e110e89cd649f71 02051950
77
2
0600f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
7bd194571d920d65 4a51374709d12df3 0769fdc5
86
3
0000f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
9dab05f599ca5db0 f558d101496ef117 6ecde722
82
4
0c00f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
74600dd550bc3ddd bcbaddf49688d1f3 b0ad42d2
78
5
1400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
c689ec9aa519a896 6c999c586c44de58 3be005e2
79
6
2400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
ebd177db96ae3f5c 13c3eb0e905c15f7 74cd4317
82
7
4400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
5e3f90dd2530017e aaed0267462cce04 943038d9
79
8
8400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
9a933d178607b0c4 40fd770979448ff9 fcb70b42
83
9
0401f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
af6051ee1b1d91ed 3c4c03bfddd60acc 93041db3
68
10
0402f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ac
dc4a5c36ed803b00 d6b6e084071e1f4c 6cd3a9dd
84
...
...
...
247
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd8c8ac
2a2fa831f6b25915 96cee5f6334622da 56235f79
82
248
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd808ac
80d021ed7df02ae0 8c11e13759558e70 486ed38a
95
249
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ad
4e1a859d012c3b08 63d04693e6ef054d e4cd12ca
89
250
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ae
23bf2696544bac51 7f01626ef5126e3d a998585f
80
251
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888a8
c9c95d8525a2f3f7 ed5aac83990e985a 8d1c023b
86
252
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888a4
63f2151847132dd9 afdaed2372fa8736 62c6d128
88
253
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888bc
244fda7ea4cb4bc6 47dc64d5376e727e 4e5b7ced
88
254
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd8888c
d244559645d2765e 1a709d8467677bc6 129ad78f
84
255
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd888ec
79e79188360a0803 42b4a890799b2424 6302cc1c
81
256
0400f6f87bb17576 a91470b38fc510ae 4a633b4410a25a17 c16bbd215cd8882c
563207df8ba3a3f1 2a75da7964a492c5 e6a59838
83
The last column is the number of bits in the hash that differ from the corresponding bit in the hash of the unknown preimage.
As expected, none of the hashes of variations look remotely close to the required hash.
This should make it clear why
any
variation of the script is
extremely unlikely
to get its hash closer to the desired hash
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Bitcoin Stack Exchange Author: Pedro Bonilla Source score (net votes, not local likes): 0 Original post: https://bitcoin.stackexchange.com/questions/130646 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Background: I am trying to reconstruct a P2SH redeem script created in early 2026. I have the base data, but there is a 1-bit discrepancy in the resulting Hash160. The Data: Target Hash160 (Blockchain): 8d2c7a6a124d1551884798d76c8aedab36908bf3. Current Script (pt_hex): 0400f6f87bb17576a91470b38fc510ae4a633b4410a25a17c16bbd215cd888ac. Calculated Hash from pt_hex: 8d2c7a6a124d1551884798d76c8aedad36908bf3 (Note the 'd' vs 'b' difference).
Checking account access…