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

<pre><code>  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());
                }
            });
        }
</code></pre>

CC BY-SA 3.0
2018-04-26T08:57:47.417Z
2018-04-26T08:57:47.417Z
Zombie
<p>i have created watch wallet<br>
<code>Wallet wallet = Wallet.fromWatchingKeyB58(params, tPub, DeterministicHierarchy.BIP32_STANDARDISATION_TIME_SECS);</code>
How can i link this with block chain
i am using WalletAppKit class</p>

<pre><code>kit = new WalletAppKit(params, walletFile, APP_NAME);
kit.startAsync(); kit.awaitRunning();
</code></pre>

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

<transactions><blockchain><bitcoinj><java>
connect watching wallet with blockchain
Zombie
# connect watching wallet with blockchain

(Asked by: username_0 on 2018-04-25)

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!

**Tags:** transactions, blockchain, bitcoinj, java


---

## 1 answers

### Answer by username_0 on 2018-04-26. Score: 0 | Accepted answer

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());
                }
            });
        }


---

