Social Icons

Monday, April 02, 2018

Bitcoin Address Generation : The Internals Behind

ECDSA stands for Elliptic Curve Digital Signature Algorithm and uses an elliptic curve and a finite field to "sign" data in such a way that third parties can verify the authenticity of the signature while the signer retains the exclusive ability to create the signature. The Bitcoin addressing system is not a simple deal.In order to maintain that a public key cannot be deciphered easily to any identity and in future if ECDSA is compromised at all, still,the anonymity remains.So suppose you have a ECDSA based private key,the following post content will give a step by step sequence of how the final bitcoin address is derived :
Sequence flow chart is shown below :

Image courtesy : https://www.safaribooksonline.com/library/view/mastering-bitcoin-2nd/9781491954379/assets/mbc2_0405.png

Your sample private key :

18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

Public key derived is 

0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2
3522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582
BA6

Site reference : https://www.bitaddress.org

Screen shot below : 

 Now perform SHA-256 hashing on the hex of the public key as shown below in the screenshot :

The SHA-256 output received is 

600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408

Now we take RIPEMD-160 Hash of the above output and get this as follows as seen vide the screenshot :

010966776006953d5567439e5e39f86a0d273bee

Now add Add version byte in front of RIPEMD-160 hash (0x00 for Main Network).so that the above output becomes :


00010966776006953D5567439E5E39F86A0D273BEE

Further to above,Perform SHA-256 hash on the extended RIPEMD-160 result ie

 
 so we get
445c7a8007a93d8733188288bb320a8fe2debd2ae1b47f0f50bc10bae845c094

and now we perform SHA-256 hash on the result of the this recent SHA-256 hash as seen below in the screenshot...and we get this as 

d61967f63c7dd183914a4ae452c9f6ad5d462ce3d277798075b107615c1a8a30


Now take the first 4 bytes of the second SHA-256 hash and this is the address checksum ie D61967F6

and then add the 4 checksum bytes at the end of extended RIPEMD-160 hash as hashed above and we get the 25-byte binary Bitcoin Address.

00010966776006953D5567439E5E39F86A0D273BEED61967F6

Now the last step...we  Convert the result from a byte string into a base58 string using Base58Check encoding at https://incoherency.co.uk/base58/

 Bitcoin Address : 
16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM

Useful links : 

Powered By Blogger