3

I Hope this isn't a duplicated, however I couldn't find anything about this anywhere. Anyways, I am searching for a way of detecting Bitcoin transactions to a given address. I stumbled across Lazy API, however I couldn't find anything about carrying out what it listed, and I am still not sure how to go about detecting transactions to a given address. I went ahead and went to the given link it provided here (and I stumbled across doing using Transaction By Address from the API reference on blockexplorer, but I am still not clear how to go about detecting if I received a transaction.

Please pardon if this is a stupid question, I am a little new to all of this. Edit: I dont wish to relay on another service, unless it is the way Lazy API does it. (Basically complete minimals, from other services.) Also someone asked to clarify what I meant by detect a transaction, what I mean is have server recognize when someone completed a transaction, either notifying me to do something (such as ship a package), or giving them some sort of virtual product.

  • Can you clarify what you mean by detect if you received a transaction? Are you keeping track off addresses on a database? Are you looking for specific code to run once a new transaction is detected on a specific address? How many addresses do you need to do this with? You're going to need to use either a 3rd party API or run bitcoind to query blockchain data. – m1xolyd1an Aug 13 '16 at 4:20
2

Im guessing your on ubuntu because of your username ;)
Step 1 add the bitcoin ppa

sudo apt-add-repository ppa:bitcoin/bitcoin

Step 2 install bitcoind

sudo apt install bitcoind

Step 3 set bitcoind up

Make a config file with the following contents in /home/$USER/.bitcoin/bitcoin.conf
https://github.com/bitcoin/bitcoin/blob/master/contrib/debian/examples/bitcoin.conf
Replace some parts like rpc password etc

Step 4 add walletnotify

Walletnotify will run a shell command everytime something changes in your wallet.
I like this repo.
https://github.com/damonp/walletnotify

I hope this helps! :)

1

1.) Install Bitcoin Core on your server.

2.) Add a line to bitcoin.conf file that will fire when any funds are received to any addresses you're watching (ie. walletnotify=/usr/bin/php /home/coind/notify.php %s). Start bitcoind.

3.) Run "importaddress" function for any addresses you want to watch (ie. bitcoin-cli importaddress 1myaddresshere).

Done. Any time a tx hits any of the addresses you import, notify.php will automatically fire.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.