<p>Bitcoin has <code>walletnotify</code> feature that will notify you when an address you own in your wallet receives a transaction, and a second notification when the transaction confirms.</p>

<p>You can set it in your <code>bitcoin.conf</code></p>

<p><code>walletnotify= curl http://yoururl.com/endpoint.php?tx=%s</code></p>

<p><code>%s</code> will contain the transaction id. What you do from there is up to you. </p>

CC BY-SA 4.0
2020-05-30T18:25:36.027Z
2020-05-30T18:25:36.027Z
m1xolyd1an
<p>Apart from <code>walletnotify</code> callback these are the JSON RPC calls that you would use:</p>
<ul>
<li><a href="https://developer.bitcoin.org/reference/rpc/getreceivedbyaddress.html" rel="nofollow noreferrer">https://developer.bitcoin.org/reference/rpc/getreceivedbyaddress.html</a></li>
<li><a href="https://developer.bitcoin.org/reference/rpc/listreceivedbyaddress.html" rel="nofollow noreferrer">https://developer.bitcoin.org/reference/rpc/listreceivedbyaddress.html</a></li>
<li><a href="https://developer.bitcoin.org/reference/rpc/gettransaction.html" rel="nofollow noreferrer">https://developer.bitcoin.org/reference/rpc/gettransaction.html</a></li>
</ul>
<p>For these calls to work, you need to have a corresponding wallet created or imported into Bitcoin Core. It is also a good idea to set <code>txindex=1</code> so you can add pre-existing wallets to Core add hoc.</p>
<p>PS Depending on your specific use case it may be better to use existing open source, self hosted solutions like legendary <a href="https://btcpayserver.org/" rel="nofollow noreferrer">BTCPay Server</a> or more recent <a href="https://cypherpunkpay.org" rel="nofollow noreferrer">CypherpunkPay</a> (disclosure: the author).</p>

CC BY-SA 4.0
2021-06-25T11:01:40.747Z
2021-06-25T11:01:40.747Z
CypherpunkDev
<p>I have a docker instance running a bitcoin node and would like to listen to deposits, generating a new address each time a user requests to deposit then increment the users account balance on success.</p>

CC BY-SA 4.0
2020-05-29T14:08:45.560Z
Hey, this looks like you are in need of PoS software, as you'd have to implement a lot on top of bitcoin core to achieve this. You can look into btcpay server which is free OS PoS on top of bitcoin core?
Tony Sanak
<json-rpc><full-node><deposit>
What is the best practice for listening to payments on the RPC api?
Dylan Kerler
# What is the best practice for listening to payments on the RPC api?

(Asked by: username_0 on 2020-05-29)

I have a docker instance running a bitcoin node and would like to listen to deposits, generating a new address each time a user requests to deposit then increment the users account balance on success.

**Tags:** json-rpc, full-node, deposit

> **Comments:**
> **username_1**: Hey, this looks like you are in need of PoS software, as you'd have to implement a lot on top of bitcoin core to achieve this. You can look into btcpay server which is free OS PoS on top of bitcoin core?  

---

## 2 answers

### Answer by username_2 on 2020-05-30. Score: 2

Bitcoin has `walletnotify` feature that will notify you when an address you own in your wallet receives a transaction, and a second notification when the transaction confirms.

You can set it in your `bitcoin.conf`

`walletnotify= curl http://yoururl.com/endpoint.php?tx=%s`

`%s` will contain the transaction id. What you do from there is up to you.


---

### Answer by username_3 on 2021-06-25. Score: 0

Apart from `walletnotify` callback these are the JSON RPC calls that you would use:

* <https://developer.bitcoin.org/reference/rpc/getreceivedbyaddress.html>
* <https://developer.bitcoin.org/reference/rpc/listreceivedbyaddress.html>
* <https://developer.bitcoin.org/reference/rpc/gettransaction.html>

For these calls to work, you need to have a corresponding wallet created or imported into Bitcoin Core. It is also a good idea to set `txindex=1` so you can add pre-existing wallets to Core add hoc.

PS Depending on your specific use case it may be better to use existing open source, self hosted solutions like legendary [BTCPay Server](https://btcpayserver.org/) or more recent [CypherpunkPay](https://cypherpunkpay.org) (disclosure: the author).


---

