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?


enter image description here

1 Answer 1


What you refer to as 'Hash 160 Address' and which appear in this example 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
    // These are the same 20 bytes as before
    Address addr = Address.fromBase58(main, str);
    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);
    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);
    for(int i = 0; i < 4; ++i){
      System.out.print(check[i]+ ":");
  • 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
    Jan 19, 2017 at 18:44
  • 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>) Jan 19, 2017 at 21:54
  • 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. Jan 19, 2017 at 22:11
  • is there any php library ?
    – user10603
    Oct 11, 2017 at 8:47

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