0

i have created watch wallet
Wallet wallet = Wallet.fromWatchingKeyB58(params, tPub, DeterministicHierarchy.BIP32_STANDARDISATION_TIME_SECS); How can i link this with block chain i am using WalletAppKit class

kit = new WalletAppKit(params, walletFile, APP_NAME);
kit.startAsync(); kit.awaitRunning();

after that i add wallet in PeerGroup kit.peerGroup().addWallet(wallet) after that i print address of a wallet System.out.println(kit.wallet().currentReceiveAddress()); but this address and System.out.println(wallet.currentReceiveAddress()); this is not same. i am using bitcoinj for this, i have sent multiple transaction on wallet.currentReceiveAddress() but did not receive any of them, i don't know what i am doing wrong here, kindly help!

0

i have done this by overriding methods of WalletAppkit and its working fine now, here is code sample for this.

  kit = new WalletAppKit(params, walletFile, APP_NAME) {
            @Override
            protected Wallet createWallet() {
                System.out.println("I am here");
                Wallet wallet = Wallet.fromWatchingKeyB58(params, tPub, DeterministicHierarchy.BIP32_STANDARDISATION_TIME_SECS);
                return wallet;
            }
@Override
        protected void onSetupCompleted() {
            super.onSetupCompleted();
            System.out.println(kit.wallet().currentReceiveAddress());
            System.out.println(kit.wallet().getTotalReceived().toFriendlyString());
            txHistory();

            kit.wallet().addEventListener(new AbstractWalletEventListener() {
                @Override
                public void onWalletChanged(Wallet wallet) {
                    System.out.println(kit.wallet().getTotalReceived());
                }
            });
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.