Pages:
Author

Topic: How to use Walletnotify? (Read 19054 times)

newbie
Activity: 47
Merit: 0
January 15, 2018, 09:09:46 AM
#41
Walletnotify has limitations for use in bitcoin.conf once it happens or can be used many times, whichever one is better and easier to use so we need to be able to set a specific number. as it can help for a callback.
newbie
Activity: 15
Merit: 0
January 15, 2018, 07:20:33 AM
#40
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.

Sorry for the (very) late reply, but I still don't see how that brings me closer to why I get an error code?
Thanks.
full member
Activity: 182
Merit: 100
December 03, 2017, 03:22:57 PM
#39
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.
newbie
Activity: 15
Merit: 0
December 03, 2017, 06:47:08 AM
#38
Hey,

When I try to run wallet notify on a script I get this error:

Code:
2017-12-03 11:26:40 AddToWallet 8525ace8b3bac67a39b28d18f96186e3a76598fd36fe6f4b242c8f4ff2defa2a  new
2017-12-03 11:26:40 runCommand error: system(/home/pi/.bitcoin/pay.py 8525ace8b3bac67a39b28d18f96186e3a76598fd36fe6f4b242c8f4ff2defa2a) returned 512


The script is in the .bitcoin folder and has the these permissions:
-rwxr-xr-x  1 pi pi      150 Nov 28 12:09 pay.py

Anybody know how to make it work?

Thanks.
hero member
Activity: 525
Merit: 531
September 25, 2015, 06:25:22 AM
#37
Code:
walletnotify=cmd-A && cmd-B

I'm guessing the second is better, if the first is even possible.  While I am asking, how about alertnotify and blocknotify?

 Huh

walletnotify=/usr/local/bin/notifyscript.sh

and you can call any commands in the script.
full member
Activity: 223
Merit: 132
September 24, 2015, 10:58:52 PM
#36
Is walletnotify limited to one occurrence in bitcoin.conf, or can it be used multiple times?  Which one below would be better to use, or something different?

Code:
walletnotify=cmd-A
walletnotify=cmd-B

or

Code:
walletnotify=cmd-A && cmd-B

I'm guessing the second is better, if the first is even possible.  While I am asking, how about alertnotify and blocknotify?

 Huh
newbie
Activity: 1
Merit: 0
January 23, 2015, 03:57:48 AM
#35
In bitcoind.conf:
walletnotify=C:\Users\User\AppData\Roaming\Bitcoin\walletnotify.sh %s
In walletnotify.sh:
#!/bin/bash
F=walletnotify_log.txt
D=`date +"%Y%m%d%H%M%S"`
echo ${D} - ${1}>> ${F}
I Click the walletnotify.sh,and i can see 20150123105344 - in the walletnotify_log.txt.
When i deposit bitcoin,just see the flashing window(cmd window).i can't see the new Date and transactions.
what wrong?
may i use walletnotify on Window 7 ?
Best Regards.
full member
Activity: 140
Merit: 100
ACCOUNT BANNED. Email in sig!!
September 08, 2014, 08:30:24 PM
#34
On the server I used for testing, in my bitcoin.conf:
Code:
walletnotify=/home/btcdev/walletnotify.sh %s
blocknotify=/home/btcdev/blocknotify.sh %s

The %s in the command line gets replaced with the (ASCII) hex string of the transaction hash, just like -blocknotify replaces it with the block hash.

And the program can be as simple or as complicated as you like.  Here is a simple shell script:

Code:
#!/bin/bash
F=/home/btcdev/wallet_transaction_log
D=`date +"%Y%m%d%H%M%S"`
echo ${D} - ${1} >> ${F}

which gives lines like:

Code:
20130513123015 - 6fa6c8ff08f122327b7a0a329d7632f243038f0fc96cce1248cb4948d0509ecf

You aren't limited to shell scripts, of course.

A pipe would have been better, but they aren't portable.  Even if we had been willing to limit it to just UNIX-ish systems, there would have been horrible locking problems, and these notices simply weren't worth the effort to work around them*.  If you want similar behavior, you can fake a pipe with netcat, so that you could have a long running service that accepts TCP connections from localhost, and just call netcat to dump the txid to that socket.

*  Did you know that named pipes can stall in both directions, potentially DOSing one of the client threads?  There are ways around it, of course, but you have to throw out a lot of the abstractions, so there would have been a very un-C++ chunk of code in the bitcoin client, just for dealing with the pipes.  At least that was how it looked to me when I was researching it.  I don't do much with C++, so I'm hoping that someone in the audience is more skilled than I am, and will read this and say "You dumbass, why didn't you just do X?", or even better, rewrite it for me.  Smiley

Hey, anybody else has issue in bitcoind with walletnotify that on first confirmation it shoots the curl twice immidiately and when checking the wallet_transaction_log file, there is also same txid written twice. so the issue is not in my built API server, but in bitcoind. any clues?
To prevent the bad things coming from this error just check for previous transaction duplicate in your script
newbie
Activity: 27
Merit: 0
September 08, 2014, 03:34:53 PM
#33
On the server I used for testing, in my bitcoin.conf:
Code:
walletnotify=/home/btcdev/walletnotify.sh %s
blocknotify=/home/btcdev/blocknotify.sh %s

The %s in the command line gets replaced with the (ASCII) hex string of the transaction hash, just like -blocknotify replaces it with the block hash.

And the program can be as simple or as complicated as you like.  Here is a simple shell script:

Code:
#!/bin/bash
F=/home/btcdev/wallet_transaction_log
D=`date +"%Y%m%d%H%M%S"`
echo ${D} - ${1} >> ${F}

which gives lines like:

Code:
20130513123015 - 6fa6c8ff08f122327b7a0a329d7632f243038f0fc96cce1248cb4948d0509ecf

You aren't limited to shell scripts, of course.

A pipe would have been better, but they aren't portable.  Even if we had been willing to limit it to just UNIX-ish systems, there would have been horrible locking problems, and these notices simply weren't worth the effort to work around them*.  If you want similar behavior, you can fake a pipe with netcat, so that you could have a long running service that accepts TCP connections from localhost, and just call netcat to dump the txid to that socket.

*  Did you know that named pipes can stall in both directions, potentially DOSing one of the client threads?  There are ways around it, of course, but you have to throw out a lot of the abstractions, so there would have been a very un-C++ chunk of code in the bitcoin client, just for dealing with the pipes.  At least that was how it looked to me when I was researching it.  I don't do much with C++, so I'm hoping that someone in the audience is more skilled than I am, and will read this and say "You dumbass, why didn't you just do X?", or even better, rewrite it for me.  Smiley

Hey, anybody else has issue in bitcoind with walletnotify that on first confirmation it shoots the curl twice immidiately and when checking the wallet_transaction_log file, there is also same txid written twice. so the issue is not in my built API server, but in bitcoind. any clues?
newbie
Activity: 27
Merit: 0
September 02, 2014, 01:50:29 AM
#32
Lets say I was using a blockchain.info daemon, how would I use walletnotify from them. Would that be possible? I'd prefer not to run a VPS but I might if I have to. My home network and computer wouldn't be trustworthy enough to be used for a public business with hundreds of customers.

If you want to be notified about a transaction in your blockchain.info wallet, just use the http callback.
When a transaction comes in, you get a call back every new block until you acknowlegde it.
I have tried blockchain's callbacks before, but they do not work. Sometimes they send duplicates, sometimes they don't even send at all, and they send the wrong information.

Yeah, the http callback is not a really reliable source. You can't count on it for managing a transaction database, and should always have a second system in place to check payments. It is more like a gadget.
Duplicates can be send if the acknowlegdment hasn't arrived correctly. Nothing receiving at all can be caused by, well, the same reason why you can't connect to a website some times. Receiving wrong information I haven't experienced using the callback function, so I can't say anything about that.

If you want something really reliable, you haven't a lot of options I can think of. It's an http callback from block chain, or a bitcoin deamon at home with wallet notify, or custom made software that acts like a bitcoin node. Maybe there is some other software around that is better suited for these kind of things? What exactly are your requirements?
Would be also interested on other opinions besides bitcoind on using for example btcd, bitcoinj, libbitcoin full node implementations?
sr. member
Activity: 332
Merit: 250
AwesomeDice.net
August 13, 2014, 03:28:47 AM
#31
Then you don't really need a notification, right? Or would you like your costumers to see an instant notification of a transaction?
full member
Activity: 140
Merit: 100
ACCOUNT BANNED. Email in sig!!
August 12, 2014, 03:11:36 PM
#30
Wat I did is make a script which automatically sorts get transactions every 15 seconds with a cron job, and it works well. It can handle 10 transactions every 15 seconds, and I can easily make it more.
sr. member
Activity: 332
Merit: 250
AwesomeDice.net
August 12, 2014, 03:03:19 PM
#29
Lets say I was using a blockchain.info daemon, how would I use walletnotify from them. Would that be possible? I'd prefer not to run a VPS but I might if I have to. My home network and computer wouldn't be trustworthy enough to be used for a public business with hundreds of customers.

If you want to be notified about a transaction in your blockchain.info wallet, just use the http callback.
When a transaction comes in, you get a call back every new block until you acknowlegde it.
I have tried blockchain's callbacks before, but they do not work. Sometimes they send duplicates, sometimes they don't even send at all, and they send the wrong information.

Yeah, the http callback is not a really reliable source. You can't count on it for managing a transaction database, and should always have a second system in place to check payments. It is more like a gadget.
Duplicates can be send if the acknowlegdment hasn't arrived correctly. Nothing receiving at all can be caused by, well, the same reason why you can't connect to a website some times. Receiving wrong information I haven't experienced using the callback function, so I can't say anything about that.

If you want something really reliable, you haven't a lot of options I can think of. It's an http callback from block chain, or a bitcoin deamon at home with wallet notify, or custom made software that acts like a bitcoin node. Maybe there is some other software around that is better suited for these kind of things? What exactly are your requirements?
full member
Activity: 140
Merit: 100
ACCOUNT BANNED. Email in sig!!
August 12, 2014, 12:33:14 PM
#28
Lets say I was using a blockchain.info daemon, how would I use walletnotify from them. Would that be possible? I'd prefer not to run a VPS but I might if I have to. My home network and computer wouldn't be trustworthy enough to be used for a public business with hundreds of customers.

If you want to be notified about a transaction in your blockchain.info wallet, just use the http callback.
When a transaction comes in, you get a call back every new block until you acknowlegde it.
I have tried blockchain's callbacks before, but they do not work. Sometimes they send duplicates, sometimes they don't even send at all, and they send the wrong information.
sr. member
Activity: 332
Merit: 250
AwesomeDice.net
August 11, 2014, 03:11:30 AM
#27
Lets say I was using a blockchain.info daemon, how would I use walletnotify from them. Would that be possible? I'd prefer not to run a VPS but I might if I have to. My home network and computer wouldn't be trustworthy enough to be used for a public business with hundreds of customers.

If you want to be notified about a transaction in your blockchain.info wallet, just use the http callback.
When a transaction comes in, you get a call back every new block until you acknowlegde it.
full member
Activity: 140
Merit: 100
ACCOUNT BANNED. Email in sig!!
August 11, 2014, 12:15:03 AM
#26
Lets say I was using a blockchain.info daemon, how would I use walletnotify from them. Would that be possible? I'd prefer not to run a VPS but I might if I have to. My home network and computer wouldn't be trustworthy enough to be used for a public business with hundreds of customers.
full member
Activity: 238
Merit: 109
March 18, 2014, 09:05:53 AM
#25
DDOS?  zero.  There is no amplification, no redirection.

Someone can try to DOS you.  But it'll be expensive.  Your node will spawn a process for each transaction that hits your wallet, not for each output.  You should strive to make the spawned process as light and short lived as possible, but for the most part, there isn't much danger.

For reference, it actually runs the script twice, once when you first hear of it, once when it hits one confirmation (And thus hits the blockchain).
Is there a possibility to make it runs the script after one confirmation ? I'm trying to make a callback after at least three confirmations.

Add TXID to DB after it calls it at one confirmation (To prevent against mutational, tell the user you received it at zero, however), then listen for blocknotify, on blocknotify, grab the TXID info from bitcoind again and update the confirmation. It should always be lastone+1, but, don't assume that, bugs can happen if you do, grab a new copy of the TX from bitcoind and update the confirmation from there.
newbie
Activity: 2
Merit: 0
March 18, 2014, 09:01:45 AM
#24
DDOS?  zero.  There is no amplification, no redirection.

Someone can try to DOS you.  But it'll be expensive.  Your node will spawn a process for each transaction that hits your wallet, not for each output.  You should strive to make the spawned process as light and short lived as possible, but for the most part, there isn't much danger.

For reference, it actually runs the script twice, once when you first hear of it, once when it hits one confirmation (And thus hits the blockchain).
Is there a possibility to make it runs the script after one confirmation ? I'm trying to make a callback after at least three confirmations.
full member
Activity: 238
Merit: 109
March 18, 2014, 08:39:05 AM
#23
DDOS?  zero.  There is no amplification, no redirection.

Someone can try to DOS you.  But it'll be expensive.  Your node will spawn a process for each transaction that hits your wallet, not for each output.  You should strive to make the spawned process as light and short lived as possible, but for the most part, there isn't much danger.

For reference, it actually runs the script twice, once when you first hear of it, once when it hits one confirmation (And thus hits the blockchain).
newbie
Activity: 2
Merit: 0
March 18, 2014, 06:44:06 AM
#22
Sorry to bump this topic but i need to ask something.
I tried to test the walletnotify like you and it worked. but my problem is that it notify only after 0 and 1 confirmation then it stops.
I need to know if it is possible to set it for a specific number of confirmation because it will help for a callback. I thought that
it is possible to use minconf in config but when i add it, i do not even get data logged in the file.
Pages:
Jump to: