<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>

CC BY-SA 3.0
2017-10-13T00:51:54.247Z
Is there a way to get this Zero Key from Electrum? Your answer, while helpful, does not actually answer my question (not trying to be rude, I truly appreciate the help)
Cody S
CC BY-SA 3.0
2017-10-13T01:11:34.153Z
Sorry. I don't know the answer to that one.
ecavero
CC BY-SA 3.0
2017-10-13T00:34:33.017Z
2017-10-13T01:17:14.053Z
2017-10-13T01:17:14.053Z
ecavero
<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>

CC BY-SA 3.0
2017-12-20T10:51:19.323Z
2017-12-20T10:51:19.323Z
gtopal
<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>

<electrum><bitcoinj>
How do I import an Electrum wallet into BitcoinJ?
Cody S
# How do I import an Electrum wallet into BitcoinJ?

(Asked by: username_0 on 2017-10-12)

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.

**Tags:** electrum, bitcoinj


---

## 2 answers

### Answer by username_1 on 2017-10-13. Score: 1

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.

> **Comments:**
> **username_0**: Is there a way to get this Zero Key from Electrum? Your answer, while helpful, does not actually answer my question (not trying to be rude, I truly appreciate the help)  
> **username_1**: Sorry. I don't know the answer to that one.  

---

### Answer by username_2 on 2017-12-20. Score: 1

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

```


---

