pointbiz / bitaddress.org

JavaScript Client-Side Bitcoin Wallet Generator
https://www.bitaddress.org
2.47k stars 1.5k forks source link

Unable to retrieve funds sent to "Bitcoin Address Compressed" #114

Open cantonbecker opened 8 years ago

cantonbecker commented 8 years ago

I'm not sure if this is a bug or if I'm misunderstanding how the "Wallet Details" page works -- sorry to waste time in case it's the latter.

  1. Click Wallet Details
  2. Paste in private key 5K4ZkBNVGDKMStayjL4bU9KdaV2m3W7a5ReJSbZiUrdUYxL5pJd and do 'View Details'
  3. Send a very small amount of Bitcoin to the resulting "Bitcoin Address Compressed" (1aRhATnoepNn9QS3npeRhXnjoLaeoFeGu)
  4. Check the balance for the corresponding "Bitcoin Address" (12FBsSJc5qAAAA5MwyHtZ3QsiDKdo1g5eu)

Result: Funds never arrive at the expected address, and cannot be recovered using the private key. https://blockchain.info/address/12FBsSJc5qAAAA5MwyHtZ3QsiDKdo1g5eu

How do I retrieve the BTC sent to 1aRhATnoepNn9QS3npeRhXnjoLaeoFeGu ?

pointbiz commented 8 years ago

You use this private key in your wallet of choice: L2ijXamqk9N1FGgyPq8s8ojESnimQ3VzzXmdyyZQ5x3zbzvwaMWv "Private Key WIF Compressed"

I have been thinking recently that the wallet details page needs a visual redesign to make things more clear.

cantonbecker commented 8 years ago

Thanks! That works perfectly, and I should have thought to use the "Private Key WIF Compressed". I was making the mistake of assuming that all the QR codes and addresses on the wallet details page referred to the same address/key pair, and that the compressed addresses were just different expressions of the exact same address.

keihardhet commented 8 years ago

After some try-outs it's clear to me that this is indeed more of a design issue than a fault in code/underlying tech. The main problem, as a new bitcoin user, is that you need to be able to trust the paper wallets 100%. I choose the compressed format to send funds to, because that was the thing I was familiar with from other wallets. I didn't pay much attention and just printed the folded design, assuming the same key was there. Also, I thought that the compressed and uncompressed addresses were leading to one and the same 'file cabinet', just with other numbers. Like having two email aliases leading to the same inbox (I think many people think this to be true).

In the end, it would be much simpler to have TWO buttons there:

Or a more radical approach: hiding the uncompressed keys all over the site and certainly during generation of the print design. That way, even the most newly bitcoin user has only one choice: a working key pair. (which is the main goal of your sites isn't it?)

Just my two cents.

cantonbecker commented 8 years ago

Or a more radical approach: hiding the uncompressed keys all over the site and certainly during generation of the print design.

This makes a lot of sense to me. I’m not sure I see the value in displaying compressed keys anymore. What is the main utility?


Canton Becker canton@gmail.com • (505) 570-0635 • http://cantonbecker.com

pointbiz commented 8 years ago

Thanks for bringing up these usability concerns. I will try and explain some background and ask for your feedback on some upcoming changes.

The compressed and uncompressed key pairs refer to the same 32 byte random number. This means there is never a risk of unrecoverable funds if the user chooses to use the compressed or uncompressed format.

Bitcoin Addresses started out using the uncompressed public key that corresponded to the private key (represented in hex format in the early days). To save bytes in the blockchain the reference implementation switched to compressed public keys (v0.6). The compressed public key when hashed makes a different Bitcoin Address. To let wallets know which Bitcoin Address to generate for a given private key an augmentation to the base58 wallet import format was devised to encode a flag to let the wallet know if the compressed or uncompressed public key should be used. There was a transition period (2011/2012) when not everyone supported both compressed and uncompressed keys.

Here are the details of the wallet import format encoding: https://en.bitcoin.it/wiki/Wallet_import_format

There are multiple ways to represent a private key (hex, base64, etc) and all these formats for historical reasons refer to the uncompressed public key. The exception being base58 wallet import format when the extra compressed byte flag is added (also bip38 base58 format supports the compressed byte flag). Each format has a specific niche use case and the wallet details tab is a place where I try to provide an exhaustive display of formats. On the wallet details tab specifically I want to allow the user to mix and match between compressed/uncompressed formats. One use case would be to store your private key in base64 format hidden inside other base64 data but send the funds to the compressed Bitcoin Address. When it's time to spend the funds in a wallet then the user can return to the wallet details tab and convert between private key formats. Visually, right aligned things are the compressed format and left aligned are the uncompressed. I want to make this visually more clear and maybe provide more 'help info'.

TL;DR today everyone should use the compressed format but the wallet details tab needs to support everything.

I need some feedback on the other tabs: In the next version, I've been working to make compressed keys the default for some tabs (Single, Paper, Bulk). On the Single Wallet tab it will just use compressed keys with no option for uncompressed. I was planning to provide the option of compressed keys on the Paper Wallet tab similar to how it is today on the Bulk Wallet tab and make it checked by default. Based on the feedback from @keihardhet I would be open to removing the compressed option from Paper/Bulk tabs and just making it use compressed by default with no way to use the uncompressed format (same as I plan to do on Single tab).

The tricky question is how to handle the Vanity/Split/Brain wallet tabs. For backwards compatibility I want to leave the uncompressed format by default but to help people save blockchain space I want to provide the "compressed" checkbox option to let people decide to use the compressed format. Every extra option and choice can confuse people though (but in this case funds are always recoverable).

AnandPokar commented 7 years ago

@cantonbecker ,

Bitcoin Addressess (Pay-to-PubkeyHash) are of two types 1. compressed, 2. uncompressed.

In order for the bitcoin client to understand which version to use, the private key for them are represented in separate formats (https://github.com/OmniLayer/omniwallet/wiki/Converting-between-Compressed-and-Uncompressed-Addresses-and-Private-Keys). The private keys beginning with 5 are for uncompressed format.