A Dummy Websocket Server for developing a Blockchain Explorer


1 min read

At my old company, a colleague was tasked to update a project I made a year ago. A blockchain explorer - to migrate it from React to Next.js

This project includes a websocket element, for live updates.

In order to help the colleague develop the websocket part of the site, I set up a dummy server that sends randomized block data.

I actually built this using someone else's code, but my colleague suggested I post about it anyway.

So, here it is.

First, credit to Netzwerg. Using this code, I was able to correctly set up the server with TypeScript.

Now, my code: https://github.com/BruceJi7/dummy-websocket

What makes it at all special is that it can send dummy block and transaction data, every 3 seconds, with consecutive IDs.

I suppose an upgrade would be to make the configuration - the interval, the number of transactions in a block, all set from ENV variables or flags.

Anyway, if anyone needs a dummy websocket server for developing a blockchain explorer... start here! Haha