1

It seems that two addresses have same hash160 69665e2c4fac771e340f8c6f91c719b0c37a6a8f:

How is this possible (it's probably not a collision, is it?)

Note: I first thought it would be because of compressed/uncompressed, but not possible: the ripemd160 hash is done after formatting the public key (either to compressed or uncompressed) to hex, and after a SHA256 hash.

2 Answers 2

2

1AcJanbHGrBFwS3KJMDW8kEZMtHiJhatzE is a P2PKH (pay to pubkey hash) address. 3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs is a P2SH (pay to script hash) address. Their only difference is in the version byte that identifies the type of address.

However, in order to spend a P2PKH output, one needs to reveal the public key with the address's hash160. In order to spend a P2SH output, one needs to reveal the script with the address's hash160.

Given that the P2SH address has spending transactions already, clearly someone knows the script whose hash is 69665e2c4fac771e340f8c6f91c719b0c37a6a8f (namely the script 2 02707f8c41a9ce80bd85c335ce37617388fe8fd5c7b6079f730fc8b7159867cb3e 02f61a255027b492203f04396474e032e759367ad32cdb1b317074e216718f9b53 02ae11e6f80d33717c8dffcbd4e480b95f82f9fe7478cb166beebddd5b062c9f96 3 OP_CHECKMULTISIG, a 2-of-3 multisig script). It is astronomically unlikely that someone also has a public key whose hash is that some value (and much less knows the private key). As a result, it is extremely unlikely that funds sent to the P2PKH address are spendable.

7
  • Thanks for your answer. Could you add in the question which one is the P2PKH, which one is the P2SH? In order to spend a P2SH output, one needs to reveal the script with that hash.: which script? As the hash can only be the hash of either a script or a pubkey, only one of the two is spendable. Which one is spendable here? Also, do you think the two addresses were generated by the same person, is it random that they have same hash160? (seems highly unlikely)
    – Basj
    Jan 5, 2018 at 15:02
  • The 1... is P2PKH. The 3... is P2SH. Which script? The script whose hash is equal to the hash160 in the address. The P2SH is spendable. It is theoretically possible but astronomically unlikely that there is a collision. Jan 5, 2018 at 15:06
  • Thanks. So the 3... address is not a regular address, but something related to a script? (my current experience in Bitcoin is mostly sending/receiving BTC from an Electrum wallet or between exchanges) Where is stored the script? (I guess not in the blockchain?). I feel like I'm discovering an unknown part of Bitcoin here, what's the name if this scripting feature?
    – Basj
    Jan 5, 2018 at 15:11
  • I've updated the answer a bit. It's a P2SH address, specified in BIP13. Its semantics are described in BIP16. They've been around since 2012, but are only commonly used for multisignature addresses (like this one) and more recently SegWit addresses. Jan 5, 2018 at 15:17
  • Thanks for your answer. en.bitcoin.it/wiki/Pay_to_script_hash helped me too to understand (link posted for future ref). Last thing: how did you get the namely the script 2 02707f8c41a9ce80bd85c335ce37617388fe8fd5c7b6079f730fc8b7159867cb3e ... 3 OP_CHECKMULTISIG part from the hash160?
    – Basj
    Jan 5, 2018 at 15:21
0

There is absolutly nothing special about this case, or a collision or what soever. It is simply a different way of generating a bitcoin address. Say you create a "type 3" multisig address. One would create a "redeemscript", which is for a 2-of-3 example multisig this:

52410450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA641047747ECECEB2C6692D6CEAAF4A11ED9DB900741730C201F95B8A4EEF20D7DEE2CDEC2802C6EDC880BEE41E9D114A8708260D01AB107B5177DECB4E109C54792234104050DE465C62476FFAAB8AA4E47B9E4A01079E8A287E7B1316F0CAB29DC58C734228F2DAE7F1799FB0290ECF2EF08207C087A4CE98F1051443A6A5ABE60963A9353ae

This redeemscript is then converted into a bitcoin address:

1.) sha256 of the redeemscript:     8342fc1facef672c9b6c96b8dc79ac7ff2bfbb6babe444d6abf40597f19e12c5
2.) RipeMD160 of the redeemscript:  bc01acb41044f23a1eccaeb112e3a6021c3ab844
3.) base58 encoded -> P2SH address: 3Jq6xxnjXbB5BxFLfLidWmaunKBBSstJYn

This is a "type 3" address based on a redeem script.

When now using the RipeMD160 hash, and putting in the step 4 of the normal address generation, you receive a normal bitcoin address (as I don't have the priv key or the public key, neither the SHA256, I skip the first three steps of a bitcoin adress generation task):

0 - Private ECDSA Key 
1 - Public ECDSA Key 
2 - SHA-256 hash of 1

and then follow these steps to create the final bitcoin address:

3 - RIPEMD-160 Hash of 2
4 - Adding network bytes to 3
5 - SHA-256 hash of 4
6 - SHA-256 hash of 5
7 - First four bytes of 6
8 - Adding 7 at the end of 4
9 - Base58 encoding of 8

This creates me the bitcoin address 1J963RJHygrh6nYuYF4369DydntTtG3YBy, and has the same RipeMD160 hash.

So you can repeat this step with any "type 3" multisig address or its RipeMD160 hash. Nothing special ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.