!!! This is a work in progress and you shouldn't use this just yet for any main net transactions. !!!
Repository:
repositories {
jcenter()
maven {
url 'https://dl.bintray.com/novacrypto/BIP/'
}
}
Add dependency:
dependencies {
compile 'io.github.novacrypto:BIP32:2019.01.27'
}
ExtendedPrivateKey key = ExtendedPrivateKey.fromSeed(seed, Bitcoin.MAIN_NET);
ExtendedPrivateKey child = key.derive("m/0'/0");
ExtendedPublicKey childPub = child.neuter();
Need a seed from mnemonic/passphrase? check out NovaCrypto/BIP39.
String extendedKey = key.extendedBase58();
Or manually using NovaCrypto/Base58:
String extendedKey = base58Encode(key.extendedKeyByteArray());
ExtendedPrivateKey key = ExtendedPrivateKey.deserializer().deserializer(extendedBase58OrByteArray);
Or public:
ExtendedPublicKey key = ExtendedPublicKey.deserializer().deserializer(extendedBase58OrByteArray);
String p2pkh = public.p2pkhAddress();
String p2sh = public.p2shAddress();