bitpay / wallet

Bitpay Wallet (formerly Copay) is a secure Bitcoin and other crypto currencies wallet platform for both desktop and mobile devices.
http://bitpay.com/wallet
MIT License
3.8k stars 1.74k forks source link

Can't import a blockchain.info backup #3708

Closed avibrazil closed 8 years ago

avibrazil commented 8 years ago

I want to move my wallet and all transaction logs to Copay from https://blockchain.info But apparently the Blockchain's exported wallet format is different from what Copay can import. I can't even use the mnemonic words from blockchain.info nor the JSON file nor the plain private key nor the QR code with the private key.

Apparently there is this new "HD" type of wallets or key pairs. And apparently Copay only supports those. And apparently https://blockchain.info doesn't. I was able to create a wallet on Multibit HD and import it on Copay though.

Please understand that I'm creating this issue because I couldn't find explanations anywhere for this, not even a straight "not supported or incompatible" (maybe because it is supported). I need to feel confidence on these tools and techniques to start making bitcoin transactions.

Would you please provide some advice, confirmations on my suspects, links or tips? I'm starving for more Bitcoin education beyond the basics.

Thank you in advance

dabura667 commented 8 years ago

I want to move my wallet and all transaction logs to Copay

This is impossible. Copay uses a completely different method of managing bitcoins, so "all transaction logs" are not able to be transferred.

However, you can "sweep" your bitcoins from your blockchain.info wallet into your Copay wallet. (Which is fancy term for "send your entire balance from bc.i to Copay")

Easy way:

  1. Log into blockchain.info and send all your bitcoins to an address you generated on Copay.

Hard way:

  1. Decrypt blockchain.info backup and pray that the backup is recent enough to contain all your private keys. Your private keys should look like a long string of letters and numbers that starts with the number 5. You may have more then one, and your balance could be spread across multiple keys.
  2. Open your Copay wallet, and from the wallet options (the cog icon on the upper right of your wallet main screen) click "Advanced" > "Sweep Paper Wallet" > Paste one of your private keys and hit "scan wallet funds"
  3. Copay will automatically send any funds left on the key to your Copay wallet.

The hard way will cost more in bitcoin fees, so I highly recommend the easy way.

As for transaction history, I recommend exporting that from blockchain.info as a CSV file and saving it on dropbox or something where you can access it later.

avibrazil commented 8 years ago

Now that was a clear response. Thank you.

Can I assume that Blockchain.info handles wallet in an older way? That HD, used by Copay and Multibit HD, is a newer way to do that ?

Thank you

dabura667 commented 8 years ago

Yes.

To explain simply: blockchain.info was using one secret (the private key) to manage a single address wallet. You could add more addresses, but this would generate a new secret to add to your wallet file, so for example, if you had address A, took a backup THEN made address B... obviously the backup would not contain address B's secret... so you need to backup again, and your backup file will be bigger and bigger as time goes on.

The mnemonic backup for blockchain.info was only to unlock your wallet from their servers, so even if you have the mnemonic from them, if their servers are gone, that mnemonic does nothing.

On the other hand, BIP39 + BIP32 + BIP44(optional) is a combination of 3 industry standards, Mnemonic entropy encoding for key generation with an optional passphrase, hierarchical deterministic key derivation, and a methodology for deriving key paths for HD wallets. These three combined create a wallet like this:

You write down one mnemonic, this is generated from a list of 2048 words x 12, which gives 128 bits of entropy and a checksum. This phrase is then hashed to get the seed for the HD wallet. The same mnemonic with the same (or same lack of) passphrase will always generate the same seed.

The seed is then fed into BIP32, the HD derivation method. It's complicated, but just imagine you have a really large random number as your first private key, then add one to that number to get your second private key etc etc. in order for all of time.

BIP44 specifies exactly what the "add one to get the next key" should be. (It's much more complicated) but having this standardized means that if I make a wallet on Trezor, and import it into Mycelium or Multibit HD or Copay, the wallet will just keep searching balances for addresses in consecutive order until a large number of addresses with 0 balance start showing up, then it stops, assuming you've only used up to there, and you pick up with the first unused address.

Because of this, all you need is 1 mnemonic, and it can be used across many wallets without the need of any servers. However, the portability can be a curse as well as a blessing. Imagine this: you input your mnemonic into 10 apps just to see if you can actually recover the wallet just in case. Then you only use one of the wallet apps. One day someone borrows your laptop or phone or whatever device where you had your phrase input into a wallet software that doesn't require a password, and because you were testing at the time, you did not set one. Someone finds the phrase, uses it to send all your bitcoins to them, and you just lost a lot of bitcoin.

Extra mobility is a nice feature, but should not be tested with your REAL wallet. Always know where you real wallet is and where it has been. But you can make as many new wallets as you want, so test out many apps with a wallet you don't care about if you want, but I recommend keeping your main wallet on a specific device. Hopefully, a 2FA setup with Copay.

avibrazil commented 8 years ago

@dabura667 that was very didactical and clear. I've never found such clear information anywhere. You should convert this into a wiki or documentation.

Since you are in the mood to write good explanations, would you please explain some use cases of HD key pairs? What is "cold" and "hot" wallet? I've read somewhere that with this same mnemonic you can create a cold sub-wallet to store in a paper wallet. This is still not clear for me. Also, how to use this key tree to work with other people ?

Thank you in advance !

insiderq commented 7 years ago

That is not quite true. Why i can decode mnemonic of blockchain.info with this service https://dcpos.github.io/bip39/ but when i paste it to the copay it says no transactions?

westonal commented 7 years ago

@insiderq I also observed this. The information in this ticket is a couple of years old so could be incorrect.

I was able to import/create my BIP39 generated from blockchain by specifying the Derivation Path as m/44'/0'/0'/0 not the default m/44'/0'/0' Now the address sequences of both match.

After import, I noticed that BitPay was starting from the first address, and that for some reason I had only received funds into the second address. So the balance was still zero. I went to receive funds on BitPay and advanced the address, this got them in sync. Though I expect I would have to do this every time.

insiderq commented 7 years ago

@westonal hm, you are probably right, anyway i just sent my funds from blockchain info wallet to a new one. But i definitely have tried adding /0 but that didn't work, probably there was more issues. Well, i'm glad there is a hint now for everyone who will observe this issue too.

JustAHappyKid commented 7 years ago

@dabura667 Echoing @avibrazil, this is a really excellent and concise write-up explaining how modern, HD wallets work... Would you mind if I copied, with editing, large chunks of your comment for a blog-post on our site? I'd like to keep this information handy somewhere anyway, and hopefully it will be easier for others to find if it's not hidden in a Github comment.

Also, am I correct in thinking that the current version of Blockchain.info's wallet uses a similar/same mechanism (BIP39 + BIP32 + BIP44), since they are now HD-based (if I understand correctly)?

westonal commented 7 years ago

@JustAHappyKid

am I correct in thinking that the current version of Blockchain.info's wallet uses a similar/same mechanism (BIP39 + BIP32 + BIP44)

Yes:

I was able to import/create my BIP39 generated from blockchain by specifying the Derivation Path as m/44'/0'/0'/0 not the default m/44'/0'/0' Now the address sequences of both match.

JustAHappyKid commented 6 years ago

FWIW, I have begun work on a proper document (blog post) making use of the content from @dabura667, explaining how modern HD wallets work and the basics of the relevant BIPs: https://spendabit.co/blog/understanding-hd-bitcoin-wallets

westonal commented 6 years ago

@JustAHappyKid so you passed off his explanation as your own? You asked permission and didn't get a response, so you did it anyway. Well jokes on you, it's a very poor explanation.

JustAHappyKid commented 6 years ago

@westonal Take a "chill pill".

First of all, I'm planning to edit the text to the point it only has the "spirit" of what @dabura667 wrote, and furthermore if he decides to take the time to respond to my question with a "no", then I'll rewrite the content from scratch (about half of it was already newly-written). Note also, the post is not yet public -- except here, where I posted it as an FYI/courtesy.

Not sure I've ever seen anyone in the open-source community take so much offense to someone else copying a few paragraphs or blocks of code, especially from random comments on an issue-tracker.

Well jokes on you, it's a very poor explanation.

So why didn't you chime in with a link to the better explanation (you seem to be aware of) so I didn't bother to make the above content more accessible / easier to find (as a help to others trying to understand how modern HD wallets work)?

dabura667 commented 6 years ago

No worries. You can use what I said, and I don’t really care if you attribute it. I haven’t really said anything that isn’t public knowledge. But it would be nice to get a little recognition.

Yeah, blockchain info has since moved from the weird “turn your password hash into a mnemonic” method of recovery to the industry standard BIP39 mnemonic phrases. Nice.

dabura667 commented 6 years ago

it’s a poor explanation

Let me go run some cold water on that burn.

I would like to hear your explanation, though. Sorry my explanation was so poor.

JustAHappyKid commented 6 years ago

Thanks for chiming in @dabura667. I will add an attribution. (Meant to do that in the first place.)

westonal commented 6 years ago

Sorry @dabura667 about calling it poor. It's fine for a quick explanation in the context of this issue. I meant that taken out of context and placed in a blog, it isn't really accurate or in-depth enough.

If you want a good explanation link @JustAHappyKid just go to the sources: bip-0032 & bip-0044

The BIP32 one even has a nice diagram. image

JustAHappyKid commented 6 years ago

Thanks for pointing that out @westonal. I'm linking to the original BIP documents as well (not live yet), for those that wish to dig deeper. The graphic is helpful.

westonal commented 6 years ago

Np @JustAHappyKid, it would be awesome if there was a similar graphic for BIP44 that showed the depths of BIP44 and what each depth meant, i.e.

Starts same as BIP32 diagram, then: depth = 1: constant 44` depth = 2: coin, e.g. 0=BItcoin, 2=Litecoin etc depth = 3: accounts 0..n depth = 4: change 0 or 1, i.e. 0=external regular addresses and 1=internal change addresses depth = 5: addresses 0...n (just like depth 3 on the bip32 diagram)

Something like that would have helped me visualize it when I was learning. There's an idea for your blog.

avibrazil commented 6 years ago

@JustAHappyKid, I’ve read your article and I find it good and informative. I’d add some visual examples, starting from showing a real mnemonic phrase and a derivation path. This might be silly for us that have hands on experience with HD, but makes things more tangible for beginners. I’d also add that same mnemonic can be used for different coins, all your coins, and mention SLIP-44.

I understand about HD wallets. Article’s clarity has to be tested against someone that doesn’t.

Thank you writing this.

JustAHappyKid commented 6 years ago

Thanks for the feedback. I finally got around to putting a bow on that article. Feel free to let me know if you see any factual problems or other room for improvement; I'll try to update it appropriately. I'd love to put together some graphics as suggested, but doubt I'll find the time in the near future.