<p>I think this example can help you, to synchronize the wallet</p>

<p><a href="https://github.com/bitcoinj/bitcoinj/blob/master/examples/src/main/java/org/bitcoinj/examples/RefreshWallet.java" rel="nofollow noreferrer">https://github.com/bitcoinj/bitcoinj/blob/master/examples/src/main/java/org/bitcoinj/examples/RefreshWallet.java</a></p>

CC BY-SA 4.0
2018-07-27T22:09:14.543Z
2018-07-27T22:09:14.543Z
Jose Luis Estevez
<p>I have created a wallet with the help of WalletAppKit on Android and did some transaction in it. </p>

<p>Now what I try to do is, restoring that wallet from mnemonic code (BIP39). It also returns the Wallet object but it doesn't contain the transactions.</p>

<p>Here is the link ref <a href="https://bitcoinj.github.io/working-with-the-wallet#seeds-and-mnemonic-codes" rel="nofollow noreferrer">https://bitcoinj.github.io/working-with-the-wallet#seeds-and-mnemonic-codes</a> which describe the working with mnemonic code and seeds.</p>

<p>It also says "now sync the restored wallet as described below" but I never found any way to sync it.</p>

<pre><code>DeterministicSeed seed = wallet.getKeyChainSeed();
println("Seed words are: " + Joiner.on(" ").join(seed.getMnemonicCode()));
println("Seed birthday is: " + seed.getCreationTimeSeconds());

String seedCode = "yard impulse luxury drive today throw farm pepper survey wreck glass federal";
long creationtime = 1409478661L;
DeterministicSeed seed = new DeterministicSeed(seedCode, null, "", creationtime);
Wallet restoredWallet = Wallet.fromSeed(params, seed);
// now sync the restored wallet as described below.
</code></pre>

CC BY-SA 3.0
2018-04-11T10:35:46.940Z
I found this link https://github.com/bitcoinj/bitcoinj/blob/master/examples/src/main/java/org/bitcoinj/examples/RestoreFromSeed.java. it takes so long time but nothing heppend.
Aaditya Paliwal
CC BY-SA 4.0
2018-12-05T13:13:27.000Z
Yes, that part is critical. It need to parse all historical transactions to check which ones are spendable by HD keys which are derivable from your wallet. This will take a while as includes the entire chain. The backed-up wallet doesn't know which keys or transactions were previously received, so it has to iterate through all child key indices, until it finds the index where the previous wallet stopped generating children keys (a gap of 20 unused hd keys). For each child key, it will derive the public key hash, and search for those while parsing the chain to determine whether it was used.
James C.
<wallet><bitcoinj>
BitcoinJ : Balance and Transaction are not showing in wallet after restoring wallet from MnemonicCode
Aaditya Paliwal
# BitcoinJ : Balance and Transaction are not showing in wallet after restoring wallet from MnemonicCode

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

I have created a wallet with the help of WalletAppKit on Android and did some transaction in it.

Now what I try to do is, restoring that wallet from mnemonic code (BIP39). It also returns the Wallet object but it doesn't contain the transactions.

Here is the link ref <https://bitcoinj.github.io/working-with-the-wallet#seeds-and-mnemonic-codes> which describe the working with mnemonic code and seeds.

It also says "now sync the restored wallet as described below" but I never found any way to sync it.

```
DeterministicSeed seed = wallet.getKeyChainSeed();
println("Seed words are: " + Joiner.on(" ").join(seed.getMnemonicCode()));
println("Seed birthday is: " + seed.getCreationTimeSeconds());

String seedCode = "yard impulse luxury drive today throw farm pepper survey wreck glass federal";
long creationtime = 1409478661L;
DeterministicSeed seed = new DeterministicSeed(seedCode, null, "", creationtime);
Wallet restoredWallet = Wallet.fromSeed(params, seed);
// now sync the restored wallet as described below.

```

**Tags:** wallet, bitcoinj

> **Comments:**
> **username_0**: I found this link https://github.com/bitcoinj/bitcoinj/blob/master/examples/src/main/java/org/bitcoinj/examples/RestoreFromSeed.java. it takes so long time but nothing heppend.  
> **username_1**: Yes, that part is critical. It need to parse all historical transactions to check which ones are spendable by HD keys which are derivable from your wallet. This will take a while as includes the entire chain. The backed-up wallet doesn't know which keys or transactions were previously received, so it has to iterate through all child key indices, until it finds the index where the previous wallet stopped generating children keys (a gap of 20 unused hd keys). For each child key, it will derive the public key hash, and search for those while parsing the chain to determine whether it was used.  

---

## 1 answers

### Answer by username_2 on 2018-07-27. Score: 0

I think this example can help you, to synchronize the wallet

<https://github.com/bitcoinj/bitcoinj/blob/master/examples/src/main/java/org/bitcoinj/examples/RefreshWallet.java>


---

