15

I have bitcoin daemon and I want to use the walletnotify option with a json-rpc call. Some of the examples use a "transaction.sh" file for walletnotify. What is it for?

What do I have to write in that sh file, to make walletnotify work for more than 6 confirmations.

22

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.

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.