I was looking thru Block explorer at an address with a balance. It has never been spent from thus the public key is unknown. If the public key is unknown, how can Block explorer calculate the hash160 of the public key?


Because an address is the Hash160 (=RIPEMD160(SHA256(x))) of the public key. The transaction output lists that 160-bit hash directly.

When redeeming such an output, you provide both the public key (which must hash to the value given in the output) and a signature (which must be valid for the given public key).

  • i'm used to seeing hash algos referred to as SHA256 or RIPEMD. what is Hash160? – joe Mar 8 '13 at 4:02
  • 1
    @joe Hash160 = RIPEMD160(SHA256(m)) (note that plain RIPEMD is a different, broken hash and bitcoin doesn't use it) – CodesInChaos Mar 8 '13 at 11:19
  • 3
    Edited. In Bitcoin-speak, Hash(x) = SHA256(SHA256(x)) and Hash160(x) = RIPEMD160(SHA256(x)). – Pieter Wuille Mar 10 '13 at 16:13
  • as a related question, what is really stored in a wallet in regards to keys? just the priv keys or priv keys and pub keys? i ask since the pub keys can be derived from the priv keys. – joe Mar 16 '13 at 15:43
  • The Public Key Hash is equivalent to the bitcoin address, without the Base58Check encoding. RIPEMD160(SHA256(PubK)) == Base58.decode(Address) ? – Haddar Macdasi Mar 24 '15 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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