I’m not sure this is the right place to ask, since there might be a bias here
But here goes:
I’m wondering if it is better to use a light geth client locally than using the free Infura API for time critical transactions.
From my testing when it comes to subscribing to the
newBlockHeader event, I can tell that Infura is definitely slower than a local light geth client in notifying my code. There’s about an additional 1-2 seconds compared to a local light client. Is it the same when placing transactions?
A light client may see blocks faster than we publish them on Infura, since the
newBlockHeader event needs to work it’s way from the backend node through our intermediate systems before it reaches your websocket session. However, the nodes themselves are getting the blocks as they appear on the network.
For sending txs, I would not expect a light client to outperform our setup for tx propagation, since we typically broadcast txs to multiple backend ethereum nodes which are then in turn connected to a high number of peers.
But, if you are already using a light client to get new block events as quickly as possible, there’s no harm in sending your transactions to both your light client and our endpoint, worse case is you may receive a “known transaction” “error” on whichever endpoint you send two second if the tx is propagated across the devp2p network before your 2nd RPC call completes (I put error in quotes since in your case it’s not really an error, just an indication that the node has already seen the transaction your are sending it, the tx will be processed as normal).
If you are open to sharing with us the nature of your time-critical transactions we’d be interested in hearing more about your use case, you can PM me on this forum or reach us through email or a support ticket if you don’t feel like discussing that in this public forum.
thank you for your thought-out and honest answer here, I really appreciate it! Your explanation absolutely makes sense and I will have to think about a solution.
My idea has to do with arbitrage trades, hence time is of the essence.