<p>I don't know exactly what you are asking, but</p>

<p><strong>wallet.cpp (from line 591)</strong></p>

<pre><code>    // 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
    }
</code></pre>

<p>runs a thread that executes the <code>runCommand()</code> function in <code>util.cpp</code></p>

<p><strong>wallet.cpp (from line 1335)</strong></p>

<pre><code>void runCommand(std::string strCommand)
{
    int nErr = ::system(strCommand.c_str());
    if (nErr)
        LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}
</code></pre>

<p>and I think that is all code you need.</p>

CC BY-SA 3.0
2014-06-24T15:45:53.587Z
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
CC BY-SA 3.0
2014-06-24T19:32:38.443Z
There is no `walletnotify()` function. All logic is in these two snippets.
Jori
CC BY-SA 3.0
2014-06-25T07:15:47.600Z
Hmm, sad they didn't make it a function... Thanks and I'll ask again if I got more questions.
Kaninchen
CC BY-SA 3.0
2014-06-24T10:35:26.790Z
2014-06-24T10:35:26.790Z
Jori
<p>I'm new on the BTC project, so please spare me if I asked something newbies.</p>

<p>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".</p>

<p>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.</p>

CC BY-SA 3.0
2014-07-05T20:31:33.287Z
Instead of modifying the actual bitcoin code, which is often very error prone, it may be better to trigger some api request upon walletnotify.
Loourr
<bitcoind><api>
Where is the exact code part of the walletnotify function?
Kaninchen
# Where is the exact code part of the walletnotify function?

(Asked by: username_0 on 2014-06-23)

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.

**Tags:** bitcoind, api

> **Comments:**
> **username_1**: Instead of modifying the actual bitcoin code, which is often very error prone, it may be better to trigger some api request upon walletnotify.  

---

## 1 answers

### Answer by username_2 on 2014-06-24. Score: 3 | Accepted answer

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.

> **Comments:**
> **username_0**: 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;  
> **username_2**: There is no `walletnotify()` function. All logic is in these two snippets.  
> **username_0**: Hmm, sad they didn't make it a function... Thanks and I'll ask again if I got more questions.  

---

