3

Walletnotify of my bitcoind occurs three times. Once, when new transaction received and twice when there is a confirmation. I have to know if that ok? Because everywhere I could read, I find, that walletnotify should occur two times only. Once when transaction, once, when first confirmation.

here is a pattern of my bitcoin.conf:

rpcuser=user
rpcpassword=password
walletnotify=/usr/bin/php /path/to/script/notify.php %s

here is a pattern of my script on php :

if(2 == $argc) {
        $bitcoin = new Bitcoin(USER, PASS);

        $transaction = $bitcoin->gettransaction($argv[1]);
        $confCount = $transaction['confirmations'];
        if ($confCount > 0) {

            ob_start();
            var_dump($transaction);
            $output = ob_get_clean();
            file_put_contents('notifylog.txt', $output, FILE_APPEND);
        }
}

It checks whether transaction confirmed or not and performs writing into the log. However It writes 2 times. Why? Should it be like this?

Sabine
  • 323
  • 4
  • 14

1 Answers1

2

this question is old and you probably have found the answer or abandoned already, but anyways: walletnotify notifies you twice in a deposit.

1- Once someone deposited into an address (0 conf)

2- When that transaction gets 1 confirmation.

And it also notifies you if you "withdraw" one address.

Joe Tannoury
  • 145
  • 10
  • I wrote, that it **should** notify twice and I understand that, however in my experience it did, like I described above – Sabine Feb 09 '16 at 16:29
  • @Sabine oh.. my bad. Read it wrongly. So you are getting 2 calls once the transaction has a confirmation? If its the case and that you aren't moving the coins somewhere else right after the conf then there is a problem. – Joe Tannoury Feb 09 '16 at 19:07