The following is a copy-paste of a message I just send a friend. He wanted to know the basics of the Bitcoin technology and market. Figured I’d share it here too, since it ended up being a (potentially useful) wall of text!

So, the technology aspect of Bitcoin is what really drew me in in the first place.

You can understand Bitcoin in an afternoon or so of reading; but generally speaking you can think of it as just a giant list, or ledger, of transactions. That idea is nothing new; but the crucial thing that nobody had ever successfully…

In recent months we’ve seen many digital artworks tokenized and sold as NFTs, or “Non Fungible Tokens”. In layperson’s terms, this just means that the item is unique. Any one bitcoin is the same as any other bitcoin. But an NFT, in in theory, can not be replicated, and is not interchangeable with any other.

The NFT market rose to a crescendo this week with Beeple’s “First 5000 days” being sold for the equivalent of $69 million.

I’m in favor of any experimentation and innovation using blockchain tech. I think Bitcoin has the store-of-value problem covered, but I’m still looking…

Probably don’t use the rainbow chart to tell you if it’s safe to sleep.

If you’re anything like me, you spent the last few crypto bull markets trading like crazy, and the years in between forgetting all of the lessons you learned.

The biggest part of crypto trading I always forget, is the psychology of it. That’s what I want to write about today: being able to trade and actually sleep at night. That is, without waking up at 4am, checking your phone, making a stupid trading decision, and feeling like a total idiot afterwards.

Fair warning: I’m on the ‘extreme amateur’ side of crypto trading, and the chance of me offering you any…

Hi all!

BrainBlocks was incredibly fun to run, while it lasted. Ty, Angus, Andrei and I had a blast building it, working with the Nano community, seeing real merchants using Nano payments to power their businesses, and real users store their coins in the BrainBlocks Wallet.

Things didn’t work out on the business side for BrainBlocks. I still fully believe the future of crypto is in real-world payments, and I think Nano is the right technology to make that happen. At BrainBlocks we were very early, to a market that hasn’t fully emerged yet. We’re still massively bullish though!


Someone once made a great point about using Regex to parse XML and HTML. In short: don’t do it, you’ll release Zalgo, and suffer a horrible fate. XML and Regexes just don’t gel well together. Or… do they?

I was thinking about this and mulling over just how inconvenient regexes are.

  • You have to write this huge string of almost incomprehensible text
  • It’s very easy to make mistakes that only surface at runtime
  • It’s very easy to forget to escape special characters like . or $
  • It’s even harder to build regexes programmatically, if you have a lot of dynamic…

Tree shaking in JavaScript is becoming an essential practice, to avoid large bundle sizes and improve performance.

The principle behind tree shaking is as follows:

  1. You declare all of your imports and exports for each of your modules
  2. Your bundler (Webpack, Rollup, and so on) analyzes your dependency tree during the compilation step
  3. Any provably unused code is dropped from the final bundle, or ‘tree-shaken’.
This file exports two utility functions…

Earlier this year I gave a talk at FullStack conference in London about making iFrames cool again (sorry, you have to log in to see the video — if anyone is listening over at FullStack, it would be really awesome if you could make these videos public!)

Why even bother with iframes?

In a nutshell: iframes let you build user experiences into embeddable ‘cross-domain components’, which let users interact with other sites without being redirected. There are a metric ton of awesome uses for that other than tracking and advertizing. …

Functional programming is a great discipline to learn and apply when writing JavaScript. Writing stateless, idempotent, side-effect free code really does solve a lot of problems:

  • It’s easier to test
  • It’s easier to debug
  • It’s easier to reproduce issues

But there’s a growing impression in the community that functional programming is an all-or-nothing practice. It’s common to hear:

My entire codebase/app is stateful and full of side effects, so why bother trying to make it functional?

I don’t have time to learn what functors, monads or currying are, but I’ll get round to it eventually. …

Google just released support for Portals in Chrome Canary:

If you’re interested in cross-domain components, cross-domain communication and cross-domain web experiences, this is exciting news. At PayPal, we’ve been cultivating our suite of cross-domain libraries. The most notable of these is Zoid, which powers our embeddable payment buttons and our checkout experience.

Portals introduce a powerful new set of capabilities into this mix. Now it’s possible to build something that feels like an iframe, that can seamlessly animate and morph and take over the full browser window. Take a look at the demo video:

This is incredibly neat. Transitioning…

Inspired by this fun post about C#

I wanted to try the same in javascript. Here’s what I came up with: 15 unique keywords in a row, with no punctuation separating them:

Can you do better? The above code will be successfully parsed by any modern JavaScript engine.

How does it work?

  1. First we create an async generator function. That opens up the possible keywords we can use to include return, await, and yield:
async function* foo() {}

2. Next we’ll return an anonymous class, which is possible in ES6:

async function* foo() {    return (class {})}


Daniel Brain

works for PayPal, as a lead engineer in Checkout. Opinions expressed herein belong to him and not his employer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store