Author

Topic: Compressed to Uncompressed public keys (c#, php or online)? (Read 4126 times)

sr. member
Activity: 412
Merit: 287
Compressed bitcoin addresses have private keys which are encoded differently in the client. Since addresses are transmitted as the hash160 over the wire, using a compressed public key means your client needs to use a 'compressed' private key address. Ircnically, they're private keys are longer, but public keys become way shorter. Again, over the wire it's just the hash, so the hash differs.

The private key abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234 will yield the following formats of public keys:

Uncompressed: 0408ef68c46d20596cc3f6ddf7c8794f71913add807f1dc55949fa805d764d191c0b7ce6894c126 fce0babc6663042f3dde9b0cf76467ea315514e5a6731149c67
Hash160: 37d403153fe670f856d644abeabdde3bb19f4070
Address: 166C9QXfzBBV2QkuvXePGBVyjn8eD4SJBQ

Compressed: 0308ef68c46d20596cc3f6ddf7c8794f71913add807f1dc55949fa805d764d191c
Hash160: 8e10c23be6cc81477b20d138e289bd13e30d455e
Address: 1DxB2f5yiXP9yYWSJ3E8gC1bvbhmszKMpR

Your client parses for payments according to the hash160 of the pubkey, but it doesn't check for both forms. The difference is in specified to the client via the WIF; one byte of \x01 is added to the end of the private key:

The WIF for the uncompressed pubkey address is: 5K7x1UTzqtwrmBBWoS8ghLiQ1UMADH9vFc9rBozzC9hZ6BTKaMp
The hex for this is: 80abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234 + a checksum

The WIF of the compressed key is: L2yfo6EAJpH8dywQXwvvD41iZ5hyfCJN3UA46iSwSDPzdP8hCxo1
The hex for that is 80abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234 + 01 + a different checksum

So you should be able to convert fairly easily with some of the bitcoin libraries that are around.
hero member
Activity: 714
Merit: 601
Are there any sites that can compress and uncompress private keys?  Or any open source code i can borrow?

Bitcoind is giving me pub key compressed. http://coinb.in/multisig/ takes uncompressed.

The new version at: http://coinb.in supports compressed keys.
hero member
Activity: 765
Merit: 503
Not sure why this thread did pop up when searching for this topic.  https://bitcointalksearch.org/topic/how-to-get-uncompressed-public-key-from-compressed-one-644919

Found this c# tool https://en.bitcoin.it/wiki/Bitcoin_Address_Utility

Thanks for the help anyway, /Thread
hero member
Activity: 765
Merit: 503
Are there any sites that can compress and uncompress private keys?  Or any open source code i can borrow?

Bitcoind is giving me pub key compressed. http://coinb.in/multisig/ takes uncompressed.

Sorry, title is correct, body is wrong.  Are there any sites that can compress and uncompress private public keys?

You need to explain what you are trying to do.

It is unlikely that "uncompressing a public key" will accomplish what you want.  Perhaps you have some interesting new use for uncompressed public keys, but most likely you simply misunderstand what a "compressed public key" is.

A public key (uncompressed) is simply an x and y coordinate of a point on a graph.  A compressed public key is just the x coordinate.  Using the x coordinate you should be able to calculate the y coordinate if you really want it, but I don't understand why that would be useful to you.

Sorry:
I am trying to use http://coinb.in/multisig/ to create a mulitsig address, using 2 keys from 2 wallets.  Eg, blockchain.info and bitcoin-core. However, it requires the public keys to be uncompressed.

Bitcoin-core via the validateaddress command outputs the public key in compressed form.
www.blockchain.info dump the public key command, also yields the public key in compressed format.  Heres one example 0320e1011a724a4817365dd7fcb92bca63de802e1972130d607581a17eb71451fa

In order to use http://coinb.in/multisig/ I need to uncompress the keys.
legendary
Activity: 3472
Merit: 4794
Are there any sites that can compress and uncompress private keys?  Or any open source code i can borrow?

Bitcoind is giving me pub key compressed. http://coinb.in/multisig/ takes uncompressed.

Sorry, title is correct, body is wrong.  Are there any sites that can compress and uncompress private public keys?

You need to explain what you are trying to do.

It is unlikely that "uncompressing a public key" will accomplish what you want.  Perhaps you have some interesting new use for uncompressed public keys, but most likely you simply misunderstand what a "compressed public key" is.

A public key (uncompressed) is simply an x and y coordinate of a point on a graph.  A compressed public key is just the x coordinate.  Using the x coordinate you should be able to calculate the y coordinate if you really want it, but I don't understand why that would be useful to you.
hero member
Activity: 765
Merit: 503
Are there any sites that can compress and uncompress private keys?  Or any open source code i can borrow?

Bitcoind is giving me pub key compressed. http://coinb.in/multisig/ takes uncompressed.

Sorry, title is correct, body is wrong.  Are there any sites that can compress and uncompress private public keys?
legendary
Activity: 1512
Merit: 1036
Private keys are not compressed, public keys are what are compressed. The wallet-import-format merely has a flag as to whether the private key is for a compressed or uncompressed public key and address.

From the same private key data, a compressed public key makes a different address. You cannot spend bitcoins sent to a compressed address/public key with an uncompressed version.

You will need to use a wallet that supports compressed keys if you want to export addresses. Better yet, just send Bitcoins to your new wallet address over the network.

If you merely want to see the two addresses that a single private key can make, you can do that on the "wallet details" tab of http://bitaddress.org
hero member
Activity: 765
Merit: 503
Are there any sites that can compress and uncompress private keys?  Or any open source code i can borrow?

Bitcoind is giving me pub key compressed. http://coinb.in/multisig/ takes uncompressed.
Jump to: