Title: How to use walletnotify and blocknotify? Post by: cryptoxloubis on February 04, 2014, 12:52:00 PM Well I am developing an application that I want the user to deposit some coins (same for withdrawal). I want to do 2 things:
I have read that with the walletnotify option, a program can be run every time a wallet transaction changes (Can anyone clarify when a wallet transaction changes?). This program (in the walletnotify option) must be really simple and fast thus I cannot use it to achieve no.1 because in order to get the details of the transaction I have to make RPC call which is slow. On the other hand there is the blocknotify option that specifies a program to run every time the best block changes (I still need clarification on when the best block changes?). So how one can achieve these 2 things using walletnotify and/or blocknotify? Thanks! P.S. Newbie here, so be gentle ;) Title: Re: How to use walletnotify and blocknotify? Post by: Automatic on February 04, 2014, 03:38:10 PM How I currently do it:-
bitcoin.conf:- Code: rpcuser=Hellno Then the .sh's are as follows:- alert.sh:- Code: #!/bin/sh block.sh:- Code: #!/bin/sh wallet.sh:- Code: #!/bin/sh In the program itself, I listen on local host like this:- Code: //HTTP objects Then the 'dealwithhttp' is basically a switch statement based on /alert, /block, or, /wallet. /Alert sends me a message directly, /wallet (I.E. payment incoming) applies an update to the DB based on the arguments (Post data), and, messages me also (I like to know!), finally, /block looks for any unconfirmed addresses, and, rechecks them with the bitcoind. Maybe not the best way of doing it, but, a way. As you said you didn't want to do another RPC call, I can't help you, but, least this is a starting place. Code: (Can anyone clarify when a [i]wallet transaction changes[/i]?). From what I've seen, once when it receives a payment, once when it receives the first confirmation (I.E. first time it sees it past the broadcast), and once when you send a payment. |