How can you extract private keys from MultiBit HD?

10

8

It was possible in MultiBit Classic, but I can't find it in MultiBit HD.

Pavel Niedoba

Posted 2015-09-12T13:41:30.380

Reputation: 454

Would it be possible to write a more detailed explanation of redee`s answer? Could someone explain how to apply the patch and build the project? I have tried lots of other options, but nothing else seems to work for me. Thank you in advance.PythonBeginner1337 2017-06-30T17:34:07.020

I thought the point of HD wallets is that you only need the word seed to recover all private keys you've ever used. Why would you want a list of them when you can (re)generate them on demand?4276 2017-11-20T05:44:28.087

Answers

9

WARNING: While this answer may be a solution to the issue in the question, it involves exposing your wallet seed to a tool on the internet. Please be very careful when doing this!


Can't add comments so extend Chris.J's answer:

Here are my notes on how to recover / rebuild / regenerate / extract ALL addresses and keys used by MultiBit HD:

  • Go to https://iancoleman.github.io/bip39/
  • In the field "BIP39 Mnemonic" fill in your 12 wallet generation words
  • No password
  • Code: Bitcoin
  • Under Derivation Path, select the BIP32 tab
  • Client: Custom derivation path
  • Derivation path FOR EXTERNAL (RECEIVING) ADDRESSES (copy paste this): m/0'/0
  • Your receiving addresses are now displayed at the end of the page.
  • Derivation path FOR INTERNAL (CHANGE) ADDRESSES (copy paste this): m/0'/1
  • Your change addresses are now displayed at the end of the page. Absolute Happiness ;)

(solution found on:https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki in "Hierarchical Deterministic Wallets" picture)

NXS

Posted 2015-09-12T13:41:30.380

Reputation: 91

Nailed it, another guide didn't explain about the change addresses being on a different derivation path. Thank you -this got me access to my Bitcoin Cash that I wanted to 'claim'HaveAGuess 2017-09-28T23:36:01.383

1A local bip39 tool would be handy.4276 2017-11-20T05:46:22.433

8

In case you have a beta7 wallet which is not BIP32 compliant you cannot use the method @chris-j has put forward.

The easiest way for me was to hook into MultiBit HD's signing capabilities and log the private key being used to the console:

diff --git a/mbhd-core/src/main/java/org/multibit/hd/core/managers/WalletManager.java b/mbhd-core/src/main/java/org/multibit/hd/core/managers/WalletManager.java
index 61979a3..e8a0de1 100644
--- a/mbhd-core/src/main/java/org/multibit/hd/core/managers/WalletManager.java
+++ b/mbhd-core/src/main/java/org/multibit/hd/core/managers/WalletManager.java
@@ -1753,6 +1753,8 @@ public enum WalletManager implements WalletEventListener {
           if (signingKey.getKeyCrypter() != null) {
             KeyParameter aesKey = signingKey.getKeyCrypter().deriveKey(walletPassword);
             ECKey decryptedSigningKey = signingKey.decrypt(aesKey);
+            log.info("HACK address: " + signingAddress.toString());
+            log.info("HACK private key: " + decryptedSigningKey.getPrivateKeyAsWiF(networkParameters));

             String signatureBase64 = decryptedSigningKey.signMessage(messageText);
             return new SignMessageResult(Optional.of(signatureBase64), true, CoreMessageKey.SIGN_MESSAGE_SUCCESS, null);

I have tested this with v0.5 following these steps:

  1. Clone the MultiBit HD Git repository
  2. Apply the patch above
  3. Build the project: mvn clean dependency:sources install
  4. Start the application: java -jar mbhd-swing/target/multibit-hd.jar
  5. Go to Tools -> Sign message and enter a Bitcoin address from your wallet for which you want to recover the private key. Press finish.
  6. Read the Bitcoin address and corresponding private key from the console output

redee

Posted 2015-09-12T13:41:30.380

Reputation: 81

This might be little too complicated for people who just use bitcoins for business.Pavel Niedoba 2017-02-10T12:11:51.420

2You're my saviour, @redee! I used this method successfully in v0.5.1 to extract my private key for importing to Omniwallet so that I could transfer colored coins to a different wallet which supports them properly.

Line numbers had changed slightly but the same code worked fine :D Oh, and I had to use the "Sign Message" button to get the output rather than just pressing "Finish". – pospi 2017-06-12T10:27:06.047

Thanks redee, good instructions -- was able to transfer my money to another wallet (Jaxx), after having Multibit show my transactions as unconfirmed (for 8 months), thus being unable to transfer them anywhere else.Kem Mason 2017-07-12T01:20:12.960

4

Because the private keys and addresses are created deterministically from your wallet words you just need to keep your wallet words safe - there is no need to expose individual private keys. You can use your wallet words to recreate your wallet in either MultiBit HD (use the Restore button on the 'Enter password' screen) or using other tools.

For instance, you can create an offline copy of https://dcpos.github.io/bip39/ and create all your addresses/ private keys if you want to (use the BIP32 tab).

There is no option to export private keys in MultiBit HD because BIP32 wallets create both receiving addresses and change addresses on demand. Exporting and importing private keys won't give you, in general, a complete HD wallet.

jim618

Posted 2015-09-12T13:41:30.380

Reputation: 3 205

It is not possible to extract private keys in MultiBit HD, but it can be done in other application?Pawel 2016-09-21T16:11:28.000

1Actually there are dozen reasons why we need private keys for single address.Pavel Niedoba 2017-02-10T12:09:43.073

That page seems to create all my receiving addresses, but not the change addresses.Seppo Enarvi 2017-05-10T08:54:15.823

What about when we need to access our private keys for a hard fork?arviman 2017-10-27T02:40:00.463

Best answer.....4276 2017-11-20T05:47:30.247

2

WARNING: While this answer may be a solution to the issue in the question, it involves exposing your wallet seed to a tool on the internet. Please be very careful when doing this, since

  1. ...just DON'T DO IT!
  2. See 1.
  3. You probably don't know the guy behind the web page well enough to trust them with your precious bitcoins.
  4. Even if you do, the site may have been hacked and the keys get into the hands of malicious people spending your bitcoins within seconds.

Here are my notes on how to recover / rebuild / regenerate / extract the addresses and keys used by MultiBit HD:

  1. Go to https://iancoleman.github.io/bip39/
  2. In the field "BIP39 Mnemonic" fill in your 12 wallet generation words
  3. No password
  4. Coin: Bitcoin
  5. Under Derivation Path, select the BIP32 tab
  6. Derivation path (copy paste this): m/0'/0
  7. Your addresses are now displayed at the end of the page. Happiness ;)

Chris.J

Posted 2015-09-12T13:41:30.380

Reputation: 47

0

Restore your wallet in electrum and then use that to extract the private keys. To learn how to restore your wallet in electrum view this video

If you just want the private keys for specific addresses then bring the addresses tab into view via the view menu and then right click on each address to get the option to view its private key. If you want to export all the keys then use wallet menu > private keys > export.

Abdussamad

Posted 2015-09-12T13:41:30.380

Reputation: 1 850