I'm new on the BTC project, so please spare me if I asked something newbies.

I downloaded the latest 0.92 BTC source code and trying to make a customize to the walletnotify function for myself while running the bitcoind. But when I search into the code, that triggered runCommand() at util.cpp and pew "End of the road".

I googled about this walletnotify function, but all I seemed are only the usage infos. So I think it's time to ask the question here but thinking the dead-end by myself.


1 Answer 1


I don't know exactly what you are asking, but

wallet.cpp (from line 591)

    // notify an external script when a wallet transaction comes in or is updated
    std::string strCmd = GetArg("-walletnotify", "");

    if ( !strCmd.empty())
        boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
        boost::thread t(runCommand, strCmd); // thread runs free

runs a thread that executes the runCommand() function in util.cpp

wallet.cpp (from line 1335)

void runCommand(std::string strCommand)
    int nErr = ::system(strCommand.c_str());
    if (nErr)
        LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);

and I think that is all code you need.

  • I know this part when I do the search in the entire project. But what I don't get is when I typed the command "bitcoind -walletnotify", there should be have a function named like "walletnotify()" or something similar to send back these incoming transactions that hits the addresses in my wallet. I'm trying to find this function and make some modify to its if conditions and return(or echo) form;
    – Kaninchen
    Commented Jun 24, 2014 at 15:45
  • There is no walletnotify() function. All logic is in these two snippets.
    – Jori
    Commented Jun 24, 2014 at 19:32
  • Hmm, sad they didn't make it a function... Thanks and I'll ask again if I got more questions.
    – Kaninchen
    Commented Jun 25, 2014 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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