pull down to refresh

Libbitcoinkernel Update

Introducing libbitcoinkernel, a long-term project aiming to help developers introduce innovations to Bitcoin without compromising security.
"Libbitcoinkernel" is a comprehensive and ongoing update to Bitcoin's code that might be flying under the radar but is likely to make it easier for developers to experiment with changes in Bitcoin.
The ambitious project's goal is to untangle the code from Bitcoin Core—the primary software underlying Bitcoin—so that a significant portion of the "security-critical" code is separated. This paves the way for new enhancements to Bitcoin.
Untangling this code simplifies developers' lives, and these changes are likely to eventually reach users as well. The quicker developers can create new features—whether related to privacy, security, or more user-friendly wallet tools—the sooner users can benefit from these innovations.
Libbitcoinkernel has a verbose and esoteric name because it is intended to become a library that developers can use. Even though it's specifically geared towards developers, this change could have broader implications for the BTC universe.
“What really drew me to dedicate time to Libbitcoinkernel was when I realized it could be a technical solution to some of the social obstacles of Bitcoin Core,” said Carl Dong, a Bitcoin developer to Decrypt. He was the initial project leader.
Dong has since stepped back, allowing developer Spiral, Sebastian Kung, Bitcoin Core veteran collaborator Cory Fields, and others to take the reins of the project. Kung told Decrypt that he believes Libbitcoinkernel is one of the most impactful projects to work on in Bitcoin right now.
Avoiding a "nightmare scenario"
Understanding Libbitcoinkernel begins with comprehending "consensus code." Consensus code is critical security code in Bitcoin Core, ensuring that all nodes on the network agree with each other.
If half the network follows certain rules while the other half follows slightly different rules, this can lead to an unintentional "hard fork," effectively splitting the network in two. "This is the nightmare scenario that keeps Bitcoin developers up at night," Dong said in a video presentation explaining his work on Libbitcoinkernel.
The issue is that consensus code is entangled with all the rest of the Bitcoin Core code. This poses a significant problem for developers trying to make changes, as it's not always easy for them to detect when they're touching a piece of code critical for security. Even if they know, it can take some time to work around it.
The goal of Libbitcoinkernel is to slowly extract all this code into a separate library so that developers working on other sections of the code don't need to be nervous.
If developers can spend less time ensuring they're not accidentally poking a bomb in the consensus code, they can spend more time on more interesting BTC features or bug fixes.
“This allows developers to have a more focused review on the critical consensus code while worrying less about the rest of the Bitcoin Core. It also allows developers to talk about the body of consensus code as a well-defined entity for the first time,” Kung said.
The 'bigger' goal: multiple Bitcoin clients
There's also a second, long-term goal that can be achieved with the help of Libbitcoinkernel. Bitcoin Core is the main implementation of Bitcoin's code. Users run it to connect to the Bitcoin network and verify transactions.
But what if there were other options besides Bitcoin Core? If that were an option, developers would have a way to experiment with new features more easily. “Implementations can also prioritize features differently to better serve target users,” Dong explained.
Secondly, multiple Bitcoin implementations can increase the network's resilience. If one implementation is hit by a consensus-related bug, the other implementation might not be affected by the same bug, keeping Bitcoin intact. This could reinforce Bitcoin's decentralization, which is, well, the entire focus of BTC.
The feature of multiple clients might sound easy, but it's not. Without Libbitcoinkernel, many BTC developers have expressed concerns about having multiple implementations. The reasoning goes back to the tangled consensus code. Let's say "Bitcoin B" tries to copy Bitcoin Core's code. If Bitcoin B developers make a single misstep in reimplementing this code, the network could split into two in an unintentional hard fork.
Libbitcoinkernel could change this. By extracting the consensus code into a separate library, Bitcoin Core and Bitcoin B can use the same consensus code. There's no longer a need to worry about subtle consensus discrepancies causing chaos between the two implementations.
“Having a reusable consensus library would allow people to build alternative Bitcoin implementations, which were previously considered too dangerous due to potential consensus incompatibilities now eliminated,” Dong said.
Learning from abandoned attempts
Extracting consensus code from the rest is not a new idea. In the early days of Bitcoin, part of the consensus code was extracted, but the project was left unfinished. Then, a 2016 attempt to revive the project may have "collapsed under the weight of its own ambition," as Dong put it.
With this in mind, Dong and Kung have taken a more iterative approach to extracting the code, learning from past attempts that were abandoned.