Summer of Bitcoin 2022 Final Review

ยท

3 min read

And the journey comes to an end, well, officially at least ๐Ÿ˜‰. The past three months working on Bitcoin-S had been very challenging and I got to learn a lot because of it. This blog post is like a summary of my experience and things i have been able to get done with in these three months. The list below is in chronological order. I will outline the major contributions only, a lot of minor improvements and fixed PRs were merged too but I may skip some of them here, a full list is obviously available at github

Got Neutrino Node written for desktop environments in Scala to run on Android!

This was not exactly a part of my proposal, but something my mentor Chris asked me to do. Getting this done had been a wild ride through dependency hell to ART vs JVM issues. I have written in detail about it in my mid-review blog post.

Find and switch peers

The neutrino node could only sync with one peer only and that too needed to be specified in the config. This PR reworked a lot of the peer and message handling to allow the node to connect to peers found through DNS seeds and Addr messages from the network and stored peers in our database if any. Any new peer encountered is stored in the database peer table for reuse.

Not just this, this PR also implemented support to switch to a different peer if the current one is faulty, as in, not replying to messages, going offline, disconnecting us, sending invalid data etc. This greatly improved node resiliency.

P2PClientSupervisor

Found a quite troublesome bug while working on improving node. P2PClientActor, which is obviously and Actor had an issue that any exceptions thrown into it failed silently and restarted the actor which led to a messed up state. Since these were silent failures, debugging and knowing that such a thing was occurring took me some time. I added a P2PClientSupervisor to handle these failures and log them properly.

Header sync validation

Another PR with many changes. This used the multiple peers that we added earlier to query different peers to ensure that we have the best header chain among all peers. This also laid the foundation for parallel filter sync by adding states to DataMessageHandler, a stream to process DataMessage so that state remains synchronized, re-queries in case of invalid headers etc.

Parallel filter sync

This PR would complete the task that I proposed, i.e. adding parallel sync for compact filter headers and filters. With this I was able to decrease IBD time (with all compact filters) by roughly 15 minutes (improved filter sync time from ~55 minutes to ~35 minutes. Most of the work for this is done and it is in working state at the moment, some minor issues still remain, which I hope to fix soon, post which it will be ready for merge.

Other work

Apart from numerous small fixes, some other significant PRs that I made are,


Overall, I got to learn a lot in these three months, and I am certainly better off now for having done this. A huge thanks to my mentor Chris for simply being awesome and helping me out time and again. Also, thanks to Summer of Bitcoin for such a nice opportunity.

Thanks for reading ๐Ÿ‘‹.

ย