If they use transaction/wallet listener, how do they detect deposit transactions when their services are not running, do they fetch blocks at every height to scan for deposits to avoid any missing? Thanks,

  • Any exchange that isn't running their own nodes in order to watch transactions is just a robbery waiting to happen. If you're handling large amount of BTC/whatever else, you should hopefully understand the massive danger inherent in trusting a 3rd party to provide information to you.
    – chytrik
    Commented Jan 3, 2019 at 3:41
  • If they run a full node or an SPV node, how do they avoid missing any deposit transaction, I'd like to know how it works to implement a similar solution. Commented Jan 3, 2019 at 3:47

2 Answers 2


There are several ways to accomplish this. First as chytrik stated above, not running your own node is dangerous, but in my opinion only if you plan on submitting transactions. When it comes to watching wallets, there are 2 ways.

  1. Active scanning. This method involves asking nodes/services what transactions exist for a particular address.
  2. Passive triggering. This is usually accomplished by asking a third party to inform you that a deposit has been detected.

In the case of 1, it can be costly to scan every address ever used especially when creating a new address for each transaction or scaling to a large user or wallet count.

In the case of 2, relying only on a third party can be tricky.

The most cost effective way to handle this is to do both. Use a third party for primary notifications. If you expect a transaction during a window of say 10 minutes, you can have your system process the request once the third party triggers, and you can perform a "manual check" from the node directly by asking for all transactions and parsing the results looking for the expected transaction. This will give you the fastest response and the lowest delay. You could even only make the node request once at the end of 10 minutes as a fall back "final check" before invalidating the transaction (common with bitcoin payment services).

If you're doing something longer term, then you can once again rely on a third party to trigger an immediate update. As a fall back scan once an hour/day/week depending on what the use case is. If it's an end user application allow them to trigger the scan (of course within reason so you don't get DoS'd by your own clients clicking 'rescan').

This is the entire "trust but verify". No third party will have your keys. If you're an exchange you'll likely be scanning, but for a better user experience depending on the size of your customer base, scanning millions of wallets every 5 seconds just isn't feasible. You can also use multiple third parties as well. For an exchange these services won't be that expensive.

If intent on being the third party in these examples, then parse every block that arrives from the blockchain. Do what you need to do when you detect a deposit on one of your addresses.

Note: I formed this as a "large scale" response to the concept of exchanges. There are other things that can be done at small scale eg: a personal wallet and setting a node to watch an address.

  • I have a few thousand addresses, using a third party service to notify for received transactions to those addresses may not be possible because if my server is shut down for a few days, rescanning all the addresses may be costly (time and fee) or reach the third party's limit. Seem like parsing blocks (from my own node or a third party) is the easier way to archive this. Commented Jan 3, 2019 at 7:49
  • 1
    That's fair enough. It depends on how responsive you want it. If you can/will plan to be offline for long periods, then it won't matter if you have to submit 10,000 requests to the node. An exchange really doesn't plan on being "down" for a few days. People also won't tolerate waiting for their deposit to be delayed that long. My overall point is, thousands of wallets, if you want to scan every 5 seconds for updates to all of them, that may be a problem. At some combination of qty and frequency you will overwhelm the node. Suggesting you keep scalability in mind when designing your solution. Commented Jan 3, 2019 at 20:25
  • I think I found the solution, I add all the addresses to a wallet of an SPV application. The SPV app will be responsible for monitoring my addresses, updating received transactions no matter how long my server is down, thanks a lot for your help. Commented Jan 4, 2019 at 2:28
  • 1
    Sure thing! Since again, the context is "exchanges" and you're talking SPV now, this is a good read: medium.com/@jonaldfyookball/… -- Be aware that this article is from the standpoint of a single user. Not an exchange. Also be aware of any limitations on the number of addresses your SPV may be able to handle. Commented Jan 4, 2019 at 18:02

They're running full-node implementation.

how do they detect deposit transactions when their services are not running?

It's blockchain, all data available for anyone, they able to fetch data from blockchain anytime.

do they fetch blocks at every height to scan for deposits to avoid any missing?

There is a couple ways to get address deposits:

  1. You can check the balance of particular address every N seconds.
  2. You can parse a block and check if there are transactions related to particular address.

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.