Getting Bitcoin address from pubkey_hash

0 votes

I want to get Bitcoin address from pubkey_hash. I am using the following code:

import util

hash = '62E907B15CBF27D5425399EBF6F0FB50EBB88F18'

print util.hash_to_address("00", hash)

Expected result:

1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

Current result:

6GEZdxx5UiTk3U3LaLfsWwRaFAvXEpPNS5R4mqsJDXVJcTNNngTyB5i9S76MLTq

Need help.

Aug 22, 2018 in Blockchain by slayer
• 29,040 points
60 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The unexpected result is due to encoding.

For Python 2

import util

hash = '62e907b15cbf27d5425399ebf6f0fb50ebb88f18'

print util.hash_to_address("00".decode('hex'), hash.decode('hex'))

For Python 3

import util

import binascii

hash = '62e907b15cbf27d5425399ebf6f0fb50ebb88f18'

print util.hash_to_address(binascii.unhexlify("00"), binascii.unhexlify(hash))

This will work.

answered Aug 22, 2018 by digger
• 27,620 points

Related Questions In Blockchain

0 votes
1 answer

Is there a way to send funds from a specific bitcoin address in a wallet?

I'll answer my own question, It was unbelievably ...READ MORE

answered Sep 3, 2018 in Blockchain by Perry
• 16,450 points
39 views
0 votes
1 answer

How can I retrieve to and from address in transaction directly from blockchain?

The spending conditions, i.e., who is able ...READ MORE

answered Jul 11, 2018 in Blockchain by Shashank
• 10,330 points
46 views
0 votes
1 answer

How are unique public address generated in bitcoin?

In brief, the public addresses are generated ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,040 points
30 views
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,320 points
42 views
0 votes
1 answer

How to generate Bitcoin address?

Convert the hex string back to bytes ...READ MORE

answered Aug 20, 2018 in Blockchain by slayer
• 29,040 points
47 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

What is blockchain apart from bitcoin?

Blockchain is a decentralized database where the ...READ MORE

answered Jul 9, 2018 in Blockchain by digger
• 27,620 points
11 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.