Search in sources :

Example 1 with WalletAppKit

use of org.bitcoinj.kits.WalletAppKit in project cryptoputty by alokmenghrajani.

the class CryptoputtyApplication method initialize.

@Override
public void initialize(final Bootstrap<CryptoputtyConfiguration> bootstrap) {
    bootstrap.addBundle(new ViewBundle<>());
    NetworkParameters params = TestNet3Params.get();
    File tempDir = Files.createTempDir();
    tempDir.deleteOnExit();
    kit = new WalletAppKit(params, tempDir, "cryptoputty");
    try {
        kit.restoreWalletFromSeed(new DeterministicSeed("office suit release flame robust know depth truly swim bird quality reopen", null, "", 1522261414L));
        kit.setBlockingStartup(false);
        kit.setAutoSave(true);
        kit.startAsync();
        kit.awaitRunning();
        // Perhaps having bloom filters doesn't hurt since we don't plan to do anything
        // kit.peerGroup().setBloomFilteringEnabled(false);
        // I have no idea what I'm doing, but let's increase these max values.
        kit.peerGroup().setMaxPeersToDiscoverCount(10000);
        kit.peerGroup().setMaxConnections(5000);
        log.info(format("send money to: %s", kit.wallet().freshReceiveAddress().toString()));
        log.info("done initializing");
    } catch (UnreadableWalletException e) {
        e.printStackTrace();
    }
}
Also used : DeterministicSeed(org.bitcoinj.wallet.DeterministicSeed) UnreadableWalletException(org.bitcoinj.wallet.UnreadableWalletException) NetworkParameters(org.bitcoinj.core.NetworkParameters) WalletAppKit(org.bitcoinj.kits.WalletAppKit) File(java.io.File)

Aggregations

File (java.io.File)1 NetworkParameters (org.bitcoinj.core.NetworkParameters)1 WalletAppKit (org.bitcoinj.kits.WalletAppKit)1 DeterministicSeed (org.bitcoinj.wallet.DeterministicSeed)1 UnreadableWalletException (org.bitcoinj.wallet.UnreadableWalletException)1