How to generate Bitcoin address

+1 vote

I am going through https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses to know how to generate Bitcoin address.

The steps mentioned there are:

0 - Having a private ECDSA key

18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

1 - Take the corresponding public key generated with it

0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

2 - Perform SHA-256 hashing on the public key

600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

But when I run SHA-156 on the generated key, I get the following output which is wrong:

32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce

What is the problem?

Aug 20, 2018 in Blockchain by digger
• 26,740 points
1,077 views

1 answer to this question.

0 votes

Convert the hex string back to bytes and sha256 the bytes.

You can do it like this:

>>> hex_string = ('0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6')

>>> hex_data = hex_string.decode('hex')

>>> hashlib.sha256(hex_data).hexdigest()

'600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408'
answered Aug 20, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

+1 vote
0 answers

How to generate bitcoin address from XPUB

How to generate bitcoin addresses from XPUB ...READ MORE

Mar 9, 2022 in Blockchain by Soham
• 9,710 points
1,606 views
0 votes
1 answer

How to extract h160 address of bitcoin blockchain?

You can extract the data using the ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,740 points
2,505 views
0 votes
1 answer

How to generate new address for blockchain wallet?

You can use the following to generate ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,740 points
3,234 views
+3 votes
3 answers

How to validate bitcoin address?

I found these 2 scripts online: Javascript: <html> <head> <script type="text/javascript" ...READ MORE

answered Aug 17, 2018 in Blockchain by slayer
• 29,370 points
6,342 views
+1 vote
1 answer

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

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,319 views
0 votes
1 answer

Getting Bitcoin address from pubkey_hash

The unexpected result is due to encoding. For ...READ MORE

answered Aug 22, 2018 in Blockchain by digger
• 26,740 points
1,145 views
+1 vote
1 answer
0 votes
1 answer

How to generate Bitcoin address in Ruby?

In your generate_address_from_public_key_hash method, the checksum should be over ...READ MORE

answered Aug 22, 2018 in Blockchain by slayer
• 29,370 points
2,552 views
0 votes
1 answer

How to generate coin address using bitcoin-ruby?

The only difference between the addresses is ...READ MORE

answered Aug 29, 2018 in Blockchain by slayer
• 29,370 points
713 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP