Bitcoin Forum
May 08, 2024, 10:24:25 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Wallet notify sometimes doesn't notify  (Read 213 times)
whong91 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
May 06, 2018, 04:35:15 PM
 #1

I've setup my own server to run bitcoind, and I've used walletnotify to update incoming transactions into database through CURL php script. But I noticed not all incoming transactions were recorded after I my testing. The coins I sent were all received in the server, but database only recorded part of it, so I doubt walletnotify didn't notify in some cases. Any idea what's the cause for this?  Huh
1715163865
Hero Member
*
Offline Offline

Posts: 1715163865

View Profile Personal Message (Offline)

Ignore
1715163865
Reply with quote  #2

1715163865
Report to moderator
1715163865
Hero Member
*
Offline Offline

Posts: 1715163865

View Profile Personal Message (Offline)

Ignore
1715163865
Reply with quote  #2

1715163865
Report to moderator
1715163865
Hero Member
*
Offline Offline

Posts: 1715163865

View Profile Personal Message (Offline)

Ignore
1715163865
Reply with quote  #2

1715163865
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715163865
Hero Member
*
Offline Offline

Posts: 1715163865

View Profile Personal Message (Offline)

Ignore
1715163865
Reply with quote  #2

1715163865
Report to moderator
1715163865
Hero Member
*
Offline Offline

Posts: 1715163865

View Profile Personal Message (Offline)

Ignore
1715163865
Reply with quote  #2

1715163865
Report to moderator
1715163865
Hero Member
*
Offline Offline

Posts: 1715163865

View Profile Personal Message (Offline)

Ignore
1715163865
Reply with quote  #2

1715163865
Report to moderator
Sellingaccs
Member
**
Offline Offline

Activity: 126
Merit: 50

Ask me for Pools, Nodes and Explorers.


View Profile
May 06, 2018, 04:47:07 PM
 #2

I think that it might be a bug with your script rather than bitcoin software. No one can help you, if you don't show the script to us.

bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
May 07, 2018, 07:23:44 AM
Last edit: May 09, 2018, 08:04:55 AM by bob123
 #3

Did you check your logs whether your script does work properly?
You can log any event you wish with the -debug parameter. To enable debug log, put -debug=rpc as commandline parameter when starting bitcoind.
Chances are high there is a small bug in your script logic.


Basically a script would look like this if you call it with 'bitcoind -walletnotify=/path/to/script.php %s':
Code:
<?php
$tx 
$argv[1];
$txinfo json_decode( `bitcoin-cli gettransaction $tx` );
if( 
$txinfo['confirmations'] >= ) {
    
// update mysql if necessary.
}


Keep in mind that walletnotify does get called two times. First time it received a transaction and after it got one confirmation.
If you want to track whether a specific TX got more than one confirmation, you have to use blocknotify.

starmyc
Full Member
***
Offline Offline

Activity: 198
Merit: 130

Some random software engineer


View Profile
May 08, 2018, 08:18:20 PM
Merited by achow101 (2), bob123 (1)
 #4

Basically a script would look like this if you call it with 'bitcoind -walletnotify=/path/to/script.php %s':
Code:
<?php
$tx 
$argv[1];
$txinfo json_decode( `bitcoin-cli gettransaction $tx` );
if( 
$txinfo['confirmations'] >= ) {
    
// update mysql if necessary.
}

Keep in mind that walletnotify does get called two times. First time it received a transaction and after it got one confirmation.
If you want to track whether a specific TX got more than one confirmation, you have to use blocknotify.

Just a quick head up: As you hinted, walletnotify is only ran when tx is received in the mempool (confirmation = 0) & when included in a block (confirmation = 1), but you wrote 
Code:
if( $txinfo['confirmations'] >= 3 ) 

It is likely confirmation >= 3 will never be executed.

Hi, I'm just some random software engineer.
You can check my projects: Bitcoin & altcoin balances/addresses listing dumps: https://balances.crypto-nerdz.org/
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
May 09, 2018, 08:05:04 AM
 #5

Just a quick head up: As you hinted, walletnotify is only ran when tx is received in the mempool (confirmation = 0) & when included in a block (confirmation = 1), but you wrote 
Code:
if( $txinfo['confirmations'] >= 3 ) 

It is likely confirmation >= 3 will never be executed.

You are right. I somehow missed this  Grin
Thanks for correcting me, i edited my post. I appreciate it.

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!