Bitcoin Forum
November 21, 2017, 01:07:24 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: callback or polling to notify from bitcoind  (Read 4899 times)
ghelyar
Newbie
*
Offline Offline

Activity: 6


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.
1511226444
Hero Member
*
Offline Offline

Posts: 1511226444

View Profile Personal Message (Offline)

Ignore
1511226444
Reply with quote  #2

1511226444
Report to moderator
1511226444
Hero Member
*
Offline Offline

Posts: 1511226444

View Profile Personal Message (Offline)

Ignore
1511226444
Reply with quote  #2

1511226444
Report to moderator
Join ICO Now A blockchain platform for effective freelancing
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511226444
Hero Member
*
Offline Offline

Posts: 1511226444

View Profile Personal Message (Offline)

Ignore
1511226444
Reply with quote  #2

1511226444
Report to moderator
1511226444
Hero Member
*
Offline Offline

Posts: 1511226444

View Profile Personal Message (Offline)

Ignore
1511226444
Reply with quote  #2

1511226444
Report to moderator
1511226444
Hero Member
*
Offline Offline

Posts: 1511226444

View Profile Personal Message (Offline)

Ignore
1511226444
Reply with quote  #2

1511226444
Report to moderator
gweedo
Legendary
*
Offline Offline

Activity: 1246


Java, PHP, HTML/CSS Programmer for Hire!


View Profile WWW
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.

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in https://goseemybits.com/lobby
ghelyar
Newbie
*
Offline Offline

Activity: 6


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: 1246


Java, PHP, HTML/CSS Programmer for Hire!


View Profile WWW
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

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in https://goseemybits.com/lobby
ghelyar
Newbie
*
Offline Offline

Activity: 6


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?
gweedo
Legendary
*
Offline Offline

Activity: 1246


Java, PHP, HTML/CSS Programmer for Hire!


View Profile WWW
November 26, 2013, 03:18:05 PM
 #6

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?

Just use walletnotify and save the transaction ID from each unique, then on block check all the transaction IDs that have yet to reach 6 confirmations.

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in https://goseemybits.com/lobby
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!