The Science of today is the technology of tomorrow . Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Latest Post

Search This Ntirawen

Bitcoin compressed and uncompressed addresses

Bitcoin (Un) Compresses Priv Pub Addresses



Bitcoin Private and Public Key

By now you should know that a randomly generated number is the private key and this key is used to calculate the public key which is a pair of integers (x,y)



There are 2 methods for using the private key to generate 2 different public keys and thus 2 different public addresses.


One method will generate a compresses public key (33 bytes) and the other an uncompressed public key (65 bytes).

Bitcoin Uncompressed Public Key

For Bitcoin uncompressed public keys the X and Y values, both 32 bytes long, are concatenated together, and then prepended with a single 0✕04 byte.



Bitcoin Compressed Public Key 

For Bitcoin compressed public keys a single 0✕02 or 0✕03 byte is prepended on the ✕ values. Which of these two single bytes is used depends on the Y value. Prepend 0✕02 if the Y value is even and 0✕03 if the Y value is odd. 




Bitcoin (Un) Compressed Public Addresses

Bitcoin uncompressed and compressed public keys result in different addresses, but they still come from the same private key.




Bitcoin (Un) Compressed Private Addresses

Usually a private key in WIF (Wallet Import Format) has different prefix to tell the wallet whether it should handle the key as one for a compress or an uncompressed address.



Bitcoin uncompressed private addresses begins with the character 5 and compresses private addresses begins with the character L or K.


Additional Information
  • If the compressed public address is needed the private key starts with K or L, if the uncompressed public address is needed the private key will start with 5.
  • Bitcoin clients can only receive coins on compressed addresses if they support compressed public keys in the first place.
  • The advantage of using compressed public keys is smaller transactions on the network and smaller blockchain sizes. A compressed public key has only 33 bytes instead of 65 bytes.
  • The standard Bitcoin client version 0.6 has introduced compressed keys.

No comments:

Post a Comment

Tags

Popular Posts