The SCRIPT in the transaction is:

DUP HASH160 PUSHDATA(20)[482f0027662731277fdfa3b7f639c976a3bab11e] EQUALVERIFY CHECKSIG

What is 482f0027662731277fdfa3b7f639c976a3bab11e ?

It is not a pubKey. RIPEMD160(SHA256(482f0027662731277fdfa3b7f639c976a3bab11e)=146sN8tLxV2xueQXQgMJkMZi2hFazEuV8F.

The result is not the address(17afxUJouat3fkaaQ9tZrDThxdkXGL4WrM) in the blockchain.info either.

How we convert the 482f0027662731277fdfa3b7f639c976a3bab11e to it's addr?


482f0027662731277fdfa3b7f639c976a3bab11e is HASH160 (RIPEMD160(SHA256())) of the public key. The hash is the most important part of addresses (addres: network byte + hash + checksum).

You can look at how P2PKH script works step-by-step here.

| improve this answer | |
  • what you mean "It"? The address 17afxUJouat3fkaaQ9tZrDThxdkXGL4WrM? – Carpemer Sep 6 '18 at 14:51
  • @Capemer I have edited it. – MCCCS Sep 6 '18 at 15:23

I gusses the command decoderawtransacton can help you

| improve this answer | |
  • Hi @老板鱼丸粗面, can you provide some more context, maybe some documentation, an example output and how to run the command? Short answers often don't provide enough context to be helpful. – JBaczuk Sep 7 '18 at 16:54
  • The question here is how to convert 482f0027662731277fdfa3b7f639c976a3bab11e to it's address 146sN8tLxV2xueQXQgMJkMZi2hFazEuV8F – Carpemer Sep 8 '18 at 0:17

Thanks for the answer here, the final code for the question is:

import hashlib
import base58 

def gen_addr(hash_code):
  key_hash = '00' + hash_code
  # Obtain signature:
  sha = hashlib.sha256()
  sha.update( bytearray.fromhex(key_hash) )
  checksum = sha.digest()
  sha = hashlib.sha256()
  checksum = sha.hexdigest()[0:8]
  address = (base58.b58encode( bytes(bytearray.fromhex(key_hash + checksum)))).decode('utf-8')
  return address, key_hash, checksum


| improve this answer | |

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.