user61649: I'm trying to create a BitcoinJ-based app that watches an existing wallet (created in Electrum) and does things when transactions come through against that wallet.
As I understand it, I need to create a BitcoinJ wallet by feeding it my Electrum wallet's "Watching Key", and it appears that, to do this, I need to somehow load my Electrum wallet into BitcoinJ so that I can call getWatchingKey() on it.
The problem is that I cannot sort out how to import my Electrum wallet into BitcoinJ - I have BIP32-formatted public and private keystrings (from testnet, so they start with tpub and tpriv respectively), but I simply cannot sort out how to convert these strings into a Wallet object in BitcoinJ. Any help would be greatly appreciated.
EDIT
Alternatively, I could import the Key by using the Seed...but I'm supposed to supply the Seed's creation time (in Unix form)...what is that information used for? I don't have it, so I've been working under the assumption that I cannot use the Seed.

user38286: As stated in https://bitcoinj.github.io/working-with-the-wallet:
"The “watching key” in this case is the public form of the BIP32 account zero key i.e. it’s the first key derived from the master."
I also thought it was the master public key, but it is the first (or 0th) derived key.
Hope this helps.
EDIT:
To answer your last question, the seed's creation time is used as a hint to BitcoinJ as to when it should start searching for transactions. If you have access to your first transaction on your Electrum wallet, use that approximate time.

user31202: I face up the same problem(still I can not reach my balance) when I was trying to have access to my wallet through a BitcoinJ application.
Despite the fact that my bitcoin address had created successfully from my private key, still I was not able to have access to my funds. I do not know why.
Here is my code, hope it will help you:
 //create my ECKey
        DumpedPrivateKey dumpPrivKey = null;
        try {
            dumpPrivKey = new DumpedPrivateKey(params, "your private key. You can reach it by calling the dumpprivkey RPC command in Bitcoin-Core console");
        } catch (AddressFormatException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();


        }
        ECKey myKey=dumpPrivKey.getKey();
        Address bitcoinAddress=myKey.toAddress(params);

       System.out.println("My bitcoin address is : " +bitcoinAddress); //the 
    Main network address 
    Coin coin =wallet.getBalance();
    System.out.println("My bitcoin balance is: " +coin); //the balance


61649: <p>I'm trying to create a BitcoinJ-based app that watches an existing wallet (created in Electrum) and does things when transactions come through against that wallet.</p>

<p>As I understand it, I need to create a BitcoinJ wallet by feeding it my Electrum wallet's "Watching Key", and it appears that, to do this, I need to somehow load my Electrum wallet into BitcoinJ so that I can call <code>getWatchingKey()</code> on it.</p>

<p>The problem is that I cannot sort out how to import my Electrum wallet into BitcoinJ - I have BIP32-formatted public and private keystrings (from testnet, so they start with <code>tpub</code> and <code>tpriv</code> respectively), but I simply cannot sort out how to convert these strings into a Wallet object in BitcoinJ. Any help would be greatly appreciated.</p>

<p>EDIT</p>

<p>Alternatively, I could import the Key by using the Seed...but I'm supposed to supply the Seed's creation time (in Unix form)...what is that information used for? I don't have it, so I've been working under the assumption that I cannot use the Seed.</p>
 38286: <p>As stated in <a href="https://bitcoinj.github.io/working-with-the-wallet" rel="nofollow noreferrer">https://bitcoinj.github.io/working-with-the-wallet</a>:</p>

<p>"The “watching key” in this case is the public form of the BIP32 account zero key i.e. it’s the first key derived from the master."</p>

<p>I also thought it was the master public key, but it is the first (or 0th) derived key.</p>

<p>Hope this helps.</p>

<p>EDIT:</p>

<p>To answer your last question, the seed's creation time is used as a hint to BitcoinJ as to when it should start searching for transactions. If you have access to your first transaction on your Electrum wallet, use that approximate time.</p>
 31202: <p>I face up the same problem(still I can not reach my balance) when I was trying to have access to my wallet through a BitcoinJ application.</p>

<p>Despite the fact that my bitcoin address had created successfully from my private key, still I was not able to have access to my funds. I do not know why.</p>

<p>Here is my code, hope it will help you:</p>

<pre><code> //create my ECKey
        DumpedPrivateKey dumpPrivKey = null;
        try {
            dumpPrivKey = new DumpedPrivateKey(params, "your private key. You can reach it by calling the dumpprivkey RPC command in Bitcoin-Core console");
        } catch (AddressFormatException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();


        }
        ECKey myKey=dumpPrivKey.getKey();
        Address bitcoinAddress=myKey.toAddress(params);

       System.out.println("My bitcoin address is : " +bitcoinAddress); //the 
    Main network address 
    Coin coin =wallet.getBalance();
    System.out.println("My bitcoin balance is: " +coin); //the balance
</code></pre>
