Bitcoin Forum
May 23, 2024, 10:22:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: WalletEventListener  (Read 2821 times)
profil3r (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
October 22, 2014, 03:06:55 PM
Last edit: October 22, 2014, 11:02:10 PM by profil3r
 #1

Just started messing around with bitcoinj 0.12 in eclipse as a java-newbie.

My simple goal is an app that tells me when a given address of my Wallet received coins.
pretty sure I have to use:

Code:
wallet.addEventListener(new AbstractWalletEventListener() {
public void onCoinsReceived(Wallet w, Transaction tx,
BigInteger prevBalance, BigInteger newBalance) {

System.out.println("You have received some Coins");

}
});

But how can I specify the wallet respectively the address that I want to be watched.
I can't figure it out with the help of the documentation:(
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526
Merit: 1129


View Profile
November 05, 2014, 01:30:12 PM
 #2

If it's an address the wallet generated itself, it'll already be "watched". If you want to watch an address you don't have the key for, use wallet.addWatchedAddress.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!