Bitcoin Forum
May 02, 2024, 01:50:29 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: WalletEventListener  (Read 2820 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:(
1714657829
Hero Member
*
Offline Offline

Posts: 1714657829

View Profile Personal Message (Offline)

Ignore
1714657829
Reply with quote  #2

1714657829
Report to moderator
1714657829
Hero Member
*
Offline Offline

Posts: 1714657829

View Profile Personal Message (Offline)

Ignore
1714657829
Reply with quote  #2

1714657829
Report to moderator
1714657829
Hero Member
*
Offline Offline

Posts: 1714657829

View Profile Personal Message (Offline)

Ignore
1714657829
Reply with quote  #2

1714657829
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714657829
Hero Member
*
Offline Offline

Posts: 1714657829

View Profile Personal Message (Offline)

Ignore
1714657829
Reply with quote  #2

1714657829
Report to moderator
1714657829
Hero Member
*
Offline Offline

Posts: 1714657829

View Profile Personal Message (Offline)

Ignore
1714657829
Reply with quote  #2

1714657829
Report to moderator
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!