paint-brush
Ephemeral µBlockchains: the mayflies tackling data storage limitations on the blockchainby@VERV
166 reads

Ephemeral µBlockchains: the mayflies tackling data storage limitations on the blockchain

by VervJanuary 16th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<strong>Introduction: the open-software movement</strong>

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Ephemeral µBlockchains: the mayflies tackling data storage limitations on the blockchain
Verv HackerNoon profile picture

Ephemeral small mayflies have the shortest life spans of all animals — close to just one day. Similarly, Ephemeral Blockchains can be crafted to exist for just 24 hours. Image courtesy of Fly Fisherman.

Introduction: the open-software movement

We’ve seen thousands and thousands of innovative projects around the globe that are a direct result of the open-source software movement. There has definitely been a shift away from closed-source, with more opaque industries being made transparent by developers with the help of ledger-sharing technologies like blockchain. Ever since Bitcoin came to fruition and impacted the world of banking because of its innovative nature, we’ve seen multiple attempts at making the financial space a bit more transparent which is a step in the right direction. Circle for example, the Goldman Sachs backed company, recently made its own transparent stable coin called USDC with the use of a simple Public Ethereum standard token contract viewable here.

Bloating the Ethereum Blockchain

Increasingly more and more companies are pitching projects that involve putting different pieces of supply chain data or ownership records on the blockchain (like us here at Verv with the ownership of green energy which can be traded between communities via the VLUX token), most of them planning to put that data on the Public Ethereum Blockchain.

Whilst the shift to distributed ledger technology is great to see, it’s likely that the sheer volume of data being put onto the Ethereum blockchain will make it bloated and unusable. The initiative to make everything transparent and corruption-free by putting it on the Ethereum Blockchain is laudable, but it’s likely unsustainable unless we can find smarter ways to do it.

If we look at the industry as a whole, the data bloat issue is already causing problems to full-node operators. Take overused public blockchains that don’t have L2 or Sharding scaling solutions implemented, or fast, private blockchains/ledgers. Ethereum is seemingly about to reach 1TB at the time of writing, Intel is facing scaling issues in DLS, and tangles are allegedly facing the same problem — with exponential growth projected for IOTA as an example.

Potential solutions

One option we could look at is building smaller blockchains, let’s call them Micro Blockchains, for storing energy related data. But due to the fact that all of our existing IoT enabled devices have limited storage capacities, keeping the continuously growing blockchain data is near impossible, hence the need for a different approach.

A different option therefore is to look at the use of Ephemeral blockchains, blockchains that we like to compare to small mayflies due to their short lifespan.

This entails periodically starting a blockchain from scratch, saving the end-of-life pruned/full state of that chain and then discarding it completely. The saved end-of-life state is then used as the basis for the genesis block of a new chain and then it runs and repeats the same process for continuity.

The final end-of-life state becomes useful for new nodes that want to join the network as they can use the state to build the genesis block needed in the P2P communication protocol that allows them to fully synchronise. For simplicity, only the first end-of-life state should be saved in full, whereas the second one should be pruned / crafted to contain the parts from the previous state that have been changed, removed or added. In turn, we can save the end-of-life state of our recently discarded Ephemeral Blockchain on a Public Blockchain like the Ethereum Public Blockchain. This way, a new IoT device can rely on the Public Ethereum Blockchain to get the data needed to rebuild the genesis block of the current blockchain, then rely on all of the other IoT devices to fully synchronise.

The Ephemeral Blockchain therefore provides a solution for the disk storage capacity limitations of a chain. And whilst we do acknowledge there might still be the need for additional storage space on the system to store Public Chain data that’s needed to get the required elements to build the genesis block, this could be solved by avoiding to save Public Chain data, running the parallel public node in light client mode or by using trusted APIs.

Hour 1: The Ephemeral blockchain starts with the same default balance of 1 Token in the first hour; Hour 2: Alice initiates a send transaction to send 1 token to Bob; Hour 3: Every machine finishes updating the ledger accordingly therefore Bob now has 2 Tokens; Hour 24: After that, the machines send a transaction on the Public Ethereum Blockchain with the latest pruned state. The Ephemeral blockchain then gets discarded but everyone’s balance is then used as the genesis block for the following day.

Defining Ephemeral Blockchains

An Ephemeral Blockchain can be defined as a chain of blocks that do not live forever (or do not live for decades / centuries as intended with Bitcoin). Instead they are destroyed as soon as the purpose of the blockchain is achieved (e.g. recording transactions), or as soon as the state of it gets stored permanently elsewhere.

The stored end-of-life state should only be data about relevant end-facts of the Ephemeral Chain, therefore compressing everything by a substantial order of magnitude.

A potential growth curve

The chart below represents what the growth in ChainData size will look like for an Ephemeral Blockchain:

Versus the Public Ethereum ChainData size:

Source: Etherscan

Making the Ephemeral genesis state transaction

The transaction to save the state of the Ephemeral Blockchain on the Public Ethereum Chain performed at almost end-of-life can be done by all of the nodes in the Ephemeral Chain through multi-signature cryptography, or by one of the few appointed representative dual nodes (that is, they run the public and the Ephemeral Chain in parallel).

Key splitting and giving the pieces to all the participants could be another option, or on chain multi-signature smart contract functions could also work. Incentive systems to save the end-of-life state could also be added. The possibilities here are endless.

Finally, the entire Ephemeral Blockchain system could be augmented. The way to do this is with cross-chain hashes, where the end-block of a chain will include a hash / full state / diff state of other blocks that belong to two or more adjacent blockchains, creating a complex intertwined cryptographic system that brings extra security or audit-ability.

Ephemeral Chains VS State Channels

One might ask why the concept of Ephemeral Chains, combined with normal chain transactions, are different to State Channels. Aren’t these two concepts the same?

The answer is no, they are not the same. The main difference is the fact that State Channels have thus far been designed for a small number of users. Most notably, State Channels are mainly utilised for two users in turn-based games, and at the same time State Channels are built for a large number of off-chain transactions. In the case of Ephemeral Chains, however, with state on Public Chains, we will end up with a big number of users. The state that needs to be inserted in the Public Chains will be reduced in size through pruning / compressing / diff extraction, then saved periodically instead of irregularly on the Public Chain.

In addition, Ephemeral Chains could be built with different layers — with a few having a bigger Ephemeral Chain on top with a longer lifespan, followed by another permanent blockchain on top of everything.

If the Ephemeral Blockchain were human

If we wanted to provide the Ephemeral Blockchain with a human comparison, it would be someone that doesn’t have the ability to create new memories. Someone similar to let’s say The Protagonist — Leonard — from the film Memento (2000).

In the film Leonard suffers from a medical condition (anterograde amnesia), where he lacks the ability to create new memories and therefore he loses his train of thought every hour. He can remember things from one second to another during that time, but no more than that, and as a solution he writes small sentences on his body with tattoo ink.

Although strange, Leonard’s tattooed memory system works for him. He writes important, small sentences on his body to look at them later. He doesn’t trust anybody and anything but his ink, and no one can trick him about who he is or about the past because he knows his handwriting.

In a way Ephemeral Chains are like Leonard’s mind, and other blockchains (like the Ethereum blockchain) are like Leonard’s skin. His thoughts are Ephemeral but the tattoos written on his body are permanent — both blockchains are both inseparable and they work as one.

Though this way of using Ephemeral Blockchains in conjunction with permanent blockchains brings some unexplored attack vectors, overall this solution has the potential to be as secure as all the other regular blockchains. This is something we will explore with another technical deep dive article.

Written by Verv’s Lead Blockchain Developer, Andy Baloiu (Twitter: @andysigner)