Have you looked at the RestoreFromSeed.java example? It shows how to
restore a wallet from a mnenonic seed.


On 04/21/2017 04:09 AM, [email protected] wrote:
> My code like this
> 
> |NetworkParameters parameters = TestNet3Params.get(); String seedCode =
> "fee scan inform crash three lab wish actress mule defense donkey
> arctic"; String passphrase = ""; Long creationTime = 1492061814L;
> DeterministicSeed seed = new DeterministicSeed(seedCode, null,
> passphrase, creationTime); DeterministicKey masterPriKey =
> HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes());
> DeterministicKey purposePriKey =
> HDKeyDerivation.deriveChildKey(masterPriKey, ChildNumber.ZERO_HARDENED);
> DeterministicKey coinTypePriKey =
> HDKeyDerivation.deriveChildKey(purposePriKey, new ChildNumber(1, true));
> Wallet childWallet = Wallet.fromWatchingKey(parameters,
> coinTypePriKey.dropParent().dropPrivateBytes()); Address address =
> childWallet.currentReceiveAddress(); System.out.println(address); |
> 
> And I get a Execption
> 
> |Exception in thread "main" java.lang.IllegalArgumentException: No key
> found for absolute path M/0H. at
> org.bitcoinj.crypto.DeterministicHierarchy.get(DeterministicHierarchy.java:89)
> at
> org.bitcoinj.crypto.DeterministicHierarchy.deriveChild(DeterministicHierarchy.java:147)
> at
> org.bitcoinj.wallet.DeterministicKeyChain.initializeHierarchyUnencrypted(DeterministicKeyChain.java:439)
> at
> org.bitcoinj.wallet.DeterministicKeyChain.<init>(DeterministicKeyChain.java:326)
> at
> org.bitcoinj.wallet.DeterministicKeyChain.watch(DeterministicKeyChain.java:352)
> at org.bitcoinj.wallet.KeyChainGroup.<init>(KeyChainGroup.java:92) at
> org.bitcoinj.wallet.Wallet.fromWatchingKey(Wallet.java:281) at
> org.bitcoinj.examples.ColdWallet.main(ColdWallet.java:66) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) |
> 
> I think that is true in the error place,
> the |keys.containsKey(absolutePath)| should be true. But it false and
> throw the Exception. Who can tell me why ? Tx.
> 
> -- 
> 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 [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.


-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to