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?

  • 1
    ~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). Jul 10, 2019 at 9:52
  • 1
    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, 2019 at 16:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.