Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get pending transactions on BSC

I am trying to get pending transactions from the mempool on BSC using a websocket - the same way I was getting pending transactions on the Ethereum network:

web3Ws = new Web3(new Web3.providers.WebsocketProvider(WEBSOCKET_PROVIDER_LINK));
web3Ws.eth.subscribe('pendingTransactions', function (error, result)

When working with Ethereum, I set WEBSOCKET_PROVIDER_LINK to be wss://${NETWORK}.infura.io/ws/v3/${PROJECT_ID}, but I don't know how to create WebSocket to get pending transactions on BSC.

What provider link can I use to get pending transactions on BSC?

like image 594
Crypto Miner Avatar asked Mar 23 '21 09:03

Crypto Miner


People also ask

How do I see pending transactions on Bscscan?

If you'd like to view a pending transaction, click on “Blockchain” and then “View Pending Tnxs”.

How do I cancel a pending transaction on Binance?

Navigate to the Open Orders tab. 4. Click the Cancel orders icon at the top right of the screen above your listed orders, and confirm the pop-up message (at this time, individual orders must be cancelled from a web browser).

How do I fix pending transactions?

Canceling a pending transaction usually requires contacting the merchant who made the charge. Once a pending transaction has posted, contact your bank or card issuer to dispute it.


Video Answer


1 Answers

I think you're looking for https://getblock.io/nodes/bsc

Once you get an API key, you can use this websocket address:

wss://bsc.getblock.io/mainnet/?api_key=API_KEY

I just implemented it, and it seems to be working for me!

UPDATE:

I have had better success with this service: https://www.quicknode.com

GetBlock worked for me, but would sometimes get a little out of sync with the network.

like image 198
BananaNeil Avatar answered Sep 19 '22 21:09

BananaNeil