Bitcoin Forum
May 22, 2024, 02:48:19 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Compressed to Uncompressed public keys (c#, php or online)?  (Read 4111 times)
doof (OP)
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
November 07, 2014, 02:02:52 AM
 #1

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.
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1032



View Profile WWW
November 07, 2014, 06:54:09 AM
 #2

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
doof (OP)
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
November 10, 2014, 12:42:12 AM
 #3

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?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
November 10, 2014, 04:38:25 PM
 #4

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.
doof (OP)
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
November 19, 2014, 12:58:54 AM
 #5

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 <bitcoinaddress> 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.
doof (OP)
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
November 19, 2014, 03:21:53 AM
 #6

Not sure why this thread did pop up when searching for this topic.  https://bitcointalk.org/index.php?topic=644919.0

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

Thanks for the help anyway, /Thread
OutCast3k
Hero Member
*****
Offline Offline

Activity: 714
Merit: 601


View Profile WWW
December 04, 2014, 06:40:48 AM
 #7

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.

coinb.in - Open Source, Multi Signature, HD Wallet and more! | Donate: 33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 275


View Profile
December 09, 2014, 08:53:23 PM
 #8

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.

Bitwasp Developer.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!