Hello,
I run my script on node.js utlising ethers.js, which connects to BSC speedy node.
I am currently just testing but can’t go any further as the websocket close too frequently.
Following is the snippet where i fetch pending txns. For now I am just testing this on BSC.
//Initialize providers and stuff
async function run() {
let bsc = new ethers.providers.WebSocketProvider(provs.BscMorWss);
bsc.on("pending", (tx) => {
bsc.getTransaction(tx)
.then(function (transaction) {
if (transaction) {
console.log("Tx hash:",transaction.hash,"at block ",transaction.blockNumber);
} else {
//console.log(tx,'is NULL');//ignore theese
}
})
.catch(function (error) {
//console.log("Error hash:",error.value.hash,"at block ", error.value.blockNumber);
console.log(error);
});
});
// … so on and so forth and a run() to execute
I believe this is caused by rate limits. I have no idea how that is implemented but with 155 million free request per month I guess it should not have hit the rate limits so soon?
Any help appreciated.
cheers,
George