1

I want to get Etherum address and private key by adding Phrase (or Password) everytime. I tried by following many gihub code.It gives different private key everytime. In Web3j, I found it is based on file.

I want to make a programme in such a way that it will create same wallet again (Based on password or phrase).

Is there any way.If yes than please share your knowledge.

1 Answer 1

2

I want to make a programme in such a way that it will create same wallet again (Based on password or phrase).

This is mostly called seed.

Refer to this answer : How to generate Private key, public key and address

const bip39 = require('bip39');
const hdkey = require('ethereumjs-wallet/hdkey');

const mnemonic = '..';
const hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic));
const path = "m/44'/60'/0'/0/0";
const wallet = hdwallet.derivePath(path).getWallet();
const address = `0x${wallet.getAddress().toString('hex')}`;

console.log(`Address: ${address}`);

Some good source for testing :

https://github.com/iancoleman/bip39

https://iancoleman.io/bip39/

4
  • I asked for Android. Please check title of the question
    – Kush
    Jul 21, 2018 at 8:44
  • I've checked. Since you can use almost every language in every platform better do distinction as; Android is name of OS and Java is name of language. Better use (Android/Java) in your question and use tags like Java, ethereumj, web3j, etc.. I believe you have answer here : ethereum.stackexchange.com/questions/41072/… and there : ethereum.stackexchange.com/questions/6673/…
    – Kerem atam
    Jul 21, 2018 at 9:22
  • It works but everytime creates new wallet , new address and private key.
    – Kush
    Jul 23, 2018 at 13:20
  • Did you try to change this line "String seed = UUID.randomUUID().toString();" in first link. You need to provide your seed word.
    – Kerem atam
    Jul 23, 2018 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.