Key Takeaways:
- Bitcoin addresses can be compressed or uncompressed, depending on the type of public key they are derived from
- Compressed Bitcoin addresses are smaller and more efficient for transactions
- To identify the compression type of a Bitcoin address, you need to analyze the prefix of the encoded public key
How to Know if a Bitcoin Address is Compressed or Uncompressed?
A Bitcoin address is always derived from a public key, which is derived from a private key.
In this process, the private key gives two outputs for the public key, a compressed and an uncompressed version.
A public key is a mathematical value on an elliptic curve, while a private key is a randomly generated 256-bit number. The public key always comes with a pair of integers, the x and y value, both 32 bytes long.
This value describes a certain point on the elliptic curve used by the ECDSA algorithm. An Uncompressed public key comes with both values concatenated and pre-pended with the prefix ‘0x04’. This key is 65 bytes long.
The compressed version takes the x-value only and pre-pends either a ‘0x02’ or ‘0x03’ to the value, resulting in a size of 33 bytes. When a Bitcoin address is generated, it derives from the public key using a SHA256 hash algorithm.
It then encodes the result with Bech32 or Base58 encoding into a final address format, which doesn’t have any specific prefix depending on the compression used before. The final address always starts with a ‘1’, ‘3’ or ‘bc1’, no matter the compression.
Compressed addresses are smaller than uncompressed addresses. The ‘0x02’ prefix shows that the y-coordinate of the public key is even, while the ‘0x03’ prefix shows that the y-coordinate is odd.
It is important to note that a compressed and uncompressed public key is just derived from the private key. The private key really matters, as it is used to sign transactions and prove ownership of Bitcoin.
Both versions point to the same private key, so they both act as the same location used to transfer bitcoin.
The Difference Between Compressed and Uncompressed Addresses
If we look at the Bitcoin addresses we use with prefixes like ‘1’, ‘3’ or ‘bc1’, we won’t see if they are compressed or uncompressed.
We have to look at the addresses of the public keys from which the final wallet address derives.
These keys are formatted distinctly, allowing us to differentiate between the type of compression used. When a public key is compressed, its hex string starts with either ‘0x02’ or ‘0x03’.
These two prefixes show that the public key is compressed, comprising the ECDSA x-coordinate only. If a public key is uncompressed, its hex string starts with ‘0x04’.
This prefix shows that the public key is uncompressed, and it comprises both integer coordinates x and y of the public key. This means that the uncompressed public key contains more information, as it includes both the x and y coordinates.
This amounts to 64 bytes for both values plus 1 byte for the prefix, resulting in 65 bytes. The compressed version has only half the amount of 32 bytes, plus also 1 byte for their prefix, summed to 33 bytes.
The compression of public keys is used to reduce the size of transactions and improve their efficiency. Compressed public keys take up less space in the blockchain, which reduces transaction fees and speeds up the transaction process.
However, it is important to note that not all Bitcoin wallets and clients support compressed public keys. A wallet has to support compressed keys in order to use them.
Today, wallets typically use the compressed version, so this question should only arise if you set up everything by yourself running a full node. It is important to keep your private key secure, as it is used to generate your public key and the address.
How to Use for Compressed and Uncompressed Wallet Addresses?
For using compressed and uncompressed wallet addresses, there are some factors to pay attention to that can help ensure the security of your transactions.
First, it is important to understand the differences between the two types of addresses.
Compressed addresses are smaller and more efficient for transactions, while uncompressed addresses are more widely supported by wallets and Bitcoin clients.
We derive compressed addresses from a compressed public key, which is 33 bytes long, while we derive uncompressed addresses from an uncompressed public key, which is 65 bytes long and starts with “0x04” in hexadecimal format.
Regardless of the type of address you choose, it is important to use a cryptographic random number generator to generate a private key. This helps ensure attackers can not easily guess the private key.
The private key is then used to compute the corresponding public key, which is used in Bitcoin transactions. When sending Bitcoin, it is important to use the correct type of compressed address for the recipient.
Changing the compression afterwards could lead to potential loss of bitcoins stored there. It is important to keep your private key secure and not share it with anyone. Public addresses can be freely shared, as they do not reveal any sensitive information.
It is also important to note that each private key corresponds to a unique wallet address, and that different private keys will generate unique addresses.
If you have imported a private key or generated a new one, be sure to use the correct corresponding public address when sending Bitcoin.
How Are Bitcoin Addresses Encoded?
The Bech32 encoding scheme encodes Bitcoin addresses.
This applies to the newer addresses (SegWit and Taproot) as the legacy formats were encoded in Base58.
The Base58 encoding scheme uses lower- and uppercase letters and an additional 4-byte checksum with the Base58Check. P2PKH addresses were pre-pended with an ‘1’ and P2SH addresses were pre-pended with an ‘3’.
The newer addresses use the Bech32 encoding without case lettering and an additional error checking for further security, making it less prone to typing errors.
Base58 is like Base64 encoding, but it excludes certain characters that can be easily mistaken for one another, such as 0 and O or l and I.
Base58 is commonly used for addresses and private keys because it is more compact and easier to read than other encoding schemes. Bech32 is a newer encoding scheme used for encoding Bitcoin wallet addresses.
It is a native SegWit address format and more efficient than the previous Base58 format. Bech32 addresses start with “bc1” and use a unique set of characters compared to Base58.
Bech32 addresses also include error detection, so it is easier to detect and correct errors in the address. Overall, the crucial difference between Base58 and Bech32 is their efficiency and error detection capabilities.
Finally, Bech32 addresses are more easily readable and less prone to errors than Base58 addresses, which can be important for ease of use and security.
FAQ
What is a Compressed Bitcoin Address?
A compressed Bitcoin wallet address is the public key that has been compressed in order to save space and make it more efficient to work with.
Compressed public keys are shorter than regular ones, which makes them easier to store and use.
The major advantage of a compressed Bitcoin public key is that it allows users to save money on transaction costs by using smaller amounts of data when sending or receiving payments.
Also uncompressed addresses are always supported, which makes them more compatible. Since most software now also uses the compressed version, this advantage is not a deciding factor anymore.
How Do I Convert a Compressed BTC Public Key to Uncompressed?
It is possible to convert a compressed BTC public key to an uncompressed one, using specific tools or converting it manually.
To convert a compressed public key to an uncompressed one, you need to perform a point multiplication with the generator point of the elliptic curve. This requires some deeper knowledge so most people would rather use an online tool for converting.
However, there is no need to convert a compressed public key to an uncompressed one, as we can interchange both types of keys in most cases.
Some older Bitcoin software may not support compressed public keys, but modern wallets and software can handle both compressed and uncompressed keys without issue.
What Are the Two Types of Bitcoin Addresses?
You can divide the Bitcoin wallet address either in the SegWit and Legacy formats or you can divide their corresponding public keys into compressed or uncompressed ones.
Depending on how you ask, there are multiple categorizations possible.
SegWit and Legacy formats provide distinct features. The older Legacy formats have case sensitivity and fewer features, making them less efficient and more costly. SegWit formats support advanced features such as multisig and lower fees.
In terms of public keys, the compressed or the uncompressed ones derive from the same private key but differ in size. Compressed ones are 33 bytes and uncompressed ones are 65 bytes. This makes the compressed version smaller and therefore cheaper to transfer.
What is a Compressed vs. Uncompressed Public Key?
Two public keys always derive from the same private key, a compressed and an uncompressed one.
An Uncompressed public key includes both values concatenated and pre-pended with the prefix ‘0x04’.
These keys are 65 bytes long. Their compressed counterpart always comes with just one value pre-pended either a ‘0x02’ or ‘0x03’ to the value, resulting in a size of 33 bytes.
Their major difference is that the compression of public keys is used to reduce their size. They take up less space in the blockchain, which reduces their fees and allows for faster transaction processes because of their smaller size.
Conclusion: Bitcoin Address is Compressed vs. Uncompressed
Bitcoin public addresses can be compressed or uncompressed, and knowing the difference between the two is important for using Bitcoin securely.
Compressed addresses are smaller and more efficient for transactions, while uncompressed addresses are more widely supported by wallets and Bitcoin clients.
To identify whether a Bitcoin wallet address is compressed or uncompressed, you need to analyze the prefix of the encoded public key.
An uncompressed public key comes with the prefix ‘0x04’ while the compressed version is pre-pended either with a ‘0x02’ or ‘0x03’.
While most crypto wallets and clients support both types of addresses, some may only support one type, but this will most likely be the case if you set up your own wallet. Today’s wallets support both formats.