• YoyitoTV
  • Posts
  • The Quest to Inscribe the whole Bible on Bitcoin

The Quest to Inscribe the whole Bible on Bitcoin

Single Inscription

I debated for a long time whether I should write a blog post about this because of the project's nature and, more specifically, its content, but here we are, whatever.

Like most folks who love tech and try to grasp its core, I find Bitcoin and the whole blockchain technology absolutely fascinating. I first heard about it around 2016 but didn't really dive into what it was. It wasn't until 2017 that I got curious enough to research, not the digital currency aspect, but the tech behind it. I read the white paper, kind of got it, but not really. Feeling pretty clueless, and since I'm a software developer, I thought the best way to learn was to find some blockchain tutorial. That's when I stumbled upon an AMAZING explanation by Haseeb Qureshi. To this day, it's the best video to understand the basic tech behind Bitcoin I've ever seen (He uses Ruby). Fast forward to recently, the concept of ordinals and inscription came up, and until then, I always saw Bitcoin's tech as something useful for blockchain stuff but not much else for a developer like me, unless you're into trading or a programming whiz.

The Genesis of My Idea

I watched the whole rise, drama, etc., of the ordinals protocol from the sidelines. I might be wrong, but trading JPEGs on Bitcoin, given its value, seemed foolish to me, which is funny because I've traded SVGs on Ethereum. But somehow, that felt more like a gamble and less precious.

Considering Bitcoin's blockchain as the most enduring, I pondered over important documents and data to inscribe on it. That's when the idea of inscribing the entire KJV Bible hit me. I picked that version because it seemed the most compact, among other reasons I won't dive into here. But the real challenge was its size - a whopping 4.2MB, while the protocol's restrictions capped inscribable data at less than 400KB (theoretically up to 4MB, but practically, 400KB was the limit at the time).

So, how do you shrink a 4.2MB document to less than a tenth of its size without losing its essence? As a developer, these are the kinds of puzzles that get me fired up. It's like the coding version of an escape room - challenging, a tad stressful, but oh-so-rewarding when you figure it out. Plus, I knew I was standing on the shoulders of giants, just needed to pick out what's already been done.

The Quest for Compression

Jumping into the world of compression algorithms was like accidentally wandering into a maze - fascinating but a bit overwhelming. Each algorithm was unique, promising to be the key to this massive puzzle. But hitting Bitcoin's size limits was like a reality check. Just compressing the file size wasn't enough; I needed a clever workaround.

That's when it hit me. It wasn't just about compressing the data; it was about how to package it. Enter the HTML file - my digital Trojan horse. This nifty file could snugly pack the compressed text in a JavaScript variable and, get this, also include the magic to decompress it. We're talking a full-on interactive experience, not just some static text block. It was like hiding a secret message in a puzzle box - all the pieces were there, but you needed the know-how to reveal the magic.

Embracing Deflate: A Balance Between Efficiency and Practicality

After tinkering with various options, Deflate, powered by zlib, kind of stood out. It wasn't the absolute best at compressing data, but for decompression? Super lightweight and efficient. Embedding the decompression logic right in the file was a breakthrough. It meant the Bible could come to life in any web browser.

But even then, it just wasn't enough. The smallest I could get it was about 1.2MB. I had failed...

Yet, I was too far in to just give up. I reluctantly decided to at least try with the New Testament, about 180 pages.

Still a no-go. Even with Deflate's magic, trying to pack the text into a base64 format for a JavaScript variable made it too bulky for the protocol, around 440KB.

The Revelation of Base122

The final hurdle was encoding. Base64, the go-to method, was too bloated. The quest for an alternative led me to Base122, a quirky but more efficient scheme. It was complex but turned out to be the key, bringing the New Testament down to just 180KB even with the Base122 decoded and the decompress function.

The Inscription: A Testament to Perseverance

With the compressed and encoded New Testament ready, the last step was inscribing it onto the Bitcoin network as an ordinal. I waited for the fees to go down and I think one day I just decided to not wait longer and it was cheap enough, about 8 sats? Can’t remember but I did it, it ended up being about $100 for the inscription and I was happy and proud of the whole journey and final product. You can check out the inscription here 

Epilogue: A Legacy of Learning

Though I didn't achieve my initial goal of inscribing the entire Bible in one go, the journey was filled with valuable lessons and discoveries. It highlighted the potential of compression technologies and innovative encoding methods to push past digital limits, opening new possibilities for blockchain applications and data storage. This endeavor, rooted in preserving a sacred text, turned out to be a fun goal and, hopefully, an inspiration for more.