Is there some method that can be used to get the address, private and public key for any type of supported coin in a HD wallet? I can correctly generate these for Ethereum, which I verified on https://iancoleman.io/bip39/

String seedCode = "elevator dinosaur switch you armor vote black syrup fork onion nurse illegal trim rocket combine";

// BitcoinJ
DeterministicSeed seed = new DeterministicSeed(seedCode, null, "", 1409478661L);
DeterministicKeyChain chain = DeterministicKeyChain.builder().seed(seed).build();
List<ChildNumber> keyPath = HDPath.parsePath("M/44H/0H/0H/0/0");
DeterministicKey key = chain.getKeyByPath(keyPath, true);
BigInteger privKey = key.getPrivKey();

System.out.println("0x" + privKey.toString(16));
System.out.println("0x" + key.getPublicKeyAsHex());
System.out.println("0x" + Keys.getAddress(Sign.publicKeyFromPrivate(privKey)));

I'm not sure how to do the same for bitcoin or any other coin. Is there some other way to get the public key, private key, and address? I am currently using the bitcoinj and web3j libraries.

1 Answer 1


You can use method toAddress

System.out.println(key.toAddress(ScriptType.P2PKH, network));

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.