Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not get a Wallet by DeterministicKey if the DeterministicKey is over one depth #1363

Closed
waitLin opened this issue Apr 20, 2017 · 2 comments

Comments

@waitLin
Copy link

waitLin commented Apr 20, 2017

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.

@waitLin
Copy link
Author

waitLin commented Apr 21, 2017

What does it mean ? @daymo131308

@qyvlik
Copy link

qyvlik commented Apr 21, 2017

Ask for help please use the mailing list, not the Issues DB

mailing list: https://groups.google.com/forum/#!forum/bitcoinj

@waitLin waitLin closed this as completed Apr 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants