I use web3j to create my ethereum wallet.the Code just like down

import org.web3j.crypto.Bip39Wallet;
import org.web3j.crypto.Credentials;
import org.web3j.crypto.ECKeyPair;
import org.web3j.crypto.WalletUtils;

wallet = WalletUtils.generateBip39Wallet(password, new File(keystorePath));
// keystore's file name
String keystoreFileName = wallet.getFilename();
// my mnemonic
String mnemonic = wallet.getMnemonic();

I can use this code get my address

Credentials credentials = WalletUtils.loadBip39Credentials(password, mnemonic);
String address = credentials.getAddress();

I can import my wallet by this:

Credentials credentials = WalletUtils.loadBip39Credentials(password, mnemonic);

but in this way I need password & mnemonic,How I import or recovery my wallet by mnemonic without password,because some wallet app just like metamask or imtoken , they don't need the old password that I create my wallet and the can reset a new password.

In other words,recovery or import the wallet just need mnemonic,how I do it by web3j

enter image description here

Is ereryone can tell me how to do it by web3j.thank u very much.

  • 1
    I think the password is new password as shown in your metamask screen shot – Ha ĐANG Aug 23 '18 at 3:54
  • yes.Just need mnemonic and u can set a new password.It's meaning that I can reset my wallet just by mnemonic – chenhao597 Aug 23 '18 at 4:02
  • Ah, I mean the password in WalletUtils.loadBip39Credentials(password, mnemonic); also new password, not the current password then you user can input any new password to recover the wallet – Ha ĐANG Aug 23 '18 at 4:14
  • @HaĐANG right.I want to get it you user can input any new password to recover the wallet but now my user recover the wallet need password – chenhao597 Aug 23 '18 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.