Bitcoin Forum
September 03, 2024, 07:24:34 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: callback or polling to notify from bitcoind  (Read 5004 times)
ghelyar (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
November 22, 2013, 03:53:14 PM
 #1

I am a developer using JSON RPC to accept bitcoins as a merchant.

Is there any way to get a callback from bitcoind once a transaction is sufficiently confirmed, or should I just poll it with gettransaction?

I am aware of other existing services but just looking into bitcoind right now.


P.S. I would have posted in the appropriate forum if I could have.
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
November 22, 2013, 03:54:49 PM
 #2

Code:
 -blocknotify=<cmd>     Execute command when the best block changes (%s in cmd is replaced by block hash)

Use that then just check if the transaction has enough confirmations.
ghelyar (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
November 22, 2013, 03:59:51 PM
 #3

Thanks for the quick and succinct reply!

Would walletnotify also work?
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
November 22, 2013, 04:02:37 PM
 #4

Thanks for the quick and succinct reply!

Would walletnotify also work?

Actually that would work better probably. I just woke up so I must be still sleeping LOL
ghelyar (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
November 26, 2013, 11:56:17 AM
 #5

walletnotify only seems to get called on 0 and 1 confirmations. Unless I'm missing something, it seems that if you want to check for more you need to use blocknotify afterwards on the block, poll with gettransaction or allow the user to check the transaction until it is sufficiently confirmed.

gettransaction needs a transaction ID though, which seems to only come from either sendtoaddress, sendfrom or walletnotify, and since sendtoaddress and sendfrom come from the local wallet, that won't work for receiving. I assume raw transactions also can't send from an arbitrary address without being signed by the private key on that address.

Is there any way to get the transaction id when receiving other than walletnotify? listsinceblock?
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!