Spotlight on: Ramchains

Tuesday 07 April 2015

Spotlight on… takes a closer, slightly nerdier look at crypto terms, technologies and services, and their significance.

It is a tautology to state that blockchains are fundamental to cryptocurrency. The concept of the blockchain is cryptocurrency: it provides the secure, public ledger without which decentralised money would be impossible. This was Satoshi Nakamoto’s genius - the development of a system that could record peer-to-peer transactions, sidestepping the need for a middleman or any centralised authorities and single points of failure.

Cereal

Take a closer look at BTCD

Unfortunately, there’s a problem with blockchains. They are big. Very big. Bitcoin’s blockchain is weighing in at a rather concerning 30 GB already - way past the point where the average user (even a technically-inclined one) is willing to download it to their hard drive and run a local client. It’s just too time-consuming, too demanding on bandwidth, and too greedy for storage. Not only that, but scanning the blockchain can be very slow.

Blockchain lite

One answer to this problem is ramchains: an ultra-lightweight and blazingly fast distillation of the blockchain, small enough to be loaded into RAM and accessed at speeds that are orders-of-magnitude faster than a traditional blockchain.

Ramchains were created by anonymous developer jl777 in response to performance issues on the Multigateway, a distributed cryptocurrency exchange designed to answer problems of centralised exchanges. By storing only the most immediately relevant information from the blockchain in memory, rather than on the hard drive, ramchains allow for super-fast, random access queries to essential blockchain information, while keeping resource usage at a minimum. This is possible because the majority of operations do not require the full blockchain. ‘A lot of the time consuming blockchain operations simply involve scanning the blockchain for unspent outputs,’ comments jl777. As BTCD’s core developer, that crypto has the first fully-functional ramchains - but other cryptocurrencies, including bitcoin itself, are being added to the list.

Fast, agile blockchains

Tests show that the most essential information can be shrunk down to a third of the size of the full blockchain, and possibly much less. More than the space savings, though, it is the speed ramchains offer that brings the greatest benefits. ‘The CPU can gain access to the data many, many orders of magnitude faster than if it was stored on the hard drive. From the limit of about 500 RPC calls per second to bitcoind, ramchains can probably do 100,000 to 500,000 internal requests per second.’ To take the example of a resource-intensive task like calculating a rich list: ‘For BTCD it takes a few seconds to load the files, a few seconds to rescan entire blockchain and create RAM-resident data structures so any query can be made totally from RAM without any searching. Calculating the balance for all accounts and sorting a rich list could take just seconds. That is from scratch, each time.’

Whilst the full blockchain is needed for complete functionality, the ramchains approach saves time and space, and makes cryptocurrency more accessible to new users. Initialising a client may take seconds rather than hours, for example. But it turns out that having that key blockchain information at your fingertips - computationally speaking - raises completely new use cases. In the relatively near future, we could be seeing some very interesting applications based on the technology. ‘When you make that process 100 times faster, things you could never have considered suddenly become possible.’

We’ll be exploring some of the implications of ramchains over the coming weeks and months.


comments powered by Disqus