Search code examples
ethereumweb3jsbinance-smart-chain

Get details of pending transaction using tx hash on BSC


I'm trying to get the details of pending transaction using it's txhash. I tried using web3.eth.getTransaction(transactionHash) but it seems like it returns null for pending transactions but works fine for finished transactions. Is there any other way to get details of a pending transaction? I tried to open bscscan and it was able to show from to and status as indexing.

web3.eth.getTransaction(transactionHash).then(console.log); //-> Prints null

I tried to use multiple full nodes to check if it is node's issue or not (https://bsc-dataseed1.binance.org:443, https://bsc-ws-node.nariox.org:443)

To add more context, I'm trying to do what's mentioned in this answer


Solution

  • I realised that the problem is with the nodes that I'm using. I self hosted a node myself and this wasn't the problem anymore. So, If you are also facing this issue, use self hosted nodes may be.