* need to take the account key (first child of the master key) and provide the public part of that to the watching
* wallet instead. You can do this by calling {@link #getWatchingKey()} and then serializing it with
* {@link org.bitcoinj.crypto.DeterministicKey#serializePubB58(org.bitcoinj.core.NetworkParameters)}. The resulting "xpub..." string encodes
* sufficient information about the account key to create a watching chain via
* {@link org.bitcoinj.crypto.DeterministicKey#deserializeB58(org.bitcoinj.crypto.DeterministicKey, String, org.bitcoinj.core.NetworkParameters)}
* (with null as the first parameter) and then
* {@link DeterministicKeyChain#DeterministicKeyChain(org.bitcoinj.crypto.DeterministicKey)}.
*
which leads to this a bit further down in DeterministicKeyChain.java:
*
An alias for getKeyByPath(getAccountPath())
.
*
*
Use this when you would like to create a watching key chain that follows this one, but can't spend money from it.
* The returned key can be serialized and then passed into {@link #watch(org.bitcoinj.crypto.DeterministicKey)}
* on another system to watch the hierarchy.
*
*
Note that the returned key is not pubkey only unless this key chain already is: the returned key can still
* be used for signing etc if the private key bytes are available.
*/
public DeterministicKey getWatchingKey() {
return getKeyByPath(getAccountPath());
}
Hopefully that helps... Not 100% familiar with the bitcoinj code itself... but recently I have been poking around using python to extract data from MultiBit HD wallets...