Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Create Wallet with Bip39 not correct ? #496

Closed
minhphuong1894 opened this issue Apr 13, 2018 · 6 comments
Closed

Create Wallet with Bip39 not correct ? #496

minhphuong1894 opened this issue Apr 13, 2018 · 6 comments
Labels
stale no activity for 21 days

Comments

@minhphuong1894
Copy link

Hi conor
i use your library to create new wallet eth with bip39 but it's not show correct address and private key like https://coinomi.com/recovery-phrase-tool.html
can you help me, it's very important for me !
we

@TOTOROYang
Copy link
Contributor

TOTOROYang commented Apr 18, 2018

byte[] seed = MnemonicUtils.generateSeed(mnemonic,"");

@ARechitsky
Copy link

Bip39 does not specify creating wallet, it's only about generating seed from mnemonic. Web3j does not support bip32+bip44, hierarchy deterministic keys. It generates exactly one key pair instead of hierarchy, where you can get "m/44'/60'/0'/0" path

@shorani
Copy link

shorani commented Apr 30, 2018

Are you going to add support bip44?

@wl-tsui
Copy link

wl-tsui commented May 3, 2018

use bip44;
https://raw.githubusercontent.com/bitcoinj/bitcoinj/master/core/src/main/java/org/bitcoinj/crypto/HDKeyDerivation.java
code:
private static final String DERIVATION_PATH = "m/44'/60'/0'/0";
private static final int DERIVATION_PATH_PURPOSE = 44;
private static final int DERIVATION_PATH_COIN = 60;
private static final int CHANGE_INDEX = 0;
private static final int ADDRESS_INDEX = 0;

public static ECKey fromBIP44HDpath(DeterministicKey masterKey, int accountIndex) {
    DeterministicKey purposeKey = HDKeyDerivation.deriveChildKey(masterKey, DERIVATION_PATH_PURPOSE | ChildNumber.HARDENED_BIT);
    DeterministicKey rootKey = HDKeyDerivation.deriveChildKey(purposeKey, DERIVATION_PATH_COIN | ChildNumber.HARDENED_BIT);
    DeterministicKey accountKey = HDKeyDerivation.deriveChildKey(rootKey, accountIndex | ChildNumber.HARDENED_BIT);
    DeterministicKey changeKey = HDKeyDerivation.deriveChildKey(accountKey, CHANGE_INDEX);
    DeterministicKey addressKey = HDKeyDerivation.deriveChildKey(changeKey, ADDRESS_INDEX);
    return ECKey.fromPrivate(addressKey.getPrivKeyBytes());
}

@wl-tsui
Copy link

wl-tsui commented May 3, 2018

need modify create seed code。use @TOTOROYang

@AlexandrouR AlexandrouR added the stale no activity for 21 days label Jul 18, 2019
@AlexandrouR
Copy link
Contributor

Closing as this is duplicate of #919 - please go to that issue for updated

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
stale no activity for 21 days
Projects
None yet
Development

No branches or pull requests

6 participants