0

What's the best way to detect an incoming transaction with web sockets and update balance?

Should it be done with polling?

Like for example - how would a web wallet do it? It's sitting idle - is it really polling the entire time?

If it's pooling all time, if you were on a sidechain like POA, you'd be checking every ~5 seconds, this doesn't seem efficient.

Is there any other way?

  • ~15 seconds (average block-time) makes more sense. But yes, you need to poll the blockchain, there is no other way (any "other way" would eventually be polling it). – goodvibration Jul 10 at 9:52
  • checking every block (15 seconds) is just fine, even 5 seconds is still more than ok. A modern computer can execute billions of instructions per second (cpu wise). Other option is to use a contract wallet and then you can just subscribe to the events. – Jaime Jul 10 at 16:27

Your Answer

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

Browse other questions tagged or ask your own question.