Java Code Examples for org.bitcoinj.kits.WalletAppKit#restoreWalletFromSeed()
The following examples show how to use
org.bitcoinj.kits.WalletAppKit#restoreWalletFromSeed() .
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: Main.java From green_android with GNU General Public License v3.0 | 6 votes |
public void setupWalletKit(@Nullable DeterministicSeed seed) { // If seed is non-null it means we are restoring from backup. bitcoin = new WalletAppKit(params, new File("."), WALLET_FILE_NAME) { @Override protected void onSetupCompleted() { // Don't make the user wait for confirmations for now, as the intention is they're sending it // their own money! bitcoin.wallet().allowSpendingUnconfirmedTransactions(); Platform.runLater(controller::onBitcoinSetup); } }; // Now configure and start the appkit. This will take a second or two - we could show a temporary splash screen // or progress widget to keep the user engaged whilst we initialise, but we don't. if (params == RegTestParams.get()) { bitcoin.connectToLocalHost(); // You should run a regtest mode bitcoind locally. } bitcoin.setDownloadListener(controller.progressBarUpdater()) .setBlockingStartup(false) .setUserAgent(APP_NAME, "1.0"); if (seed != null) bitcoin.restoreWalletFromSeed(seed); }
Example 2
Source File: Main.java From GreenBits with GNU General Public License v3.0 | 6 votes |
public void setupWalletKit(@Nullable DeterministicSeed seed) { // If seed is non-null it means we are restoring from backup. bitcoin = new WalletAppKit(params, new File("."), WALLET_FILE_NAME) { @Override protected void onSetupCompleted() { // Don't make the user wait for confirmations for now, as the intention is they're sending it // their own money! bitcoin.wallet().allowSpendingUnconfirmedTransactions(); Platform.runLater(controller::onBitcoinSetup); } }; // Now configure and start the appkit. This will take a second or two - we could show a temporary splash screen // or progress widget to keep the user engaged whilst we initialise, but we don't. if (params == RegTestParams.get()) { bitcoin.connectToLocalHost(); // You should run a regtest mode bitcoind locally. } bitcoin.setDownloadListener(controller.progressBarUpdater()) .setBlockingStartup(false) .setUserAgent(APP_NAME, "1.0"); if (seed != null) bitcoin.restoreWalletFromSeed(seed); }
Example 3
Source File: Main.java From thundernetwork with GNU Affero General Public License v3.0 | 6 votes |
public void setupWalletKit (@Nullable DeterministicSeed seed) { // If seed is non-null it means we are restoring from backup. bitcoin = new WalletAppKit(params, new File("."), APP_NAME + "-" + params.getPaymentProtocolId() + CLIENTID) { @Override protected void onSetupCompleted () { // Don't make the user wait for confirmations for now, as the intention is they're sending it // their own money! bitcoin.wallet().allowSpendingUnconfirmedTransactions(); Platform.runLater(controller::onBitcoinSetup); } }; bitcoin.setDownloadListener(controller.progressBarUpdater()) .setBlockingStartup(false) .setUserAgent(APP_NAME, "1.0"); if (seed != null) { bitcoin.restoreWalletFromSeed(seed); } }
Example 4
Source File: Main.java From devcoretalk with GNU General Public License v2.0 | 5 votes |
public void setupWalletKit(@Nullable DeterministicSeed seed) { // If seed is non-null it means we are restoring from backup. bitcoin = new WalletAppKit(params, new File("."), APP_NAME + "-" + params.getPaymentProtocolId()) { @Override protected void onSetupCompleted() { // Don't make the user wait for confirmations for now, as the intention is they're sending it // their own money! bitcoin.wallet().allowSpendingUnconfirmedTransactions(); Platform.runLater(controller::onBitcoinSetup); } }; // Now configure and start the appkit. This will take a second or two - we could show a temporary splash screen // or progress widget to keep the user engaged whilst we initialise, but we don't. if (params == RegTestParams.get()) { bitcoin.connectToLocalHost(); // You should run a regtest mode bitcoind locally. } else if (params == TestNet3Params.get()) { // As an example! bitcoin.useTor(); // bitcoin.setDiscovery(new HttpDiscovery(params, URI.create("http://localhost:8080/peers"), ECKey.fromPublicOnly(BaseEncoding.base16().decode("02cba68cfd0679d10b186288b75a59f9132b1b3e222f6332717cb8c4eb2040f940".toUpperCase())))); } else { bitcoin.useTor(); } bitcoin.setDownloadListener(controller.progressBarUpdater()) .setBlockingStartup(false) .setUserAgent(APP_NAME, "1.0"); if (seed != null) bitcoin.restoreWalletFromSeed(seed); }