Make a cURL request to the transaction pool/mempool of your node:
curl --data '{"method":"txpool_content","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST https://go.getblock.io/58cfd1cf72204a4d9c25c6c81dea36b8
and you will get output with huge list of into scrolling by your eyes. To get some exact info, for example if some trx hash is in mempool use grep like
curl --data '{"method":"txpool_content","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST https://go.getblock.io/58cfd1cf72204a4d9c25c6c81dea36b8 | grep '0xff3c51fb48d029ddd14f69155816791c36b3c6cc65d324cf9a00b80cc4a95c63'
Lets now use ether js and stream pending trx with node js, write this script and just call it out in your console and you should be getting all trx coming in.
var ethers = require("ethers");
var url = "ADD_YOUR_ETHEREUM_NODE_WSS_URL";
var init = function () {
var customWsProvider = new ethers.providers.WebSocketProvider(url);
customWsProvider.on("pending", (tx) => {
customWsProvider.getTransaction(tx).then(function (transaction) {
console.log(transaction);
});
});
customWsProvider._websocket.on("error", async () => {
console.log(`Unable to connect to ${ep.subdomain} retrying in 3s...`);
setTimeout(init, 3000);
});
customWsProvider._websocket.on("close", async (code) => {
console.log(
`Connection lost with code ${code}! Attempting reconnect in 3s...`
);
customWsProvider._websocket.terminate();
setTimeout(init, 3000);
});
};
init();