<p>to complement Loourr's answer, <code>%w</code> can also be passed to your script, informing you of the wallet in the node that received the funds, since you may have &gt; 1 wallet</p>

CC BY-SA 4.0
2022-06-30T04:45:27.283Z
2022-06-30T04:45:27.283Z
ekkis
<p>First you must configure your <code>bitcoin.conf</code> file for JSON-RPC</p>

<pre><code>rpcallowip=127.0.0.1
rpcuser=yourusername
rpcpassword=reallystrongpasswordthatsnothis
rpcport=7788
walletnotify=/home/scripts/transaction.sh %s
</code></pre>

<p>Where <code>transaction.sh</code> is some <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">bash</a> program. One approach is to have it make an <code>http</code> request to some process to notify you of the deposit. An example:</p>

<pre><code>#!/bin/sh
curl -d "txid=$1" http://127.0.0.1/some/route
</code></pre>

<p><code>walletnotify</code> will execute <code>transaction.sh</code> every time you either</p>

<ul>
<li>receive bitcoin</li>
<li>send bitcoin</li>
<li>when a bitcoin gets its first confirmation</li>
</ul>

<p><code>%s</code> is the transaction ID or <code>txid</code> which gets passed to <code>transaction.sh</code>.</p>

CC BY-SA 4.0
2019-06-05T18:50:25.790Z
What if I receive more than 1 transaction in a block? Does it spawn a new process/thread using the bash program for each transaction?
pferg
CC BY-SA 4.0
2019-11-06T07:03:38.313Z
@pferg it spaws for each transaction and for each block. the only question is: what if you receive multiple inputs from multiple outputs within 1 transaction. ist that even a thng? (i send you 10x 5 BTC within 1 transaction. i think you receive 1 OP with 50BTC)
Tim Kretschmer
CC BY-SA 3.0
2014-04-10T22:11:56.917Z
2014-12-21T00:49:59.480Z
2014-12-21T00:49:59.480Z
Loourr
<p>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 <code>walletnotify</code>. What is it for?</p>

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

CC BY-SA 3.0
2014-04-10T06:23:35.303Z
Just put a ruby CLI command in the .sh file to run your ruby script. A .sh file is *basically* a command line.
John T
CC BY-SA 3.0
2014-04-10T06:27:53.247Z
Found this thread helpful: https://bitcointalk.org/index.php?topic=203438.0
Mikko Ohtamaa
<wallet><bitcoind><api><json-rpc><wallet-notify>
How do I use walletnotify?
M.R
# How do I use walletnotify?

(Asked by: username_0 on 2014-04-10)

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.

**Tags:** wallet, bitcoind, api, json-rpc, wallet-notify

> **Comments:**
> **username_1**: Just put a ruby CLI command in the .sh file to run your ruby script. A .sh file is *basically* a command line.  
> **username_2**: Found this thread helpful: https://bitcointalk.org/index.php?topic=203438.0  

---

## 2 answers

### Answer by username_4 on 2014-04-10. Score: 33 | Accepted answer

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](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) 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`.

> **Comments:**
> **username_5**: What if I receive more than 1 transaction in a block? Does it spawn a new process/thread using the bash program for each transaction?  
> **username_6**: @username_5 it spaws for each transaction and for each block. the only question is: what if you receive multiple inputs from multiple outputs within 1 transaction. ist that even a thng? (i send you 10x 5 BTC within 1 transaction. i think you receive 1 OP with 50BTC)  

---

### Answer by username_3 on 2022-06-30. Score: 0

to complement username_4's answer, `%w` can also be passed to your script, informing you of the wallet in the node that received the funds, since you may have > 1 wallet


---

