Bitcoin Forum
May 17, 2024, 01:04:50 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Receive Payment Notification  (Read 1213 times)
williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
July 30, 2014, 04:03:07 AM
 #1

I am currently developing a lot of bitcoin sites, all which involve receiving a payment from a buyer. Currently I am using APIs from blockchain and bitcoinmonitor to send payments and get notifications on a payment, but I am converting fully to a daemon, and I need to know how to receive and process transactions, without getting an http notification. So I saw a RPC command: listsinceblock and listtransactions, and those are probably the only solutions, and I know I need to use a cronjob, which I am familiar with. I was thinking of using a cronjob every 5 minutes to do listtransactions, but I will always get old transactions. I was also thinking of doing listsinceblock every 10 minutes, and just get the transactions within the previous block, therefore not getting any old transactions. I know you can use wallet notify in bitcoin-qt, but I am using blockchains daemon, and I don't know how I could get a daemon host (vps too expensive), because I can't leave my computer on all the time, and I can't trust my internet for 100% uptime for a large website.
How would I go about solving this problem? I really need to figure this out.
Thanks for any help!

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 30, 2014, 04:19:29 AM
 #2

Use walletnotify and blocknotify so your backend is aware when a new payment is received and when a new block is added to the chain.  I am not sure why you think they only work with the GUI, they are normally used with bitcoind.
williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
July 30, 2014, 04:48:37 AM
 #3

Use walletnotify and blocknotify so your backend is aware when a new payment is received and when a new block is added to the chain.  I am not sure why you think they only work with the GUI, they are normally used with bitcoind.
How would I use this with the blockchain bitcoind though, because wouldn't I have to specify a file to run when there is a notification? ANd when I run this walletnotify command, would it stay on? Please explain how this would work please, I would be very grateful if you did.

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
isidore
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile
July 30, 2014, 07:34:46 AM
 #4

you add the script to run in your bitcoin.conf:

blocknotify=<name of script> %s
walletnotify=<name of script> %s
alertnotify=<name of script> %s

and when blocks or notifications come in the script will be called with arguments.

for example if you use blocknotify the argument will be the block id e.g. 000000000000000003a5ff0d28a8f9b71623c2328727937160582d1b44cb3cec, if you use walletnotify then the argument will be the new transaction id that came in, e.g. 1e621e60f7ea7195ff1ec7c31867dc7c9d896123ead6ec43f053f51137c31676

make yourself a script (python or your favorite language) that logs the arguments somewhere and test it out with the scenarios you want.
williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
July 30, 2014, 05:46:54 PM
 #5

you add the script to run in your bitcoin.conf:

blocknotify=<name of script> %s
walletnotify=<name of script> %s
alertnotify=<name of script> %s

and when blocks or notifications come in the script will be called with arguments.

for example if you use blocknotify the argument will be the block id e.g. 000000000000000003a5ff0d28a8f9b71623c2328727937160582d1b44cb3cec, if you use walletnotify then the argument will be the new transaction id that came in, e.g. 1e621e60f7ea7195ff1ec7c31867dc7c9d896123ead6ec43f053f51137c31676

make yourself a script (python or your favorite language) that logs the arguments somewhere and test it out with the scenarios you want.
Yes that is what I would like to do, but I am using the blockchain daemon, so I don't have access to their file system or anything. Would it be possible to notify a outside course, like on my website? I don't know if walletnotify works on the blockchain daemon, does anyone know?

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 30, 2014, 05:49:56 PM
 #6

The blockchain API doesn't support walletnotify or blocknotify.  It is unclear what you mean by "converting fully to a daemon" I incorrectly assumed that would mean you are planning on using bitcoind (the bitcoin daemon) locally but that doesn't seem to be the case.
williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
July 30, 2014, 05:52:15 PM
 #7

The blockchain API doesn't support walletnotify or blocknotify.  It is unclear what you mean by "converting fully to a daemon" I incorrectly assumed that would mean you are planning on using bitcoin (the bitcoin daemon) locally.
I am trying to convert my script fully to daemon, instead of having to make accounts and setup those accounts. Instead, you just put in your daemon information, and everything is ready to go. I can't host a daemon on my computer, because I can't trust my internet or computer to be on 100% of the time for a website, and vps is expensive.

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
Envrin
Sr. Member
****
Offline Offline

Activity: 318
Merit: 251



View Profile
August 01, 2014, 10:03:02 AM
 #8


I think your best bet is to make more money first, and get a dedicated server that you can run bitcoind on.  Please note, a lot of VPS's out there will kick you off if you're running bitcoind, as it's pretty resource intensive, especially at the beginning while it's downloading the blockchain.

williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
August 01, 2014, 07:00:02 PM
 #9


I think your best bet is to make more money first, and get a dedicated server that you can run bitcoind on.  Please note, a lot of VPS's out there will kick you off if you're running bitcoind, as it's pretty resource intensive, especially at the beginning while it's downloading the blockchain.


I think I found a solution. I would find the last block, then do getsinceblock every 10 minutes using a cronjob, and get the txid and then get more info from there (blockchain.info/rawtx).

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
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!