WalletAppKit equipment=new WalletAppKit(MainNetParams.get(), new File("."), "mywalletfilename");
equipment.setAutoSave(true);
equipment.startAsync();
equipment.awaitRunning();
equipment.pockets().addEventListener(new WalletListener());
whereas listener seems like:
public class WalletListener extends AbstractWalletEventListener {
public WalletListener() {
}
@Override
public void onCoinsReceived(org.bitcoinj.core.Pockets pockets, Transaction tx, Coin prevBalance, Coin newBalance) {
System.out.println("-----> cash resceived: " + tx.getHashAsString()+" prevBalance = "+prevBalance.getValue()+" newBal="+newBalance.getValue());
System.out.println("acquired: " + tx.getValue(pockets));
}
@Override
public void onTransactionConfidenceChanged(org.bitcoinj.core.Pockets pockets, Transaction tx) {
System.out.println("-----> confidence modified: " + tx.getHashAsString());
TransactionConfidence confidence = tx.getConfidence();
System.out.println("new block depth: " + confidence.getDepthInBlocks());
}
@Override
public void onCoinsSent(org.bitcoinj.core.Pockets pockets, Transaction tx, Coin prevBalance, Coin newBalance) {
System.out.println("cash despatched");
}
@Override
public void onReorganize(org.bitcoinj.core.Pockets pockets) {
}
@Override
public void onWalletChanged(org.bitcoinj.core.Pockets pockets) {
}
@Override
public void onKeysAdded(Record<ECKey> keys) {
System.out.println("new key added");
}
/*@Override
public void onScriptsAdded(Pockets pockets, Record<Script> scripts) {
System.out.println("new script added");
}*/
}
Needs to be working sufficient for receiving BTC 😉 dont overlook TXConfidence modified the place it tells you that TX confirmations rely modified and to what it modified…
😉