{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/issues/445","labels_url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/issues/445/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/issues/445/comments","events_url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/issues/445/events","html_url":"https://github.com/bitcoin-solutions/multibit-hd/issues/445","id":59865958,"number":445,"title":"MultiBit HD soft wallets are incompatible with other BIP32 m/0' wallets (BIP39 mnemonic conversion is incorrect)","user":{"login":"gurnec","id":2966862,"avatar_url":"https://avatars.githubusercontent.com/u/2966862?v=3","gravatar_id":"","url":"https://api.github.com/users/gurnec","html_url":"https://github.com/gurnec","followers_url":"https://api.github.com/users/gurnec/followers","following_url":"https://api.github.com/users/gurnec/following{/other_user}","gists_url":"https://api.github.com/users/gurnec/gists{/gist_id}","starred_url":"https://api.github.com/users/gurnec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gurnec/subscriptions","organizations_url":"https://api.github.com/users/gurnec/orgs","repos_url":"https://api.github.com/users/gurnec/repos","events_url":"https://api.github.com/users/gurnec/events{/privacy}","received_events_url":"https://api.github.com/users/gurnec/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"jim618","id":919427,"avatar_url":"https://avatars.githubusercontent.com/u/919427?v=3","gravatar_id":"","url":"https://api.github.com/users/jim618","html_url":"https://github.com/jim618","followers_url":"https://api.github.com/users/jim618/followers","following_url":"https://api.github.com/users/jim618/following{/other_user}","gists_url":"https://api.github.com/users/jim618/gists{/gist_id}","starred_url":"https://api.github.com/users/jim618/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jim618/subscriptions","organizations_url":"https://api.github.com/users/jim618/orgs","repos_url":"https://api.github.com/users/jim618/repos","events_url":"https://api.github.com/users/jim618/events{/privacy}","received_events_url":"https://api.github.com/users/jim618/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/milestones/11","html_url":"https://github.com/bitcoin-solutions/multibit-hd/milestones/Beta%208","labels_url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/milestones/11/labels","id":991463,"number":11,"title":"Beta 8","description":"Next iteration to provide bug fixes and the following headline issues:\r\n\r\n* support for a BIP70 payment request\r\n* reduced startup time","creator":{"login":"jim618","id":919427,"avatar_url":"https://avatars.githubusercontent.com/u/919427?v=3","gravatar_id":"","url":"https://api.github.com/users/jim618","html_url":"https://github.com/jim618","followers_url":"https://api.github.com/users/jim618/followers","following_url":"https://api.github.com/users/jim618/following{/other_user}","gists_url":"https://api.github.com/users/jim618/gists{/gist_id}","starred_url":"https://api.github.com/users/jim618/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jim618/subscriptions","organizations_url":"https://api.github.com/users/jim618/orgs","repos_url":"https://api.github.com/users/jim618/repos","events_url":"https://api.github.com/users/jim618/events{/privacy}","received_events_url":"https://api.github.com/users/jim618/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":15,"state":"open","created_at":"2015-02-23T15:34:26Z","updated_at":"2015-03-11T20:05:02Z","due_on":null,"closed_at":null},"comments":20,"created_at":"2015-03-04T21:36:19Z","updated_at":"2015-03-11T20:07:31Z","closed_at":"2015-03-10T20:30:47Z","body":"*Summary:* Using the same mnemonic sentence in a MultiBit HD soft wallet and other BIP32-m/0'-compliant wallets (plus ~~account~~ change index 0) produces different keys and addresses.\r\n\r\n##### Steps to reproduce #####\r\n\r\n1. Create a new HD soft wallet or restore one using a mnemonic sentence. For the sake of this example, restore a wallet using this mnemonic sentence: skin join dog sponsor camera puppy ritual diagram arrow poverty boy elbow\r\n\r\n2. Obtain the first receive address.\r\n    expected result in this example: 12QxtuyEM8KBG3ngNRe2CZE28hFw3b1KMJ\r\n    actual result from MultiBit HD: 1LQ8XnNKqC7Vu7atH5k4X8qVCc9ug2q7WE\r\n    \r\nThe expected result was generated by https://dcpos.github.io/bip39/ using the derivation path m/0'/0, however any BIP32-compliant wallet using the same path should produce the same expected result.\r\n\r\n###### Definitions, just so we're on the same page: ######\r\n\r\n * entropy bits - an array of bits as generated by a CSPRNG or a true entropy source; typically 128 - 256 bits long.\r\n * mnemonic sentence - the result of encoding entropy bits plus a checksum into a BIP39 list of words; typically 12 - 24 words long.\r\n * seed bits - the result of running a mnemonic sentence through PBKDF2; always exactly 512 bits long.\r\n\r\n##### How to reproduce the keys and addresses currently produced by MultiBit HD #####\r\n\r\n1. Take the mnemonic sentence (from above) and derive the seed bits. The result is the following 64 bytes: `34, 178, 134, 7, 239, 86, 118, 164, 174, 211, 216, 40, 102, 130, 237, 105, 108, 108, 164, 254, 91, 192, 184, 131, 226, 248, 39, 113, 38, 184, 73, 12, 18, 201, 145, 253, 252, 1, 255, 241, 231, 146, 213, 247, 70, 230, 184, 60, 68, 207, 57, 201, 121, 94, 67, 222, 133, 144, 59, 243, 115, 146, 86, 82`\r\n2. Take the seed bits, and interpret them as though they were 512 entropy bits.\r\n3. Take these 512 entropy bits, and derive a new mnemonic sentence as per BIP39. The result is this 48 word long mnemonic: trim snack gorilla discover coast hat member pig build snake mention balance acoustic neutral asthma swift oven choice human orange smart intact soup wild nice public assume lady wing snake critic enrich say session useful base echo nut emotion fantasy trumpet dog deer basket expand hand surface coach\r\n4. Take this new mnemonic sentence, and derive keys and addresses according to BIP32 and a m/0'/0 path (for example at the website mentioned above). The result will be what MultiBit HD is currently producing (1LQ8XnNKqC7Vu7atH5k4X8qVCc9ug2q7WE will be the first address).\r\n\r\nThe issue is here: https://github.com/bitcoin-solutions/multibit-hd/blob/88bf9ec6863ec0bc33fc1796a80736b038f004b9/mbhd-core/src/main/java/org/multibit/hd/core/managers/WalletManager.java#L318\r\n\r\nThe DeterministicSeed constructor selected by overload resolution is the first one below; it takes as its first argument a byte array of entropy bits, but it is being passed a byte array of seed bits instead. Perhaps the second constructor below is the one that was intended, however AFAICT you can't construct a DeterministicSeed unless you either provide it with a mnemonic sentence, or let it generate its own mnemonic sentence (which may complicate the fix)....\r\n\r\n```java\r\nDeterministicSeed(byte[] entropy, String passphrase, long creationTimeSeconds)\r\nDeterministicSeed(byte[] seed, List<String> mnemonic, long creationTimeSeconds)\r\n```\r\n\r\n( edited for clarity: ) The simplest solution (passing it the mnemonic sentence in addition to the seed bits) probably wouldn't break existing wallets, but it would break the ability to restore existing wallets using only the mnemonic sentence, so I'm not sure what the best path forward is...."},"comment":{"url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/issues/comments/78359736","html_url":"https://github.com/bitcoin-solutions/multibit-hd/issues/445#issuecomment-78359736","issue_url":"https://api.github.com/repos/bitcoin-solutions/multibit-hd/issues/445","id":78359736,"user":{"login":"jim618","id":919427,"avatar_url":"https://avatars.githubusercontent.com/u/919427?v=3","gravatar_id":"","url":"https://api.github.com/users/jim618","html_url":"https://github.com/jim618","followers_url":"https://api.github.com/users/jim618/followers","following_url":"https://api.github.com/users/jim618/following{/other_user}","gists_url":"https://api.github.com/users/jim618/gists{/gist_id}","starred_url":"https://api.github.com/users/jim618/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jim618/subscriptions","organizations_url":"https://api.github.com/users/jim618/orgs","repos_url":"https://api.github.com/users/jim618/repos","events_url":"https://api.github.com/users/jim618/events{/privacy}","received_events_url":"https://api.github.com/users/jim618/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T20:07:31Z","updated_at":"2015-03-11T20:07:31Z","body":"That would be great if Hive and MBHD are compatible - I'll probably have a stab at testing that."}}