The term "second layer" is frequently bandied about in discussions of blockchain technology, but what does it actually mean? The first thing to understand is that the second layer is distinct from the base layer, or main chain, which is a fancy way of referring to the blockchain itself. The Bitcoin and Ethereum blockchains, for instance, are base-layer blockchains.
Why You Should Care
Since blockchain technology's debut nearly a decade ago, technophiles have drooled over the possibility that it might eventually support near-instantaneous payments between parties anywhere in the world, a development that could pave the way for the emergence of a new digital economy. In this economy, middlemen would be scarce. Rather than paying a monthly fee to access a news website's content, for instance, readers might pay a much smaller fee directly to the authors of articles, which they would purchase on an a-la-carte basis. Mass-mediated services, such as audio or video calling, could be accessed almost for free. In such an economy, many other types of decentralized systems, from tamper-proof voting schemes to land deed and natural resource registries, might also prove capable of weathering the technological challenges inherent in widespread adoption.
However, with the USD equivalent of average transaction fees on the Bitcoin blockchain exceeding a dollar for most of 2017, and hitting an all-time high of over $50 in December 2017, these lofty hopes for a cryptocurrency-integrated economy of money, information, and services are currently little more than a pipedream. This is because the possibility of using the Bitcoin network to send transactions worth pennies or even fractions of pennies, which would be necessary for such an economy to exist, is not realistic in the current technological paradigm. Furthermore, the Bitcoin blockchain has long been overloaded with pending transactions, and the advent of the CryptoKitties game on Ethereum recently demonstrated that the younger platform has scaling problems of its own.
And yet, the number of people and other entities interacting with these blockchains today is small compared to the number that would need to access them if blockchain-integrated services were to go mainstream at the global level. Not surprisingly, then, scaling has become a central concern in the world of blockchain development.
So, what is the Second Layer?
Simply put, the second layer refers to all the auxiliary platforms and protocols that act as digital dumping grounds where activities can be offloaded from main chains to save storage space. Often enough, these alternative digital spaces are blockchains themselves, but they don't function as standalone blockchains; the transactions that they support must eventually be verified on the base layer in some way.
Given that this article is intended as a survey of some of the second layer solutions that are currently being developed, it's important to bear in mind that the definitions provided below are generally not comprehensive, nor do they purport to account for every possible iteration of the technologies discussed.
Furthermore, different second layer solutions are not necessarily incompatible. Some have the potential to interoperate, and some are built directly on top of other second layer platforms and protocols.
A payment channel is an instrument that two users mutually create. It takes the form of a wallet in the Bitcoin context and of an EDCC, also known as a smart contract, in an Ethereum-based environment. Its basic purpose is to allow two parties to execute a theoretically unlimited number of transactions off chain, settling accounts with the main chain only when the parties create the channel, deposit more funds into it, or cash out. As more transactions take place on the second layer, the amount of code written to the base layer decreases. This increases the main chain's processing speed because it allows for more transactions to be processed in a single block. Cryptographic mechanisms encoded into the architecture of payment channels prevent participants from withdrawing funds that they are not entitled to.
Cross-Chain Atomic Swaps
Atomic swaps offer the potentially vital service of easily trading one type of digital asset for another, at little or no cost to either party, and without relying on a cryptocurrency exchange as an intermediary. In a hypothetical future of many blockchains, this would be an important enabler of interoperability between blockchain ecosystems.
To perform a cross-chain atomic swap, parties must set up two multisignature wallets (or multisignature contracts, in the case of Ethereum-based networks) that are similar in structure to payment channels, one on each of the blockchains in question. These instruments are governed by cryptographic mechanisms which, among other things, prevent a single party from withdrawing the contents of both wallets. Additionally, any time one party withdraws received funds, a cryptographic "secret" is automatically revealed to the counterparty, which enables it to withdraw as well.
The Lightning Network and the Raiden Network
The Lightning Network is essentially a web of many payment channels on the Bitcoin blockchain. It allows parties that have not opened a payment channel together to exchange funds through intermediary channels. For instance, if Alice and Bob; Bob and Charlie; and Charlie and Diana have payment channels open, Alice can pay Diana by way of Bob and Charlie. You can see a demonstration here.
The Raiden Network is very similar, but is built atop the Ethereum blockchain. An explanatory video released by the group developing it relates that as more users participate, the network's transaction processing speed actually increases.
RSK, formerly known as Rootstock, is a Bitcoin sidechain onto which the Ethereum Virtual Machine has been cloned, meaning that the platform supports EDCCs. While RSK is not a second layer chain, members of the team behind the project have plans for some rather unusual second layer apparatus that they intend to build on top of it (described below).
Lumino and the LTCP
Lumino is essentially a Lightning-type network built atop the RSK sidechain. One of its most distinguishing features is its proposed integration with the Lumino Transaction Compression Protocol (LTCP), a system of computing logic that significantly reduces the quantity of code that must be written to the RSK chain in order to create, top up, or settle a payment channel. Without getting too deep into the nuts and bolts of the protocol, it uses a series of references to other transactions, or to features of other transactions, to abbreviate the code that must be written to the base layer in order to open, deposit funds to, or close Lumino's constituent payment channels. LTCP's white paper, written by Sergio Demian Lerner, projects that it could enable the RSK platform to accommodate up to a billion users, though of course, it's unclear what kind of challenges this technology might face in practice, and what effect they might have on that figure.
Be sure to check back for part two, which will explore several second layer solutions not covered here.