Author

Topic: compressed private key (Read 200 times)

legendary
Activity: 1064
Merit: 1298
Lightning network is good with small amount of BTC
January 30, 2024, 06:08:19 AM
#14
random 256-bit number Using elliptic curve mathematics, a public key is derived from the private key. uncompressed public key is 64 bytes (32 bytes for the x-coordinate and 32 bytes for the y-coordinate). Compression involves representing the y-coordinate in a shorter format, typically by including only the x-coordinate and a single bit indicating
This is off-topic. No one is asking of the difference between normal private key and the compressed private key. The question asked is about how he can spend using the compressed private key and nothing else. You are somehow new. Read the OP very well next time. Also read what other people have posted before posting.
legendary
Activity: 4466
Merit: 3391
January 31, 2024, 02:43:06 AM
#13
The term "compressed private key" is a misnomer. A "compressed" private key is not compressed as the name states. It is actually the public key that is compressed (by removing unnecessary information).

Instead, a compressed private key is just a private key with additional data that tells the wallet to use the compressed public key to generate the address.

An uncompressed private key does not have that extra data, so the wallet knows to use the uncompressed public key.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
January 29, 2024, 12:12:48 AM
#12
wow...

so this means that i will have access to both public adress , one via the compromised priv key and one with the uncompromised, which means that i will 100% access my coins no matter what?

im so sorry i feel so dumb
Please do not "compress" or "uncompress" your private keys. Your wallet should already define what kind of keys it is by generating the appropriate private keys and you should not do anything beyond simply importing it. Converting it between various formats could potentially result in the loss of funds. For example, using uncompressed public keys for bech32 results in a non-standard address.

If you want to have a different address, generate a new key using a wallet and don't do any conversions.
hero member
Activity: 714
Merit: 1010
Crypto Swap Exchange
January 28, 2024, 06:39:54 PM
#11
Yes, you can have access to funds sent to the "uncompressed" public  address and the "compressed" one. You could even have access to the corresponding nested segwit address 3... or the native segwit address (type 0) bc1q... if necessary.

A clear warning from my side: when you handle unprotected private key data, it is imperative and mandatory to know what you're doing and doing it only in a secure computer environment which should ideally be and stay air-gapped (a disposable OS instance like a Live Linux that runs only in RAM and has no network connection whatsoever should be fine as this shouldn't leave any data traces behind after you shutdown it).

Improper security and not verifying the authenticity of your tools can lead to stolen keys and funds. Don't be reckless!

There's no need to feel sorry or dumb, you have learned something today and Bitcoin knowledge doesn't come on its own.
Stay curious and learn!
copper member
Activity: 17
Merit: 5
January 28, 2024, 05:36:30 PM
#10
so what i have read is that if it starts with L its compressed so i need to uncompress it.

If i uncompress it will it work 100% and i have access to the bitcoins or not?

A private key is simply a stream of 256 random bits and both an uncompressed private key WIF and a compressed private key WIF represent the very same sequence of 256 bits.

Take e.g. this (definitely not random at all) private key in hex form:
0000000000000000000000000000000000000000000000000000000000000001

For this bit sequence the uncompressed WIF representation is:
5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
and the compressed WIF representation is:
KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

Note that the "compressed" WIF is actually 1 char longer than the uncompressed WIF. That's not something you'd normally associate with "compressed", isn't it funny?

From such a private key you can derive by elliptic curve magic a public key which you can have in an uncompressed form and a compressed form. From above example private key we get
uncompressed (130 chars):
0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798483ADA7726A3C 4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
compressed (66 chars):
0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798

From each public key you can derive a legacy public address...
uncompressed: 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
  compressed: 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH

With your own particular private key it simply depends to which public address your funds have been sent. If necessary, it is possible to convert a compressed private key WIF to the uncompressed WIF form in a secure air-gapped computer environment. There are different tools available for this. I did above example with the verified code from https://github.com/pointbiz/bitaddress.org.

As Charles-Tim already pointed out, you can import a WIF into Electrum (use p2pkh: to import for legacy addresses), both compressed or uncompressed, whatever you need in particular.


wow...

so this means that i will have access to both public adress , one via the compromised priv key and one with the uncompromised, which means that i will 100% access my coins no matter what?

im so sorry i feel so dumb
hero member
Activity: 714
Merit: 1010
Crypto Swap Exchange
January 28, 2024, 05:08:10 PM
#9
so what i have read is that if it starts with L its compressed so i need to uncompress it.

If i uncompress it will it work 100% and i have access to the bitcoins or not?

A private key is simply a stream of 256 random bits and both an uncompressed private key WIF and a compressed private key WIF represent the very same sequence of 256 bits.

Take e.g. this (definitely not random at all) private key in hex form:
0000000000000000000000000000000000000000000000000000000000000001

For this bit sequence the uncompressed WIF representation is:
5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
and the compressed WIF representation is:
KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

Note that the "compressed" WIF is actually 1 char longer than the uncompressed WIF. That's not something you'd normally associate with "compressed", isn't it funny?

From such a private key you can derive by elliptic curve magic a public key which you can have in an uncompressed form and a compressed form. From above example private key we get
uncompressed (130 chars):
0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798483ADA7726A3C 4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
compressed (66 chars):
0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798

From each public key you can derive a legacy public address...
uncompressed: 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
  compressed: 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH

With your own particular private key it simply depends to which public address your funds have been sent. If necessary, it is possible to convert a compressed private key WIF to the uncompressed WIF form in a secure air-gapped computer environment. There are different tools available for this. I did above example with the verified code from https://github.com/pointbiz/bitaddress.org.

As Charles-Tim already pointed out, you can import a WIF into Electrum (use p2pkh: to import for legacy addresses), both compressed or uncompressed, whatever you need in particular.
legendary
Activity: 2380
Merit: 5213
January 28, 2024, 04:57:39 PM
#8
Because i have read that some users imported compressed private keys to electrum and the pub adress was a completely different one.
Compressed and uncompressed formats of your private key would generate different addresses.
Most probably, you don't need to derive the uncompressed format of your private key. It's not common to use uncompressed private keys and the address you are looking for is probably derived from the compressed private key.


if i import the private key on an offline device with electrum installed,  it will instantly confirm if the private key is valid to the belonging pub adress?
If you import your private key into electrum, you will see the derived address and you can check if that's correct.
If the address is correct, it means that you have the correct private key.
copper member
Activity: 17
Merit: 5
January 28, 2024, 04:44:43 PM
#7
thank you

is there any other way to check if the private key is valid to the pub adress without signing a transaction?
legendary
Activity: 1512
Merit: 4795
Leading Crypto Sports Betting & Casino Platform
January 28, 2024, 04:42:20 PM
#6
if i import the private key on an offline device with electrum installed,  it will instantly confirm if the private key is valid to the belonging pub adress?
On offline Electum, it will not synchronized with the blockchain and you will not see your coins. You know that you have coins there, you can see it through the watch-only wallet which is online and which you can use to create an unsigned transaction, send it to the offline Electum through QR code or USB stick. The offline Electum will only be used for signing the unsigned transaction and you will send the signed transaction back to the watch-only wallet to broadcast it.

This guide is for mobile Electrum but it would be of help if you use QR code for unsigned and signed transaction transfer:

Okay, here's the procedure to create a cold-storage mobile Electrum wallet:
  • 1. Install Electrum on both devices, and create a standard wallet on the "cold storage" device, that will be your main wallet that contains all the keys and shouldn't be connected to the internet even once (a newly formatted device/new device is better).
    Make sure that the seed was saved in a physical backup like a piece of paper.
  • 2. Click the wallet's name on top of the screen and click "Master Public key" twice to open the QR code.
  • 3. On the online phone, create a new wallet using the option "Standard Wallet->Use a master key", then click the camera icon to scan the cold-storage wallet's QR code.
    This will create a watch-only wallet version of your cold-storage wallet.
  • 4. Confirm if the address in the receive tab is the same.

Now to use those wallets:
  • You just have to create a transaction using the online watch-only wallet using the send tab.
  • Fill out the recipient, amount, etc. then, click pay (select if you want to opt-in RBF, yes) and click the QR code icon below.
  • In the cold-storage wallet, go to send tab and click the camera icon on the right side and scan the other device's QR code.
  • The transaction will be imported to the cold-storage wallet, now click option->sign (enter your pin) and it will be marked as "signed" above.
  • Click the QR code icon, then scan this using your online watch-only wallet and the signed transaction will be imported and now you can use options->broadcast button to send it to the network.

If you're not familiar with Electrum's defaut bitcoin denomination, you can change it from mBTC to BTC in the settings->denomination.
copper member
Activity: 17
Merit: 5
January 28, 2024, 04:35:58 PM
#5
thank you

if i import the private key on an offline device with electrum installed,  it will instantly confirm if the private key is valid to the belonging pub adress?
legendary
Activity: 1512
Merit: 4795
Leading Crypto Sports Betting & Casino Platform
January 28, 2024, 04:07:31 PM
#4
i havent tried it yet, but electrum supports compressed private keys?

Because i have read that some users imported compressed private keys to electrum and the pub adress was a completely different one.

unfortunately im not home so i cant test.
I have given you the information that you need. You can import it. It would work.

If it is huge amount of money, you can import it on wallet on an airgapped device and use watch-only wallet to create unsigned transaction and use the wallet on the airgapped device to sign.

https://electrum.readthedocs.io/en/latest/coldstorage.html
copper member
Activity: 17
Merit: 5
January 28, 2024, 04:01:51 PM
#3
i havent tried it yet, but electrum supports compressed private keys?

Because i have read that some users imported compressed private keys to electrum and the pub adress was a completely different one.

unfortunately im not home so i cant test.
legendary
Activity: 1512
Merit: 4795
Leading Crypto Sports Betting & Casino Platform
January 28, 2024, 03:58:10 PM
#2
Import the private key into wallet like Electrum and you will be able to access your coin and spend it. Compressed private key can start from K or L and they are wallet import formats (WIF).

Uncompressed private keys start from 5 and they are also WIF.
copper member
Activity: 17
Merit: 5
January 28, 2024, 03:54:06 PM
#1
hey,


i have following issue

i have a privat key which starts with L ( its from 2014 ) and i took the private key from the blockchain.com wallet ( previously info )

so what i have read is that if it starts with L its compressed so i need to uncompress it.

If i uncompress it will it work 100% and i have access to the bitcoins or not?



could someone elaborate the steps how to uncompress it?

im just afraid because i have read that private key is linked to 2 public adresses or something and if the uncompressed priv key is for the second adress which doesnt hold my funds then i dont have access?
Jump to: