0.02: Settling In, Lightning, Speed Improvements
Hello again. Initially I thought I’d send these notes weekly, but I want to keep my emails high signal. So I’ll experiment with cadence until I find what’s right.
How I’ve Spent My Time.
I completed the first month of ChainCode program Bitcoin exercises. I went all out on these, and it was fun. With few interruptions, I was able to jam on the exercises from sunrise to sunset.
The most interesting exercise was related to the Lightning network, which is a tool that helps scale Bitcoin transactions. I share some details on that below.
Some of my notes are too technical for a mailing list, so I’ve been putting them in this git repo. Other notes are personal and half formed, so I’ve been keeping them Obsidian.
If you check out Obsidian, I recommend defining your own daily notes template. Mine includes morning pages, notes on what I accomplish throughout the day, and todos that carry over day-to-day. It’s a useful way to stay grounded.
What I’ve Learned.
To properly understand Bitcoin can take hundreds of hours of reading, to save you time let’s use an analogy. Imagine sending Bitcoin is like mailing cash. It’s relatively expensive and time consuming, with a minimal Bitcoin transaction taking about an hour to settle.
You’ve probably heard of other cryptocurrencies that settle in minutes or seconds. While that’s technically true, their level of security is far lower than Bitcoin and I don’t think they are suitable as global money. I consider the extended time that Bitcoin takes to properly settle is a side-effect of its security.
But because of this extended time, raw Bitcoin transactions are not suitable for every transaction. Buying groceries, coffee, or movie tickets shouldn’t be as as time consuming as mailing cash.
With the lightning network, instead of mailing cash, the analogy might be sending promises back and forth.
Imagine that Alice and Bob want to be able to settle small debts with each other in the future. To do this, Alice and Bob open a Lightning channel by posting $100 of collateral each into a common wallet.
Then, when Alice wants to pay Bob $15 for a movie ticket, she doesn’t need to send Bob money, she instead sends Bob a signed transaction that allows him to access his original collateral plus the cost of the movie, $100 + $15 = $115, and allows her to access her original collateral minus the cost of the movie, $100 - $15 = $85.
By only trading signatures back and forth instead of waiting for money to settle, Alice and Bob can transact at the speed of the internet instead of waiting an hour or more for a transaction to settle on chain.
In addition, because transactions are peer-to-peer on the Lightning network, there is no theoretical maximum number of transactions per second. Everyone on Earth could be sending money to other people hundreds of times each day, and the network would handle it just fine. The base Bitcoin network can only handle on the order of tens of thousands of transactions per day.
Today, the lightning network is much more built out than the simplified Alice and Bob example above. There are around 54,000 public lightning channels today with about $350M of pledged collateral.
A transaction from me to you likely won’t go directly between us (we don’t have a channel open), but instead would take 3-6 hops across channels other people have opened in the past.
Using the lightning network, I sent a friend $1 a few months ago for $0.005 in fees, and I bought a hamburger at a bar in NYC in a few seconds.
The challenge of our exercises involved solving the math needed to send a transaction 5 hops across the network, as well as solving the encryption needed so that everyone on the network doesn’t know who is being paid. You can read more technical details on Elle Mouton’s website. The filler was by far the hardest part.
What’s Next.
Now that the core educational exercises of the residency are done, I’ve spent the last week working on actual open source code.
My first approved code change helps benchmark one the ChaCha20 encryption algorithm used to communicate securely on the Bitcoin network, and I have another change in progress that uses hardware acceleration to make Sha256 hashing algorithm ~6x faster than it is today on arm processors (the ones in Apple computers and phones). Note: I implemented code that already existed in one codebase in another, I didn’t discover something new here.
I find myself attracted to optimization work — making things that already exist faster and easier to use — instead of building new features. I’ll see if that trend persists.
I’m also attracted to work that makes it easier to know who accepts Bitcoin and to know that you are sending money to the correct address. The NOSTR network has the capability to do this today — to have a form of an “open source Venmo or Paypal” — but it’s still nascent.
Useful Links and Reading.
I’ve been working though Bitcoin development philosophy and appreciating it. It’s not overly technical and could be a good read if you want to know more about what’s going on here.
On the technical side, learning about Coinswap and if I’d want to contribute.
If you haven’t seen it yet, I like Make Something Wonderful, a book about Steve Jobs with his philosophies on life.
IMO, it should not be discounted that Jobs was explicitly sent back to the West by his Eastern spiritual teachers to have an impact at home. He wasn’t just a tech guy rambling thoughts, he was a cross-cultural bridge.
“The journey is the reward. People think that you’ve made it when you’ve gotten to the end of the rainbow and got the pot of gold. But they’re wrong. The reward is in the crossing the rainbow. That’s easy for me to say—I got the pot of gold (literally). But if you get to the pot of gold, you already know that that’s not the reward, and you go looking for another rainbow to cross. Think of your life as a rainbow arcing across the horizon of this world. You appear, have a chance to blaze in the sky, then you disappear.”
See you next time.