Browsing Category Nodejs:

Node.js Named Parameters


Categories: nodejs

Named parameters are a handy feature that have existed in other loosely typed languages such as Python for some time. With the feature called destructuring assignment available in newer versions of Node.js, we gain the ability to do things like this: const { a } = { a: "b" }; console.log(a); // prints 'b' This is useful but we can also use this in function definitions: function func1({ a, b = 3 }) { console.

Continue reading »

A Naïve Peer Discovery Implementation with Node.js and ZeroMQ


Categories: nodejs zeromq peer discovery blockchain

Recently, I’ve been thinking about building a simple blockchain implementation to better understand the pattern. As blockchain systems are distributed, the first challenge that came to mind was how to allow peers in the network to discover one-another. My ultimate goal of this exercise is to keep things as simple as possible, so, my first thought was to use UDP multicast for peer discovery. In essence, every node would simply emits its state to a multicast group every n seconds.

Continue reading »

Using UDP multicast With Node.js


Categories: nodejs udp peer discovery blockchain

Recently, I’ve been thinking about building a blockchain system as an exercise to better understand distributed ledger technology. As part of this thought exercise, I’ve been thinking about simplifying and optimizing process of sharing state between many nodes in a network which has led me to playing around with the UDP protocol. This post explores a naïve peer discovery implementation using UDP multicast. With all the modern languages and tools we use, it’s easy to forget how simple yet powerful some low-level protocols are.

Continue reading »