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

<p>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.</p>

<p>Given that the P2SH address has spending transactions already, clearly someone knows the script whose hash is <code>69665e2c4fac771e340f8c6f91c719b0c37a6a8f</code> (namely the script <code>2 02707f8c41a9ce80bd85c335ce37617388fe8fd5c7b6079f730fc8b7159867cb3e 02f61a255027b492203f04396474e032e759367ad32cdb1b317074e216718f9b53 02ae11e6f80d33717c8dffcbd4e480b95f82f9fe7478cb166beebddd5b062c9f96 3 OP_CHECKMULTISIG</code>, 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.</p>

CC BY-SA 3.0
2018-01-05T15:02:46.683Z
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
CC BY-SA 3.0
2018-01-05T15:06:58.593Z
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.
Pieter Wuille
CC BY-SA 3.0
2018-01-05T15:11:39.503Z
Thanks. So the [3... address](https://blockchain.info/address/3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs) 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
CC BY-SA 3.0
2018-01-05T15:17:52.577Z
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.
Pieter Wuille
CC BY-SA 3.0
2018-01-05T15:21:04.613Z
Thanks for your answer. https://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
CC BY-SA 3.0
2018-01-05T15:22:14.017Z
I looked at once of the transaction inputs that spend an output sent to 3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs (namely the 19th input of transaction 3b33bc0aa4b48ab779c5071c959c289264c9445e19ac485cf0734981e6ce11a1).
Pieter Wuille
CC BY-SA 3.0
2018-01-05T15:52:54.817Z
Thanks again! Note: I don't find transaction [`3b33bc0aa4b48ab779c5071c959c289264c9445e19ac485cf0734981e6ce‌`](https://blockchain.info/search?search=3b33bc0aa4b48ab779c5071c959c289264c9445e19ac485cf0734981e6ce%E2%80%8C). Would you have a link? (I don't find any transaction beginning with `3b33bc0aa4b48`... in Received transactions  of https://blockchain.info/address/3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs)
Basj
CC BY-SA 3.0
2018-01-05T14:45:29.287Z
2018-01-05T15:22:53.637Z
2018-01-05T15:22:53.637Z
Pieter Wuille
<p>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:</p>

<blockquote>
  <p>52410450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA641047747ECECEB2C6692D6CEAAF4A11ED9DB900741730C201F95B8A4EEF20D7DEE2CDEC2802C6EDC880BEE41E9D114A8708260D01AB107B5177DECB4E109C54792234104050DE465C62476FFAAB8AA4E47B9E4A01079E8A287E7B1316F0CAB29DC58C734228F2DAE7F1799FB0290ECF2EF08207C087A4CE98F1051443A6A5ABE60963A9353ae</p>
</blockquote>

<p>This redeemscript is then converted into a bitcoin address:</p>

<pre><code>1.) sha256 of the redeemscript:     8342fc1facef672c9b6c96b8dc79ac7ff2bfbb6babe444d6abf40597f19e12c5
2.) RipeMD160 of the redeemscript:  bc01acb41044f23a1eccaeb112e3a6021c3ab844
3.) base58 encoded -&gt; P2SH address: 3Jq6xxnjXbB5BxFLfLidWmaunKBBSstJYn
</code></pre>

<p>This is a "type 3" address based on a redeem script. </p>

<p>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):</p>

<pre><code>0 - Private ECDSA Key 
1 - Public ECDSA Key 
2 - SHA-256 hash of 1
</code></pre>

<p>and then follow these steps to create the final bitcoin address:</p>

<pre><code>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
</code></pre>

<p>This creates me the bitcoin address 1J963RJHygrh6nYuYF4369DydntTtG3YBy, and has the same RipeMD160 hash. </p>

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

CC BY-SA 3.0
2018-01-05T21:16:52.047Z
2018-01-05T21:16:52.047Z
pebwindkraft
<p>It seems that two addresses have same hash160 <code>69665e2c4fac771e340f8c6f91c719b0c37a6a8f</code>:</p>

<ul>
<li>here 0 BTC: <a href="https://blockchain.info/address/1AcJanbHGrBFwS3KJMDW8kEZMtHiJhatzE" rel="nofollow noreferrer">https://blockchain.info/address/1AcJanbHGrBFwS3KJMDW8kEZMtHiJhatzE</a></li>
<li>here 0.00720407 BTC: <a href="https://blockchain.info/address/3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs" rel="nofollow noreferrer">https://blockchain.info/address/3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs</a></li>
</ul>

<p><strong>How is this possible (it's probably not a collision, is it?)</strong></p>

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

<hash><ripemd160>
Two addresses with same hash160?
Basj
# Two addresses with same hash160?

(Asked by: username_0 on 2018-01-05)

It seems that two addresses have same hash160 `69665e2c4fac771e340f8c6f91c719b0c37a6a8f`:

* here 0 BTC: <https://blockchain.info/address/1AcJanbHGrBFwS3KJMDW8kEZMtHiJhatzE>
* here 0.00720407 BTC: <https://blockchain.info/address/3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs>

**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.

**Tags:** hash, ripemd160


---

## 2 answers

### Answer by username_1 on 2018-01-05. Score: 2 | Accepted answer

`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.

> **Comments:**
> **username_0**: 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)  
> **username_1**: 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.  
> **username_0**: Thanks. So the [3... address](https://blockchain.info/address/3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs) 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?  
> **username_1**: 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.  
> **username_0**: Thanks for your answer. https://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?  
> **username_1**: I looked at once of the transaction inputs that spend an output sent to 3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs (namely the 19th input of transaction 3b33bc0aa4b48ab779c5071c959c289264c9445e19ac485cf0734981e6ce11a1).  
> **username_0**: Thanks again! Note: I don't find transaction [`3b33bc0aa4b48ab779c5071c959c289264c9445e19ac485cf0734981e6ce‌`](https://blockchain.info/search?search=3b33bc0aa4b48ab779c5071c959c289264c9445e19ac485cf0734981e6ce%E2%80%8C). Would you have a link? (I don't find any transaction beginning with `3b33bc0aa4b48`... in Received transactions  of https://blockchain.info/address/3BJKWL5ipkVe2bjkRSt6ZNbVWQaRrEFjMs)  

---

### Answer by username_2 on 2018-01-05. Score: 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 ...


---

