NXTER.ORG

Ramchains: Ultra-fast blockchain operations

ramchain-supernet-tech

SuperNET developer jl777 has created ramchains: a compressed, memory-mapped implementation of the blockchain that is capable of blazingly fast operations. The innovation solves a critical problem with cryptocurrencies, and opens the door to completely new applications.

The blockchain is the foundation of cryptocurrencies: the decentralised ledger technology pioneered by Bitcoin that makes trustless online money possible. Blockchains, however, have some serious problems. Because they contain all the information about every transaction ever made, they are large, unwieldy objects. Bitcoin’s blockchain runs to 28 GB and accessing these files, stored on the hard disk of users’ computers, is a slow and resource-heavy process.

By storing only the most immediately relevant information from the blockchain in memory, ramchains allow for ultra-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.

Ramchains were developed by Nxt and SuperNET developer jl777 in response to performance issues on the Multigateway (MGW), a distributed cryptocurrency exchange built on top of the NXT platform. MGW forms a critical component of the SuperNET – the ambitious project to bring together the best technology and services that the cryptocurrency ecosystem has to offer.

‘A lot of the time consuming blockchain operations simply involve scanning the blockchain for unspent outputs,’ comments jl777. Creation of the ramchain – essentially a distillation of the most often-required information from the blockchain – is a one-time event. Once the historical blockchain has been processed, new blocks are added to the ramchain in real time.

The ultra-lightweight ramchain files can then be accessed directly, bypassing slow coin daemons entirely. Because the file is memory-mapped, query speeds are dramatically reduced. If enough memory is available, the ramchain is stored in RAM; if not, virtual memory is used.

Performance gains

Early indications are that startling performance gains are possible. For example, 220 MB of the BitcoinDark blockchain is reduced to an active memory footprint of 80 MB. ‘That is with a fully loaded ramchain and all the code, data structures and everything else… to have all that at one third the size of the raw blockchain is a fantastic result. If needed, it can shrink down to 40 MB or even less, dynamically based on system usage.’

Ramchains has been deployed with the beta launch of SuperNET

Ramchains is already deployed in the SuperNET beta Client (MGW), a distributed multicoin wallet currently supporting Bitcoin, BitcoinDark, DOGE, NXT, VeriCoin, OpalCoin, Litecoin, FibreCoin, VPNcoin and BitStarCoin.

More than the space savings, it is the speed with which ramchains function that offers the greatest advantages. ‘It is a matter of proper allocation of data according to usage,’ states jl777. ‘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 around seconds. That is from scratch, each time.’

SuperNET will make use of this new technology, along with a series of other innovations – realtime decentralised crypto trading (InstantDEX), corporate-level privacy, marketplaces, games and other services – but Ramchains have applications far beyond this. ‘When you make the process 100 times faster, things you could never have considered suddenly become possible.’

SuperNET is an association of the most reliable blockchain technologies today, giving you access to all their innovation from one place. You can follow the innovation and get the latest updates by subscribing to the SuperNET Newsletters, and try the SuperNET beta client: http://www.supernet.org

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x