Bitcoin Forum
April 25, 2024, 01:31:11 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: How to watch confirmations on set of transactions?  (Read 4918 times)
BitvoinVender
Newbie
*
Offline Offline

Activity: 46
Merit: 0


View Profile
September 21, 2013, 07:07:52 PM
 #21

bitcoin-qt has a pop up window in the gui, is it really that big a stretch to get bitcoind to be able to run(or just trigger) a 3rd party script for notification when it receives a payment?

Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
September 21, 2013, 07:12:15 PM
 #22

bitcoin-qt has a pop up window in the gui, is it really that big a stretch to get bitcoind to be able to run(or just trigger) a 3rd party script for notification when it receives a payment?

Read about the -walletnotify parameter to bitcoind.
adrian33 (OP)
Member
**
Offline Offline

Activity: 118
Merit: 10


View Profile
September 22, 2013, 07:10:00 AM
 #23

Bitcoind is informing a Lisp program of new blocks and the blockchain is stored using an indexed postgresql database for specific lookups (it's much faster to do it that way.) Then there's user and notification functionality on top of that. I didn't code it. I have some other ideas, but was wondering if anyone has any feature requests.

Eternity
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
September 23, 2013, 11:53:58 AM
 #24

Quote from: dserrano5

Read about the -walletnotify parameter to bitcoind.

When installed in ubuntu doesnot show that
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
September 23, 2013, 12:28:48 PM
 #25

Quote from: dserrano5

Read about the -walletnotify parameter to bitcoind.

When installed in ubuntu doesnot show that

It's not an RPC command, but a command line parameter that is to be used when you first run bitcoind. So shutdown bitcoind and run:

Code:
bitcoind --help

To see that it's actually there. Then run:

Code:
bitcoind -walletnotify='some command here' &

To enjoy the action Wink.
Eternity
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
September 24, 2013, 07:10:00 AM
 #26

Works thank you
adrian33 (OP)
Member
**
Offline Offline

Activity: 118
Merit: 10


View Profile
November 23, 2013, 06:06:50 PM
 #27

Just out of interest, are there any Lisp people out there that would want to work on this site... maybe to make it open source...

http://donebit.com

- anyone that works on it could receive some equity in it.

Amitabh S
Legendary
*
Offline Offline

Activity: 1001
Merit: 1003


View Profile
January 14, 2015, 08:23:00 PM
 #28

With bitcoinj you can use a depth future. Something like the following would work (not compiled or testing, just typed from memory):

Code:

byte[] pubkeybytes = ....;

Wallet wallet = new Wallet(params);
wallet.addKey(new ECKey(null, pubkeybytes));

... (insert usual boilerplate setup here) ...

wallet.addEventListener(new AbstractWalletEventListener() {
    public void onCoinsReceived(Wallet wallet, Transaction tx, BigInteger prevBalance, BigInteger newBalance) {
        // Transaction was received. Get a callback when 4 confirmations have occurred.
        ListenableFuture<Transaction> future = tx.getConfidence().getDepthFuture(4);
        Futures.addCallback(future, new FutureCallback<Transaction>() {
            public void onSuccess(Transaction tx) {
                System.out.println("Transaction " + tx + " now has 4 confirmations - party time!!");
            }
        });
    }
});

The syntax is a bit verbose - languages like Java 8 or Kotlin have some features to make it more fluid, if you don't mind what language you use. Also, if your app restarts, you'll have to re-register the confidence listeners on the loaded wallet of course.

Thanks Mike - I think the key is to differentiate watching confirmations for a private wallet and watching them for a public blockchain. For my application, it's all about OPCs -- other people's confirmations, because I want to separate the new app from my wallet app. Does bitcoinj allow that?

A Confirmation Party site would be good... you could have a $20,000 confirmation party room and a $500,000 room - social networking for high rollers.

The key issue is scalability. If you want to monitor tens of thousands of keys/transactions, bitcoinj probably won't scale to what you need. If you want to monitor less than that, it might work. You could try it.

Hi Mike,

How about the ability to watch for confirmations on arbitrary addresses since the last app start. Does this exist? If not I'm thinking of the following

1. Listen for tx, assign 0 conf.
2. Keep track of blocks, and the tx inside them, incrementing the confirmations
3. As it reaches threshold, notify and remove from list

Would be great if this already exists.

BTW, Scala is also quite less verbose than Java Smiley

Coinsecure referral ID: https://coinsecure.in/signup/refamit (use this link to signup)
oldbute
Jr. Member
*
Offline Offline

Activity: 59
Merit: 10


View Profile
January 15, 2015, 01:25:40 AM
 #29

Curious to know how programs like this (block explorers, watchers) handle re-orgs.   What is the process to discover a block has been replaced?  Seems possible # of confirmations on a TX could be decreased in same cases which would invalidate those types of notifications.
Pages: « 1 [2]  All
  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!