Closed joshpurvis closed 6 years ago
Nice PR! Thank you my friend!
Actually, ideally, you should have your own Node with the history API enabled for the actions that matter for your dapp. Otherwise, you will never be able to catch the head block due to latency between your server and the public one.
This node is very simple and does a good job of watching transactions coming in and pushing to external sources like web sockets etc. But it does not handle forks that can happen on the fly. For that reason I migrated to demux
, it's an official one supported by Block.One, and it handles the forks.
Thanks for the pointer to demux!
I've actually abandoned the eos-node-watcher
tool too. Was really useful for me though, as I was able to quickly figure out how the EOS APIs worked.
Anyway, I found that for my purposes (just analysis of a contract's history) I could just paginate/parse /v1/history/get_actions
with {account: "my_contract_of_interest"}
, and work backwards from there. This allows me to completely avoid all the blocks which I don't care about.
This seems to get me past the random 500 errors. It also might be good for distributing load across the BP in general.
Do you happen to know which BPs which support history API? I've been finding them by trial and error.
Fixes #1