<p>What you refer to as 'Hash 160 Address' and which appear in <a href="https://blockchain.info/address/1GCqcweZTwwe1w2RMWwwQMKSFgQzgFZQUb" rel="noreferrer">this example</a> under the field 'Hash 160' (e.g. the hex number <code>a6c70c4a88205065c1d33b17c156137fa8c736c1</code>) is a 20 bytes hash of the public key (specifically, it is the ripemd160 hash of the sha256 hash of the public key). These 20 bytes are essentially the same thing as what you call the 'Public Bitcoin address' (e.g. <code>1GCqcweZTwwe1w2RMWwwQMKSFgQzgFZQUb</code> in our example). This bitcoin address is a 25 bytes number (usually displayed in Base58) which is linked to the hash 160 as follows:</p>

<pre><code>address = [Version Byte (1)][Hash 160 (20)][Checksum (4)]
</code></pre>

<p>The version byte is simply <code>0x00</code> for the main bitcoin network and the 4 checksum bytes are simply the first 4 bytes of the double sha256 hash of the 21 bytes <code>[Version Byte][Hash 160]</code></p>

<p>I attach a java snippet to illustrate some of the computations:</p>

<pre><code>import org.bitcoinj.core.Address;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Base58;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.params.MainNetParams;

class Test {
  public static void main(String[] args)
  {
    String  str = "1GCqcweZTwwe1w2RMWwwQMKSFgQzgFZQUb";

    NetworkParameters main = MainNetParams.get();

    // The string address is just a number expressed in base 58
    // Let us parse this string and see the bytes of the underlying number
    // 0:
    // -90:-57:12:74:-120:32:80:101:-63:-45:59:23:-63:86:19:127:-88:-57:54:-63:
    // -86:-114:24:124:
    byte[] full = Base58.decode(str);
    for(int i = 0; i &lt; full.length; ++i){
      System.out.print(full[i]+ ":");
    }

    // Let us compute the hash 160 of the address
    //-90:-57:12:74:-120:32:80:101:-63:-45:59:23:-63:86:19:127:-88:-57:54:-63:
    // These are the same 20 bytes as before
    Address addr = Address.fromBase58(main, str);
    System.out.print("\n");
    byte[] hash = addr.getHash160();
    for(int i = 0; i &lt; hash.length; ++i){
      System.out.print(hash[i]+ ":");
    }

    // Let us see the first 21 bytes of the address
    // 0:-90:-57:12:74:-120:32:80:101:-63:-45:59:23:-63:86:19:127:-88:-57:54:-63:
    byte[] decode = Base58.decodeChecked(str);
    System.out.print("\n");
    for(int i = 0; i &lt; decode.length; ++i){
      System.out.print(decode[i]+ ":");
    }

    // Let us compute the double sha256 hash of the first 21 bytes of the address
    // and display the first 4 bytes: -86:-114:24:124:
    // These first 4 bytes are exactly the last 4 bytes of the address above 
    byte[] check = Sha256Hash.hashTwice(decode);
    System.out.print("\n");
    for(int i = 0; i &lt; 4; ++i){
      System.out.print(check[i]+ ":");
    }
  }
}
</code></pre>

CC BY-SA 3.0
2017-01-19T18:44:31.737Z
Thanks Sven, that's clear and understand the differences now.  

Can you tell me why both are needed?  

Also, are both transmitted in the transaction or is one just being calculated and displayed by the website I took the screenshot from?
monkia
CC BY-SA 3.0
2017-01-19T21:54:40.880Z
The two things represent the same number, but they are both useful because on the one hand dealing with a bitcoin address gives us the security of having an embedded 4 bytes checksum (so we don't transfer money by mistake to something that isn't a valid address), and on the other hand, dealing with the Hash 160 only (20 bytes) is more efficient for the purpose of encoding a transaction. If you look at the actual bytes of a transaction encoding (with this address as output), you'll see that the 20 bytes of the hash 160 appear near the end (e.g. `bitcoin-cli getrawtransaction <txid>`)
Sven Williamson
CC BY-SA 3.0
2017-01-19T22:11:21.997Z
Note that the leading version byte added to the address is also useful to prevent someone mistakenly transferring real money while attempting to test functionality on a bitcoin testing network.
Sven Williamson
CC BY-SA 3.0
2017-01-19T14:29:33.863Z
2017-01-19T14:29:33.863Z
Sven Williamson
<p>I know the difference Public Key and the Public Bitcoin Address (hashed version) and why.  But I dont understand why there is a Public Bitcoin Address and Hash 160 Address?</p>

<p>I assume the Hash 160 Address is just another hash of the Public Bitcoin Address?  </p>

<p>Can you tell me what exactly the Hash 160 Address is and more important, why it is needed?</p>

<p>Thanks!</p>

<p><a href="https://i.sstatic.net/niDj8.png" rel="noreferrer"><img src="https://i.sstatic.net/niDj8.png" alt="enter image description here"></a></p>

<blockchain>
Difference between Public Bitcoin Address and Hash 160 Address?
monkia
# Difference between Public Bitcoin Address and Hash 160 Address?

(Asked by: username_0 on 2017-01-19)

I know the difference Public Key and the Public Bitcoin Address (hashed version) and why. But I dont understand why there is a Public Bitcoin Address and Hash 160 Address?

I assume the Hash 160 Address is just another hash of the Public Bitcoin Address?

Can you tell me what exactly the Hash 160 Address is and more important, why it is needed?

Thanks!

[![enter image description here](https://i.sstatic.net/niDj8.png)](https://i.sstatic.net/niDj8.png)

**Tags:** blockchain


---

## 1 answers

### Answer by username_1 on 2017-01-19. Score: 9

What you refer to as 'Hash 160 Address' and which appear in [this example](https://blockchain.info/address/1GCqcweZTwwe1w2RMWwwQMKSFgQzgFZQUb) under the field 'Hash 160' (e.g. the hex number `a6c70c4a88205065c1d33b17c156137fa8c736c1`) is a 20 bytes hash of the public key (specifically, it is the ripemd160 hash of the sha256 hash of the public key). These 20 bytes are essentially the same thing as what you call the 'Public Bitcoin address' (e.g. `1GCqcweZTwwe1w2RMWwwQMKSFgQzgFZQUb` in our example). This bitcoin address is a 25 bytes number (usually displayed in Base58) which is linked to the hash 160 as follows:

```
address = [Version Byte (1)][Hash 160 (20)][Checksum (4)]

```

The version byte is simply `0x00` for the main bitcoin network and the 4 checksum bytes are simply the first 4 bytes of the double sha256 hash of the 21 bytes `[Version Byte][Hash 160]`

I attach a java snippet to illustrate some of the computations:

```
import org.bitcoinj.core.Address;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Base58;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.params.MainNetParams;

class Test {
  public static void main(String[] args)
  {
    String  str = "1GCqcweZTwwe1w2RMWwwQMKSFgQzgFZQUb";

    NetworkParameters main = MainNetParams.get();

    // The string address is just a number expressed in base 58
    // Let us parse this string and see the bytes of the underlying number
    // 0:
    // -90:-57:12:74:-120:32:80:101:-63:-45:59:23:-63:86:19:127:-88:-57:54:-63:
    // -86:-114:24:124:
    byte[] full = Base58.decode(str);
    for(int i = 0; i < full.length; ++i){
      System.out.print(full[i]+ ":");
    }

    // Let us compute the hash 160 of the address
    //-90:-57:12:74:-120:32:80:101:-63:-45:59:23:-63:86:19:127:-88:-57:54:-63:
    // These are the same 20 bytes as before
    Address addr = Address.fromBase58(main, str);
    System.out.print("\n");
    byte[] hash = addr.getHash160();
    for(int i = 0; i < hash.length; ++i){
      System.out.print(hash[i]+ ":");
    }

    // Let us see the first 21 bytes of the address
    // 0:-90:-57:12:74:-120:32:80:101:-63:-45:59:23:-63:86:19:127:-88:-57:54:-63:
    byte[] decode = Base58.decodeChecked(str);
    System.out.print("\n");
    for(int i = 0; i < decode.length; ++i){
      System.out.print(decode[i]+ ":");
    }

    // Let us compute the double sha256 hash of the first 21 bytes of the address
    // and display the first 4 bytes: -86:-114:24:124:
    // These first 4 bytes are exactly the last 4 bytes of the address above 
    byte[] check = Sha256Hash.hashTwice(decode);
    System.out.print("\n");
    for(int i = 0; i < 4; ++i){
      System.out.print(check[i]+ ":");
    }
  }
}

```

> **Comments:**
> **username_0**: Thanks username_1, that's clear and understand the differences now.    Can you tell me why both are needed?    Also, are both transmitted in the transaction or is one just being calculated and displayed by the website I took the screenshot from?  
> **username_1**: The two things represent the same number, but they are both useful because on the one hand dealing with a bitcoin address gives us the security of having an embedded 4 bytes checksum (so we don't transfer money by mistake to something that isn't a valid address), and on the other hand, dealing with the Hash 160 only (20 bytes) is more efficient for the purpose of encoding a transaction. If you look at the actual bytes of a transaction encoding (with this address as output), you'll see that the 20 bytes of the hash 160 appear near the end (e.g. `bitcoin-cli getrawtransaction <txid>`)  
> **username_1**: Note that the leading version byte added to the address is also useful to prevent someone mistakenly transferring real money while attempting to test functionality on a bitcoin testing network.  

---

