Java Code Examples for org.bitcoinj.crypto.DeterministicKey#getPrivateKeyAsHex()
The following examples show how to use
org.bitcoinj.crypto.DeterministicKey#getPrivateKeyAsHex() .
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: 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)); updateWalletFriendlyAddress(); xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); 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 2
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 3
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 4
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 5
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 6
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 7
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.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 8
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 9
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 10
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 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)); 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 12
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 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); 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 14
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(); walletFriendlyAddress = testReadonlyAddress == null ? walletFriendlyAddress : testReadonlyAddress; xprvKey = xprv; } catch (IllegalArgumentException iae) { FirebaseCrash.report(iae); Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString()); callback.run(); return; } callback.run(); 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 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.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 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) { } }); }