First you must configure your bitcoin.conf
file for JSON-RPC
rpcallowip=127.0.0.1
rpcuser=yourusername
rpcpassword=reallystrongpasswordthatsnothis
rpcport=7788
walletnotify=/home/scripts/transaction.sh %s
Where transaction.sh
is some bash program. One approach is to have it make an http
request to some process to notify you of the deposit. An example:
#!/bin/sh
curl -d "txid=$1" http://127.0.0.1/some/route
walletnotify
will execute transaction.sh
every time you either
- receive bitcoin
- send bitcoin
- when a bitcoin gets its first confirmation
%s
is the transaction ID or txid
which gets passed to transaction.sh
.