Publish confirmed transactions by address #1198
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently in order to push confirmed transaction notifications to a client, you have to:
Historically this has worked without any noticeable issue, however in integrating Base, I have noticed this no longer holds up due to the fast block times and high transaction throughput on chain. The node gets oversaturated with network requests causing it to fall out of sync along with blockbook. Even when they are staying in sync, I was seeing calls to get a block taking more than 30 minutes. I did make many attempts at increasing resources, cache sizes, etc. to improve performance without avail.
To reduce most overhead related to this scenario, I chose to add an optional
newBlockTxs
param tosubscribeAddresses
which will allow subscribing to addresses for mempool AND confirmed transactions now. By leveraging the mostly parsed sync blocks, we can detect all associated addresses for a transaction to determine if a confirmed transaction should be published to a client and only then, fetch the evm transaction receipt to ensure anapi.Tx
is sent to the client. This update cuts down nearly all of the previously seen network requests and completely fixed the performance issues seen in the above scenario.(I went with
newBlockTxs
just to tie into the new block vernacular, but could update toconfirmedTxs
if that sounds better.)