The following blog summarises my work in bcoin as a part of Summer of Bitcoin 2021.
I am thankful to my mentor Matthew Zipkin, for being incredibly supportive throughout this journey. And kudos to all my peers for being this amazing.
Project Introduction: Bcoin
Bcoin
is an alternative implementation of Bitcoin protocol built with Javascript. A full node can be used for full blockchain validation and is aware of all known consensus rules. It is easier to use, faster to learn and more well-documented than competing implementations.
My ten weeks summer internship work with bcoin helped increase test coverage in its test library, implement bech32m address encoding format to make bcoin taproot ready, and also involved reviewing pull requests and issues.
Goals / Milestones
1. Increased test coverage
I checked the bcoin project's test coverage and found some libraries where test coverage was not up to the mark.
Pull Request : #1026
2. Resolved Unknown version bit issue.
When miners use OvertAsic boost to produce blocks with random version numbers, it adds more false positives to the BIP91 signalling. I removed this warning which has been haunting users for a long time.
Pull Request : #1029
3. Implemented Bech32m support.
Taproot is around the corner with new address encoding formats for addresses. My work added support for the latest encoding format, i.e. bech32m in bcoin
.
Pull Request : #1034
4. Update to the hardcoded minimum fee.
I helped in resolving the hard minimum fee rate in bcoin. Previously this rate was 100 sat/kb (unchanged since 2017 before segwit). Still, after segwit, this had to be updated for a segwit transaction in SPV mode
(which doesn't have any fee estimation method). SPV mode
still used the hardcoded minimum fee rate (100 sat/byte), too much for a segwit transaction.
Pull Request : #1036
Challenges
The most challenging part of SOB was understanding the technology behind Bitcoin and getting comfortable with it. Thanks to Kalle Rosenbaum and my mentor Matthew for making this learning journey a true gem.
Working on an open-source project requires a lot of going through the docs. Writing a pull request required coding in a very structured format and with great accuracy, which helps with debugging later.
Numerous tiny errors kept popping up as my coding progressed, and sometimes the code had to be refactored entirely / rewritten in a different approach to suit the workflow.
I had never worked with an open-source project of this size before. I often got lost in it, but thanks to Matthew Zipkin for making this lost and found journey fun.
What did I learn
During the whole program, I learned a lot of things, and the code speaks for itself. With several PRs merged and several approaches discussed, I have become a better developer and a team worker. You can check my weekly journals here. But these are just the tip of the iceberg. The weekly meetings with my mentor were full of knowledge where I learned a lot of new things about cryptography, PGP keys, peer to peer networks, and tons of stuff related to bitcoin.
(PS: Matthew is very knowledgeable. I don’t have words to portray how fantastic he is.)
Future work
Working on bcoin
this summer has made me entirely comfortable with the code base and I would love to contribute to further improve my work and contribute to bcoin.
There's a lot still left to be done. For example making, bcoin
taproot ready:
Implementing BIP340 Schnorr Signatures : Bitcoin has traditionally been used ECDSA signatures over the secp256k1 curve with SHA256 hashes for authenticating transactions. These are standardised but have several downsides compared to Schnorr signatures over the same curve.
Implementing BIP341 improves privacy, efficiency, and flexibility of Bitcoin's scripting capabilities without adding new security assumptions.
Implementing BIP342
Final Note
I am very thankful to Matthew Zipkin and the bcoin project.
Special thanks to the people behind Summer of Bitcoin Jonas, Adi and Caralie, for always being available throughout the journey, I will miss the Thursday meetings and the game-nights.
Finally, thanks to the SOB'21 program, for letting me be a part of this incredible project and gain this memorable experience. I am thankful to them for creating this kind of opportunity for students.
Thank you!
Lets connect :