0

I am trying to build a transactional system that:

  1. Generates a new address for each customer.
  2. Waits for the confirmed balance on the address to reach a certain value.
  3. Launches a function once the balance condition is met.

I am currently using a while loop with polling to accomplish this, but it will not scale up properly for my intended use case.

Is there a way to register some kind of callback when a transaction is received to one of my wallet addresses and get rid of polling ?

Thank you all

4
  • Please clarify whether you are generating a full master wallet address for each customer, or whether you are just generating a subaddress (with each subaddress part of the same wallet) for each customer.
    – knaccc
    May 30 '18 at 16:06
  • @knacc Subaddress for each customer. I am creating a new address with monero-python using wallet.new_address(). I believe it means this is a subaddress but I am still new at this. Would be awesome to be able to call a script when there is an incoming transaction to a local address.
    – Jopela
    May 30 '18 at 18:29
  • I'm not familiar with monero-python, but unless you have code that talks to the daemon directly you are going to have to poll. You may find a method in getmonero.org/resources/developer-guides/wallet-rpc.html that allows you to see only the latest incoming transfers, rather than listing every single balance for every single subaddress.
    – knaccc
    May 31 '18 at 0:13
  • @knaccc alright, I believe you are right and I have no other choice but to poll. Thx
    – Jopela
    May 31 '18 at 17:06
1

You will need to poll if using the RPC interfaces to daemon / wallet.

but it will not scale up properly for my intended use case

Nothing wrong with polling with regards to scaling. Just run the polling requests in a separate thread notifying your other code at appropriate times (e.g. when you detect new incoming transfers).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.