Fail to recover wallet from DeterministicSeed

53 views
Skip to first unread message

Bruno Martins

unread,
May 6, 2017, 7:39:55 PM5/6/17
to bitcoinj
Hey,

I've started a Bitcoin wallet pet project to start getting familiarized with crypto / blockchain development.

I am having trouble recovering a wallet from the mnemonic seed and it's creation date.

After the attempting to sync i end up with a total new wallet but with the old (previous wallet) mnemonic seed attached to it . I'm a bit confused.

final DeterministicSeed seed = createDeterministicSeed();

        _bitcoinManager
.getCurrencyCoin().getWalletManager().addListener(new Service.Listener() {
           
@Override
           
public void terminated(Service.State from) {
               
super.terminated(from);
               
WalletAppKit appKit = setupWallet();

                appKit
.setDownloadListener(BitcoinRecoverAction.this)
                       
.setBlockingStartup(false)
                       
.setUserAgent(ServiceConsts.SERVICE_APP_NAME, "0.1")
                       
.restoreWalletFromSeed(seed);

                _bitcoinManager
.getCurrencyCoin().setWalletManager(appKit);
                _bitcoinManager
.getCurrencyCoin().getWalletManager().startAsync();
           
}
       
}, Executors.newSingleThreadExecutor());

        _bitcoinManager
.getCurrencyCoin().getWalletManager().stopAsync();

The entire class / code can be found here : https://github.com/ehanoc/xwallet/blob/master/app/src/main/java/com/bytetobyte/xwallet/service/coin/bitcoin/actions/BitcoinRecoverAction.java

Thanks a million
Bruno

Andreas Schildbach

unread,
May 7, 2017, 6:09:37 AM5/7/17
to bitc...@googlegroups.com
Have you looked at the RestoreFromSeed code example? It does exactly that.
> --
> You received this message because you are subscribed to the Google
> Groups "bitcoinj" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to bitcoinj+u...@googlegroups.com
> <mailto:bitcoinj+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.


Bruno Martins

unread,
May 7, 2017, 6:24:38 AM5/7/17
to bitc...@googlegroups.com

Yes I did.

Thing is, it worked at one point with one wallet I was testing for a while. But recently it doesn't. I've being trying to create wallets and recover them.

Could it be anything related to the age of the wallet? Does it need to be included in an "x" number of blocks? Or something with the deterministic seed?

Thanks a million
Bruno


You received this message because you are subscribed to a topic in the Google Groups "bitcoinj" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bitcoinj/EOViGz2xTZw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bitcoinj+u...@googlegroups.com.

Bruno Martins

unread,
May 7, 2017, 1:48:38 PM5/7/17
to bitc...@googlegroups.com
Ok, so i think i've figured it out.

Was not trimming the words the user inputs to recover. The actual words passed to DeterministicSeed were not the same byte-wise.

My bad! :)

Cheers
Bruno

Tam Dinh

unread,
Aug 18, 2018, 8:45:41 PM8/18/18
to bitcoinj
Hi Andreas,

I have tried RestoreFromSeed code example with my real mnemonic words but the restored wallet always show zero balance without no transaction.
I also tried wallettemplate example but still no luck. Could you give me some advice?

@Bruno, could you share some code that worked for you? I get stuck with this problem also.

Thanks,
Tam
Reply all
Reply to author
Forward
0 new messages