lightning network Lightning Network Routing Gossip: short_channel_id This is the second article in a series on Lightning Network routing gossip. The introduction article explained the purpose of Lightning Network routing gossip. This article will discuss the next topic, a frequently used primitive in the Lightning Network gossip, the short_channel_id.
lightning network Lightning Network Routing Gossip: Introduction This is a different kind of article about the Lightning Network. Many articles discuss the mechanism of channels. However, nodes in the network perform two primary functions: creating channels and gossiping information. This series of articles is going to address the less talked about
Connect to SignalR Over a WebSocket SignalR is pretty high on my list of technologies that I despise. It is very difficult to work with outside of the .NET ecosystem, which is pretty absurd given that it was the defacto way to do WebSockets in .NET for quite some time.
nodejs Async Event Emitter Pattern This is a short article that formalizes a pattern I've used in other articles: that is encapsulating an event emitter within a Promise. I dub this pattern the Async Event Emitter Pattern. While I won't go into the full details on EventEmitter class, I
nodejs Node.js AsyncGenerators for Streaming In a previous article I discussed using Generators for streaming data back to the caller. The Generators function is a synchronous function that allows lazy iteration over a collection of items as the caller requests them. Even though the standard Generator is synchronous, as
bitcoin Merkle Tree Construction and Proof-of-Inclusion Trees are one of my favorite concepts. It's amazing how much of the real world can be mapped to trees and graphs. One interesting types of tree and the subject of this article is called a Merkle tree. Merkle trees are used in Bitcoin
nodejs Node.js Generators for Streaming The concept of Iterators and Generators have been in JavaScript for a while now. This article will discuss how you can use a Generator to efficiently stream data to a consumer. Generators are a mechanism for creating and returning enumerable data (e.g. an
nodejs ChaCha20-Poly1305 AEAD with Node.js Since Node v11.2.0 was released we can now use ChaCha20-Poly1305 as an AEAD cipher! However, if you search for ChaCha20 on the crypto documentation page, you will find nothing. This article is a quick guide on how to use chacha20-poly1305 AEAD and
nodejs Simple Semaphore in Node.js A semaphore is concurrency construct that is used to limit or throttle access to a resource. This article shows a simple semaphore class in Node.js that can be used to limit execution of functions. Usage of the class looks like: // create a semaphore
javscript JavaScript String or BigInt equality performance This article discusses performance of String vs BigInt equality operations. This stems from the question, if I had a large list of 32-byte (256-bit) hashes that I want to evaluate, which value-type representation of that hash allows for the fastest equality operation. Of particular
typescript Type Inference for Node.js Event Emitters When building a Node.js library with TypeScript you may end up using EventEmitter class. One of the challenges you will encounter is how to add type support to the various events that are emitted by your class. This article, as of early 2020,
golang Golang Unmarshal Variable Typed JSON Fields This article talks about decoding/unmarshalling JSON data that may have different types for the same field. For instance, if your application is accepting data from multiple sources and a field may arrive as either a int or as a string. How do you
nodejs Extending TCP Socket in Node.js One of the things we frequently do, but probably don't think about, is sending and receiving TCP data. Many of the packages we frequently use are using TCP sockets under the hood to connect to databases, remote services, and other devices on the network.
nodejs Out of Order Reads with Node.js Stream If you are not careful with a readable stream in paused mode, you can read data out of order. This post discusses how to properly read data from a readable stream in paused mode. First, a quick lesson on readable streams in paused mode.
nodejs Node.js Socket Backpressure in Paused Mode As a lot of these articles go, I was curious about something and could not find the answer online. In this case, how a Node.js Socket in paused mode handles back pressure from a client that attempts to write a large amount of
bitcoin Bitcoin P2PKH Transaction Building with Node.js This post discusses the mechanics of transaction building for Pays to PubKey Hash (P2PKH) transactions. P2PKH transactions are a standard format to pay to Bitcoin addresses. If you are unfamiliar with this type of transaction, I recommend reading through the transaction section of the
zeromq ZeroMQ subscribe with xsub I had a scenario where I wanted multiple publisher to broadcast information to a single subscribe. This subscriber would make a best effort to dedupe the information and present a "realtime" view of what is happening across multiple nodes. Reliability wasn't the
golang Golang Slices Just some notes for working with slices in Go. Mostly JavaScript array equivalent functions. // unshift: add to index 0 func unshift(slice []interface{}, val interface{}) []interface{} { return append([]interface{}{val}, slice...) } // shift: remove from index 0 func shift(slice []interface{}) []interface{} { return slice[1:
nodejs Big number JSON parsing with Node.js Take a look at this abomination of JSON: { "status": "ok", "ch": "market.btcusdt.trade.detail", "ts": 1530026484015, "tick": { "id": 10539491734, "ts": 1530026483694, "data": [ { "amount"
Bit Math Cheatsheet These are just a few techniques I've come across for doing bitwise operations in JavaScript. Feel free to leave additions or improvements in the comments. Turn on first x bits > (1 << bits) - 1 For example, to obtain 8 bits >
nodejs Field Descriptions in GraphQL with Apollo Server This article will discuss two techniques that can be used to descriptions to your objects and fields in GraphQL when working with Apollo Server Apollo Server makes use of the graphql-tools project to assist with schema building. It uses a simplified syntax to construct
nodejs Reading binary data with Node.js This article will discuss some of the basics required to work with binary data in Node.js. It will provide some of the basics required to work with Bitcoin at a low level using Node.js. Basics The first thing we'll get out of
HTTP POST Requests with Node This article will discuss sending POST requests from Node.js core libraries. The post requests are wrapped in a promise for easy use by consumers. This technique can be performed with not dependency libraries beyond those provided by core Node.js. This is a
aws lambda Lambda VPC and Internet Access Configuration This article will discuss configuring AWS Lambda functions to have access to VPC resources as well as Amazon resources that are not directly attached to the VPC. This is a common problem is you need to access RDS or Elasticache instance that live inside
nodejs Serial Promise Execution with JavaScript This article will discuss executing promises serially (wait for one to complete before moving on to the next). This is an extremely common pattern if you are inside of a loop and want to process something one at a time. For instance some how