Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the efficient way to acess the BSC node mempool content?

I'm currently writing some program to monitor the mempool of a bsc node. As my BSC node is a charged by request count, I'm trying to explore the best way to save the time and cost.

Here's some plan I found:

  1. Use service of mempool explorer. https://www.blocknative.com/. This is obviously not the best plan since I've already paid 99 dollar on quicknode service already and I found some transactions is still not among the list it provided.

  2. User web3py pending filter: new_transaction_filter = w3.eth.filter('pending') new_transaction_filter.get_new_entries() and w3.eth.get_transaction(entry) for each entry. This is also not effcient because it's quite time wasting and cost lots of web3 requests.

  3. Using pending_block = w3.eth.get_block(block_identifier='pending', full_transactions=True) The call only returns transactions with mined block number and obviously not the 'pending' ones.

  4. Use w3.geth.txpool.content(). This can print out all the pending transactions in one shot but when you keep calling it, duplicated record will appears.

Can anyone give me a hint which is the correct way to fetch the mempool?

like image 889
Yu Wan Avatar asked Sep 02 '25 10:09

Yu Wan


1 Answers

I think option 2 is best, I've been trying to see if theres a way to apply only a specific address to the filter but I've had not luck with that, I've tried option 3 which is too late and option 4 only works on a geth node (I've only been using speedynode so not the best).

like image 147
James Avatar answered Sep 04 '25 07:09

James