He creado una billetera de reloj.
Wallet wallet = Wallet.fromWatchingKeyB58(params, tPub, DeterministicHierarchy.BIP32_STANDARDISATION_TIME_SECS);
¿Cómo puedo vincular esto con la cadena de bloques? Estoy usando la clase WalletAppKit.
kit = new WalletAppKit(params, walletFile, APP_NAME);
kit.startAsync(); kit.awaitRunning();
después de eso, agrego la billetera en PeerGroup, kit.peerGroup().addWallet(wallet)
luego imprimo la dirección de una billetera System.out.println(kit.wallet().currentReceiveAddress());
, pero esta dirección y System.out.println(wallet.currentReceiveAddress());
esta no son las mismas. estoy usando bitcoinj para esto, he enviado varias transacciones wallet.currentReceiveAddress()
pero no he recibido ninguna de ellas, no sé qué estoy haciendo mal aquí, ¡ayuda amablemente!
He hecho esto anulando los métodos de WalletAppkit y funciona bien ahora, aquí hay un ejemplo de código para esto.
kit = new WalletAppKit(params, walletFile, APP_NAME) {
@Override
protected Wallet createWallet() {
System.out.println("I am here");
Wallet wallet = Wallet.fromWatchingKeyB58(params, tPub, DeterministicHierarchy.BIP32_STANDARDISATION_TIME_SECS);
return wallet;
}
@Override
protected void onSetupCompleted() {
super.onSetupCompleted();
System.out.println(kit.wallet().currentReceiveAddress());
System.out.println(kit.wallet().getTotalReceived().toFriendlyString());
txHistory();
kit.wallet().addEventListener(new AbstractWalletEventListener() {
@Override
public void onWalletChanged(Wallet wallet) {
System.out.println(kit.wallet().getTotalReceived());
}
});
}