I'm really proud to announce version 4.000 release of Bitcoin::Crypto, Perl's cryptographic toolkit for Bitcoin.
This release features Taproot support. It's been in development since September 2024, but now it is released. That's it, thanks for watching, don't forget to smash that like button. Courtains.
.
.
.
.
Oh wait, you want more text on this page? Maybe a story? Okay...
I'm very relieved because I've been crafting this release alone for over a year with extremely long procrastination pauses to alleviate the mix of frustration and burnout. Implementing taproot has been more of a challenge than anything I've done before.
In fact, I am not doing it because it is easy. I'm doing this because I thought it was going to be easy when I started back in 2018. I am also doing it because I like Perl, and because I seem to be good at writing Perl, for some strange reason. I could've just used a comparable library in JS, or in Python. In fact, I should have, however let's not cry over spilled milk, shall we?
But what was I battling for a full year really? My gaps in intelligence, the language, or my laziness? Let's break the problem down together:
- Obstacle number one
Taproot pretty much consists of three documents: BIP340 describing Schnorr signatures, BIP341 laying out spending rules (most of the task) and BIP342 defining validation of taproot scripts.
Nice and easy, yes? No, not for me. Each of the documents wasn't easy to read through, was even harder to understand, and the hardest part was answering the question: "How can I fit it in what I already have?", briefly followed by "How can I do it without breaking backward compatibility?".
- Obstacle number two
Uh oh, Schnorr signatures, that sounds scary! Even scarier, Perl has no CPAN module for that which you could use! What now, spin your own crypto? What about *gasp* timing attacks?
Oh wait,
libsecp256k1exists. What a relief - all you need to do is just write an automatic compilation tool for it and write a Perl interface, in XS for it. A nice weekend project. Well maybe three weekends, and all the week days in between. That takes care of most of BIP340 document!- Obstacle number three
So you read your documents, start implementing the part you're looking at the way you understand, write some basic tests. You think you're making progress? Haha, think again! Turns out you assumed something wrong, misread or misunderstood something, or whatever - your code is utter garbage now. Oh and also you managed to break backward compatibility in a softfork extension to the protocol, congrats. Seems like it's time for your favourite time of the day -
git reset --hard HEAD.- Obstacle number zero
You wrote some code and it works and passes basic tests. But your tests are not enough - all the edge cases are screaming in your ear. Yes, BIPs have some test vectors, but Taproot ones are pretty underdeveloped. Also, they seem to contain some bogus cases. How are you ever going to put together enough cases to feel good about releasing it? Maybe you should've thought about it before implementing, dummy. Now good look browsing blockchain for live transactions.
- Obstacle number [object Object]
You did what was in your ability to assert the quality of the new features? All 2000 Bitcoin Core test cases (except bogus ones) pass successfully? Great, now nobody will ever hear about it and how you spent last year. Unless you write a stupid satirical blog post, then maybe a dozen people will.
I've got to tell you, Perl was never the problem. It was dead simple to write code in Perl, once I was convinced what the code was supposed to be. I'm dead serious - I'll give you my Perl when you pry it from my cold, dead hands. (okay, I'll stop now)
I always thought about the idea of doing "release songs" - listing a song which I liked the most during writing the code, so that it was imprinted in the code in some way. This time, it would be Don't You Remember by Vanilla, which my girlfriend misheard as "don't you do minimum" for some reason. Inspirational.
Yes, this article is a satire. Bitcoin::Crypto is a serious library that was written with care and passion, but it may be good to let yourself be un-serious from time to time in your own, private space.
Comments? Suggestions? Send to bbrtj.pro@gmail.com
Published on 2025-11-09