<p>If you think about watching a local wallet, created on <code>cardano-wallet</code>, I do not think there is more efficient way than just pooling it in an interval.</p>
<p>If it is a wallet that does not use enterprise or mangled addresses, you can watch the chain from <a href="https://github.com/input-output-hk/cardano-db-sync/" rel="nofollow noreferrer"><code>cardano-db-sync</code> stack</a> or a remote API provider such as <a href="https://blockfrost.io/" rel="nofollow noreferrer">blockfrost.io</a>.</p>
<p>If using <a href="https://blockfrost.io/" rel="nofollow noreferrer">Blockfrost.io</a>, I recommend using the <a href="https://github.com/blockfrost/blockfrost-websocket-link" rel="nofollow noreferrer">websocket-link</a> where you can create a WebSocket subscription.</p>
<p>In any of these implementation, make sure you account for possible roll-backs of the blockchain.</p>

CC BY-SA 4.0
2021-11-17T20:28:06.630Z
Does the chain roll-back?
melchoir55
CC BY-SA 4.0
2021-11-17T23:30:37.633Z
Yes, several times a day.
Marek Mahut - StakeNuts
CC BY-SA 4.0
2021-11-17T23:43:29.110Z
Very interesting. Would you mind linking to any sort of writeup or documentation suggesting how to account for that?
melchoir55
CC BY-SA 4.0
2021-11-17T08:00:28.417Z
2021-11-17T08:00:28.417Z
Marek Mahut - StakeNuts
<p>It is a bit late for this, but if you have a <code>cardano-db-sync</code> and want to receive notifications you can use <a href="https://github.com/shareslake/cardano-address-monitor" rel="nofollow noreferrer">this</a> solution.</p>
<p>It requires you to provide when deploying the schema the address to monitor and the number of blocks after which your application considers a transaction settled. The solution will take care of rollbacks and only notify through the PostgreSQL channel if the transaction passed the block's depth threshold.</p>
<p>If you just need to monitor chain rollback events you can use <a href="https://github.com/shareslake/cardano-rollback-monitor" rel="nofollow noreferrer">this</a> one. which follows a similar approach of notifying using PostgreSQL channels.</p>

CC BY-SA 4.0
2022-09-15T15:53:45.913Z
2022-09-15T15:53:45.913Z
miguelaeh
<p>I'd like to monitor the blockchain and react to when ada is deposited to my wallet. I'm curious about the most efficient way of going about this. For example, if I use the <code>cardano-wallet</code> api it has the route <code>/wallets/{walletId}/transactions</code> which I assume I could poll. Of course, this would require polling behavior, which is not as efficient as event-based architecture (ie. using a listener or callback).</p>
<p>Can anyone describe the current state of the art for watching a particular wallet for new transactions?</p>

CC BY-SA 4.0
2021-11-17T16:06:58.827Z
Does this answer your question? [How can you listen to all incoming transactions of a wallet address?](https://cardano.stackexchange.com/questions/4147/how-can-you-listen-to-all-incoming-transactions-of-a-wallet-address)
georgeos
CC BY-SA 4.0
2021-11-17T20:27:34.930Z
Kind of. I'm more interested in a discussion on what the most efficient way to do it would be.
melchoir55
<wallet><transaction>
Most efficient way to monitor a wallet for transactions
# Most efficient way to monitor a wallet for transactions

(Asked by: username_0 on 2021-11-17)

I'd like to monitor the blockchain and react to when ada is deposited to my wallet. I'm curious about the most efficient way of going about this. For example, if I use the `cardano-wallet` api it has the route `/wallets/{walletId}/transactions` which I assume I could poll. Of course, this would require polling behavior, which is not as efficient as event-based architecture (ie. using a listener or callback).

Can anyone describe the current state of the art for watching a particular wallet for new transactions?

**Tags:** wallet, transaction
> **Comments:**
> **username_1**: Does this answer your question? [How can you listen to all incoming transactions of a wallet address?](https://cardano.stackexchange.com/questions/4147/how-can-you-listen-to-all-incoming-transactions-of-a-wallet-address)  
> **username_0**: Kind of. I'm more interested in a discussion on what the most efficient way to do it would be.  

---

## 2 answers

### Answer by username_2 on 2021-11-17. Score: 3

If you think about watching a local wallet, created on `cardano-wallet`, I do not think there is more efficient way than just pooling it in an interval.

If it is a wallet that does not use enterprise or mangled addresses, you can watch the chain from [`cardano-db-sync` stack](https://github.com/input-output-hk/cardano-db-sync/) or a remote API provider such as [blockfrost.io](https://blockfrost.io/).

If using [Blockfrost.io](https://blockfrost.io/), I recommend using the [websocket-link](https://github.com/blockfrost/blockfrost-websocket-link) where you can create a WebSocket subscription.

In any of these implementation, make sure you account for possible roll-backs of the blockchain.

> **Comments:**
> **username_0**: Does the chain roll-back?  
> **username_2**: Yes, several times a day.  
> **username_0**: Very interesting. Would you mind linking to any sort of writeup or documentation suggesting how to account for that?  

---

### Answer by username_3 on 2022-09-15. Score: 2

It is a bit late for this, but if you have a `cardano-db-sync` and want to receive notifications you can use [this](https://github.com/shareslake/cardano-address-monitor) solution.

It requires you to provide when deploying the schema the address to monitor and the number of blocks after which your application considers a transaction settled. The solution will take care of rollbacks and only notify through the PostgreSQL channel if the transaction passed the block's depth threshold.

If you just need to monitor chain rollback events you can use [this](https://github.com/shareslake/cardano-rollback-monitor) one. which follows a similar approach of notifying using PostgreSQL channels.


---

