Java Code Examples for org.bitcoinj.crypto.DeterministicKey#deserializeB58()
The following examples show how to use
org.bitcoinj.crypto.DeterministicKey#deserializeB58() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WalletProtobufSerializerTest.java From green_android with GNU General Public License v3.0 | 6 votes |
@Test public void testRoundTripMarriedWallet() throws Exception { // create 2-of-2 married wallet myWallet = new Wallet(PARAMS); final DeterministicKeyChain partnerChain = new DeterministicKeyChain(new SecureRandom()); DeterministicKey partnerKey = DeterministicKey.deserializeB58(null, partnerChain.getWatchingKey().serializePubB58(PARAMS), PARAMS); MarriedKeyChain chain = MarriedKeyChain.builder() .random(new SecureRandom()) .followingKeys(partnerKey) .threshold(2).build(); myWallet.addAndActivateHDChain(chain); myAddress = myWallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS); Wallet wallet1 = roundTrip(myWallet); assertEquals(0, wallet1.getTransactions(true).size()); assertEquals(Coin.ZERO, wallet1.getBalance()); assertEquals(2, wallet1.getActiveKeyChain().getSigsRequiredToSpend()); assertEquals(myAddress, wallet1.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS)); }
Example 2
Source File: Tools.java From thundernetwork with GNU Affero General Public License v3.0 | 6 votes |
/** * Call to get the MasterKey for a new Channel. * TODO: Change to request master node key.. * * @param number Query the Database to get the latest unused number * @return DeterministicKey for the new Channel */ public static DeterministicKey getMasterKey (int number) { DeterministicKey hd = DeterministicKey.deserializeB58(SideConstants.KEY_B58, Constants.getNetwork()); // DeterministicKey hd = DeterministicKey.deserializeB58(null,KEY_B58); // DeterministicKey hd = HDKeyDerivation.createMasterPrivateKey(KEY.getBytes()); DeterministicHierarchy hi = new DeterministicHierarchy(hd); List<ChildNumber> childList = new ArrayList<ChildNumber>(); ChildNumber childNumber = new ChildNumber(number, true); childList.add(childNumber); DeterministicKey key = hi.get(childList, true, true); return key; }
Example 3
Source File: WalletProtobufSerializerTest.java From GreenBits with GNU General Public License v3.0 | 6 votes |
@Test public void testRoundTripMarriedWallet() throws Exception { // create 2-of-2 married wallet myWallet = new Wallet(PARAMS); final DeterministicKeyChain partnerChain = new DeterministicKeyChain(new SecureRandom()); DeterministicKey partnerKey = DeterministicKey.deserializeB58(null, partnerChain.getWatchingKey().serializePubB58(PARAMS), PARAMS); MarriedKeyChain chain = MarriedKeyChain.builder() .random(new SecureRandom()) .followingKeys(partnerKey) .threshold(2).build(); myWallet.addAndActivateHDChain(chain); myAddress = myWallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS); Wallet wallet1 = roundTrip(myWallet); assertEquals(0, wallet1.getTransactions(true).size()); assertEquals(Coin.ZERO, wallet1.getBalance()); assertEquals(2, wallet1.getActiveKeyChain().getSigsRequiredToSpend()); assertEquals(myAddress, wallet1.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS)); }
Example 4
Source File: WalletProtobufSerializerTest.java From bcm-android with GNU General Public License v3.0 | 6 votes |
@Test public void testRoundTripMarriedWallet() throws Exception { // create 2-of-2 married wallet myWallet = new Wallet(UNITTEST); final DeterministicKeyChain partnerChain = new DeterministicKeyChain(new SecureRandom()); DeterministicKey partnerKey = DeterministicKey.deserializeB58(null, partnerChain.getWatchingKey().serializePubB58(UNITTEST), UNITTEST); MarriedKeyChain chain = MarriedKeyChain.builder() .random(new SecureRandom()) .followingKeys(partnerKey) .threshold(2).build(); myWallet.addAndActivateHDChain(chain); myAddress = myWallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS); Wallet wallet1 = roundTrip(myWallet); assertEquals(0, wallet1.getTransactions(true).size()); assertEquals(Coin.ZERO, wallet1.getBalance()); assertEquals(2, wallet1.getActiveKeyChain().getSigsRequiredToSpend()); assertEquals(myAddress, wallet1.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS)); }
Example 5
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv)); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); RequestorBtc.getUTXOListLtcNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 6
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 7
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv)); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 8
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 9
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv)); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); RequestorBtc.getUTXOListBtgNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 10
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); //TODO: get wif: ecKey001.getPrivateKeyAsWiF(params); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv)); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); RequestorBtc.getUTXOList(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { UTXOListResponse utxoResponse = (UTXOListResponse) response; setUTXO(utxoResponse.getUTXOList()); } @Override public void onFailure(String msg) { } }); }
Example 11
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); //TODO: get wif: ecKey001.getPrivateKeyAsWiF(params); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOList(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { UTXOListResponse utxoResponse = (UTXOListResponse) response; setUTXO(utxoResponse.getUTXOList()); } @Override public void onFailure(String msg) { } }); }
Example 12
Source File: SeedUtil.java From snowblossom with Apache License 2.0 | 5 votes |
public static ByteString getSeedIdFromXpub(String xpub) { DeterministicKey account_key = DeterministicKey.deserializeB58(xpub, org.bitcoinj.params.MainNetParams.get()); ByteString seed_id = ByteString.copyFrom(account_key.getIdentifier()); return seed_id; }
Example 13
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); updateWalletFriendlyAddress(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOListQtum(walletFriendlyAddress, new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 14
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOListLtcNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 15
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); walletFriendlyAddress = testReadonlyAddress == null ? walletFriendlyAddress : testReadonlyAddress; xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOListKmdNew(walletFriendlyAddress, new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 16
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv)); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 17
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOListSbtcNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItem> utxos = (List<UTXOItem>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 18
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv)); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); RequestorBtc.getUTXOListDgbNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItemDgb> utxos = (List<UTXOItemDgb>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 19
Source File: WalletManager.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) { xprv = xprv.trim(); try { DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params); String privhex = dk01.getPrivateKeyAsHex(); ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex)); KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent()); kcg.importKeys(ecKey001); wallet = new Wallet(params, kcg); walletFriendlyAddress = wallet.currentReceiveAddress().toString(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString()); callback.onWalletCreated(wallet); return; } callback.onWalletCreated(wallet); RequestorBtc.getUTXOListDgbNew(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() { @Override public void onSuccess(Object response) { List<UTXOItemDgb> utxos = (List<UTXOItemDgb>)response; setUTXO(utxos); } @Override public void onFailure(String msg) { } }); }
Example 20
Source File: BitcoinTransaction.java From token-core-android with Apache License 2.0 | 5 votes |
private void collectPrvKeysAndAddress(String segWit, String password, Wallet wallet) { this.network = wallet.getMetadata().isMainNet() ? MainNetParams.get() : TestNet3Params.get(); if (wallet.getMetadata().getSource().equals(Metadata.FROM_WIF)) { changeAddress = Address.fromBase58(network, wallet.getAddress()); BigInteger prvKey = DumpedPrivateKey.fromBase58(network, wallet.exportPrivateKey(password)).getKey().getPrivKey(); prvKeys = Collections.singletonList(prvKey); } else { prvKeys = new ArrayList<>(getOutputs().size()); String xprv = new String(wallet.decryptMainKey(password), Charset.forName("UTF-8")); DeterministicKey xprvKey = DeterministicKey.deserializeB58(xprv, network); DeterministicKey changeKey = HDKeyDerivation.deriveChildKey(xprvKey, ChildNumber.ONE); DeterministicKey indexKey = HDKeyDerivation.deriveChildKey(changeKey, new ChildNumber(getChangeIdx(), false)); if (Metadata.P2WPKH.equals(segWit)) { changeAddress = new SegWitBitcoinAddressCreator(network).fromPrivateKey(indexKey); } else { changeAddress = indexKey.toAddress(network); } for (UTXO output : getOutputs()) { String derivedPath = output.getDerivedPath().trim(); String[] pathIdxs = derivedPath.replace('/', ' ').split(" "); int accountIdx = Integer.parseInt(pathIdxs[0]); int changeIdx = Integer.parseInt(pathIdxs[1]); DeterministicKey accountKey = HDKeyDerivation.deriveChildKey(xprvKey, new ChildNumber(accountIdx, false)); DeterministicKey externalChangeKey = HDKeyDerivation.deriveChildKey(accountKey, new ChildNumber(changeIdx, false)); prvKeys.add(externalChangeKey.getPrivKey()); } } }