Author

Topic: Bitcoind new tx callback (Read 1360 times)

newbie
Activity: 22
Merit: 0
November 11, 2013, 12:58:46 PM
#3
Perfect, thanks!

I added the following to bitcoin.conf:
walletnotify=/foo/walletnotify.sh %s

And walletnotify.sh simply wgets to localhost. The shell script works when calling it on the Mac Os X terminal. I've given the script file full permissions to all groups. However, Bitcoind gives the following error when issuing a notify:

runCommand error: system(/foo/walletnotify.sh 5d8fb8dbd106f862cbf80be514e0ea2ad7b4136cbd1c3b91299e5325687529ba) returned 32512

I found the place where this call is made https://github.com/bitcoin/bitcoin/blob/f76c122e2eac8ef66f69d142231bd33c88a24c50/src/wallet.cpp#L497, but wasn't able to find what is happening inside the t() method.

Any ideas as to why this isn't working?

EDIT: I'm using Bitcoin-Qt 0.8.5-beta

EDIT 2: http://stackoverflow.com/questions/5638321/why-child-process-returns-exit-status-32512-in-unix gave an idea to try
walletnotify=sh -c '/foo/walletnotify.sh %s' but to no avail.

EDIT 3: Ah, here it is https://github.com/bitcoin/bitcoin/blob/16d5f2c5e0a7276fb2b09d8dd51b7bac2753c4cc/src/util.cpp#L1490 and it indeed seems to be using system().

EDIT 4 (SOLVED): Apparently the call isn't executed in a shell env, and so the wget inside the .sh needs to be called with an abs path.
sr. member
Activity: 321
Merit: 250
November 10, 2013, 08:42:46 PM
#2
./bitcoind --help | grep notify
  -blocknotify=     Execute command when the best block changes (%s in cmd is replaced by block hash)
  -walletnotify=    Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)
  -alertnotify=     Execute command when a relevant alert is received (%s in cmd is replaced by message)


google above commands for more info.
newbie
Activity: 22
Merit: 0
November 10, 2013, 08:33:22 PM
#1
Quick question I didn't find an answer to: Is there a (subscribable) callback mechanism in Bitcoind for new tx or do you need to use polling? How do you typically solve this, if you need to push the available funds to the user when their deposit clears out?
Jump to: