<p>How could they give the same result? You do RIPEMD160(SHA256(pubkey)). Then you add zero byte 0x0 to this and perform double SHA256. You take the first four bytes and use them as s checksum which means they are control digits which help the wallet determine you didn't misstype the address.</p>

<p>Now you take this whole thing zero-byte+RIPEMD160(SHA256(pubkey))+checksum and you convert it to base58check. Note: zero byte will make the address always start with '1'.</p>

<p>When sender gets a bitcoin address, their wallet converts it from base58check to hex, checks the checksum and removes both the zero-byte and checksum to get RIPEMD160(SHA256(pubkey)). Then it proceeds with scriptPubKey verification.</p>

<p>That's why it is called Pay-to-public-key-hash. Bitcoin address is just a way of encoding a public key hash.</p>

CC BY-SA 3.0
2017-03-11T18:37:17.670Z
Thanks! This also means that there's no way to stop spending of funds in case of a public key- address collision, since it deals with ripemd160 part only. We can know that the public key was different after the transaction has taken place. Or am I missing something?
prof.Zoom
CC BY-SA 3.0
2017-03-14T18:58:21.377Z
I'm not sure I understand. Private key is used to derive only one public key. Public key is used to derive only one address. No collisions or weaknesses have been found in RIPEMD160. In case of btc, it would mean you need to first get SHA256 right to be able to use it for RIPEMD collision.
ManfredMacx
CC BY-SA 3.0
2017-03-18T05:25:48.270Z
Every private key has a unique public key. Every public key is then sha256'd to get a 256 bits hash. A digest of this hash is then created using ripemd 160. Now, for all of 2^256 unique sha256 to be unique we require a sample space of at least n. See: https://en.bitcoin.it/wiki/Secp256k1 which is a little less than 2^256. My question is, how can you create 2^256 unique digests using 2^160 bits of ripemd-160
prof.Zoom
CC BY-SA 3.0
2017-03-18T08:38:28.060Z
Ah. Well you can't. For each address there are 2^96 private keys. The collision doesn't happen because of good design of RIPEMD160.
ManfredMacx
CC BY-SA 3.0
2017-03-11T10:16:53.763Z
2017-03-11T10:16:53.763Z
ManfredMacx
<p>Pay to public key hash is used in version 1 bitcoin address. Bitcoin address is calculated by sha-256 -ing the public key followed by ripemd160- ing the result. The result can then be encoded in base 58 after 3 more steps as shown in <a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses</a> 
Version byte and address checksum are added to the ripemd which yeilds same result without them-</p>

<p>This: 
010966776006953D5567439E5E39F86A0D273BEE</p>

<p>And this:
00010966776006953D5567439E5E39F86A0D273BEED61967F6</p>

<p>Yeilds same result when encoded, then
Why is that done?</p>

<address-generation>
What is the significance of version byte and address checksum in version 1 Bitcoin address
prof.Zoom
# What is the significance of version byte and address checksum in version 1 Bitcoin address

(Asked by: username_0 on 2017-03-11)

Pay to public key hash is used in version 1 bitcoin address. Bitcoin address is calculated by sha-256 -ing the public key followed by ripemd160- ing the result. The result can then be encoded in base 58 after 3 more steps as shown in <https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses>
Version byte and address checksum are added to the ripemd which yeilds same result without them-

This:
010966776006953D5567439E5E39F86A0D273BEE

And this:
00010966776006953D5567439E5E39F86A0D273BEED61967F6

Yeilds same result when encoded, then
Why is that done?

**Tags:** address-generation


---

## 1 answers

### Answer by username_1 on 2017-03-11. Score: 1 | Accepted answer

How could they give the same result? You do RIPEMD160(SHA256(pubkey)). Then you add zero byte 0x0 to this and perform double SHA256. You take the first four bytes and use them as s checksum which means they are control digits which help the wallet determine you didn't misstype the address.

Now you take this whole thing zero-byte+RIPEMD160(SHA256(pubkey))+checksum and you convert it to base58check. Note: zero byte will make the address always start with '1'.

When sender gets a bitcoin address, their wallet converts it from base58check to hex, checks the checksum and removes both the zero-byte and checksum to get RIPEMD160(SHA256(pubkey)). Then it proceeds with scriptPubKey verification.

That's why it is called Pay-to-public-key-hash. Bitcoin address is just a way of encoding a public key hash.

> **Comments:**
> **username_0**: Thanks! This also means that there's no way to stop spending of funds in case of a public key- address collision, since it deals with ripemd160 part only. We can know that the public key was different after the transaction has taken place. Or am I missing something?  
> **username_1**: I'm not sure I understand. Private key is used to derive only one public key. Public key is used to derive only one address. No collisions or weaknesses have been found in RIPEMD160. In case of btc, it would mean you need to first get SHA256 right to be able to use it for RIPEMD collision.  
> **username_0**: Every private key has a unique public key. Every public key is then sha256'd to get a 256 bits hash. A digest of this hash is then created using ripemd 160. Now, for all of 2^256 unique sha256 to be unique we require a sample space of at least n. See: https://en.bitcoin.it/wiki/Secp256k1 which is a little less than 2^256. My question is, how can you create 2^256 unique digests using 2^160 bits of ripemd-160  
> **username_1**: Ah. Well you can't. For each address there are 2^96 private keys. The collision doesn't happen because of good design of RIPEMD160.  

---

