Bitcoin & Crypto & NFT News
A new way of verifying blocks on the Bitcoin blockchain could make the digital currency more efficient. In the original version of Bitcoin, when nodes received a block of transactions, they would validate each transaction set. Most likely, these transactions were already validated before, when they were relayed across the network.
However, this previous validation of the transaction was not used in block validation, causing an inefficiency in Bitcoin that limited the speed of block propagation. There have been many developer attempts to make this more efficient, including the forthcoming ‘Cuckoo Cache’.
Cuckoo For Caching Bitcoin
In May 2012, Bitcoin developer Gavin Andresen added code to Bitcoin that caches results of signature verifications. “A node would check the cache to see if it was a properly validated signature”, explains Bitcoin coder Jeremy Rubin, who encourages developers of all levels to contact him (here’s his Twitter). “This would save nodes from the need to do an expensive ECDSA signature validation that they’ve already done before”.
While examining Bitcoin’s codebase, Mr. Rubin noticed inefficiencies in how Bitcoin blocks were processed, rooted in the design of this Signature Cache. He began looking at the design with the idea of easing this tension in mind.
“Imagine if every time you needed something, you had to go all the way home”, Mr. Rubin uses an analogy to describe Bitcoin’s original verification process. “It would be really tough to get through the day, especially around lunch time. But that’s why we carry backpacks. We can pack our lunch, pencils, books, and take them with us if we know we’ll need them later. We still have to go home sometimes if we need something we didn’t expect, but this happens infrequently”.
In programming, a ‘cache’ is a little bit like a backpack. “Bitcoin’s original signature cache was like trying to use a plastic bag with a tiny opening, half full of rocks, with holes in it as a backpack”, explicates Mr. Rubin, who worked on the code while contracting with Chaincode. “Due to the rocks, it was very heavy. Because of the holes, things would fall out all the time. Because it was a plastic bag, everything was disorganized and it took a while for you to find what you were looking for. Because of the tiny opening, you could only fit one hand in at a time and you can’t see what’s in your bag while you’re getting something or putting something in. But at the end of the day, having this bag is a lot better than having to go home so frequently”.
Cuckoo Cache, as Mr. Rubin analogizes, is like a backpack which has pockets and organizers, helping Bitcoin’s code knows where to look right away for the things it needs to verify transaction blocks.
“The openings are large enough and you can see what’s there while you’re taking something out”, says the twentysomething, who once had to fend off a sweeping subpoena for Bitcoin coding activities. “It’s not filled with heavy rocks for no reason. You forget something at home on occasion, and you still lose something every now and again, but not as frequently as when using the bag with the holes”.
Mr. Rubin believes fine-tuning Bitcoin’s code via upgrades like Cuckoo Cache, which is integrated in the forthcoming Bitcoin Core Version 0.14, can go a long way towards improving network efficiencies. He suggests, moreover, that improved caching structures could improve other facets of Bitcoin’s codebase.
Making Bitcoin More Efficient
“With Bitcoin, there are a lot of places in the codebase where we’ve used standard C++ data structures, because the standard library provides the simplest way to prototype many things, and these are capable of carrying the workload at first”, Mr. Rubin explained to Bitcoin.com. “But as Bitcoin scales, there are many big wins to be had if we reconsider the way we store and process Bitcoin’s data”.
Optimizing these data structures, according to Mr. Rubin, is a particularly good place to get started with Bitcoin core development.
“Data Structure optimization is a great place to start contributing to Bitcoin because the problems are pretty self-contained. You don’t need to understand all of Bitcoin to get started, and it’s somewhat easy to measure and communicate your results. Through working on these problems, however, you begin to gain a deep understanding of how Bitcoin works at a low level”.
Mr. Rubin encouraged developers interested to find such a project, but looking for guidance on how to get started or feedback on their work, to reach out to him via email.
Are you cuckoo for Cuckoo Cache? Let us know in the comments below.
Images via Shutterstock, Twitter, and Github
Bitcoin.com offers up-to-the-minute charts on bitcoin price and other stats. Our feeds show the bitcoin price index in all three major currencies (USD, CNY, EUR). Also, if you want to dig deeper into how the bitcoin network is performing behind the scenes, check out the statistics page too.