How to generate Bitcoin address?

0 votes

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,550 points
74 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,170 points

Related Questions In Blockchain

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,550 points
145 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,550 points
101 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,170 points
880 views
0 votes
2 answers

How to check if bitcoin address is valid?

For Java, have a look at the ...READ MORE

answered Aug 20, 2018 in Blockchain by Omkar
• 67,620 points
341 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,340 points
80 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,550 points
95 views
0 votes
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,170 points
878 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,170 points
62 views