Blockchain second-layer protocols
The Limitations of the Blockchain
Blockchain technology was a major innovation. The original Bitcoin whitepaper, authored by the pseudonymous Satoshi Nakamoto, described the first system that made a fully decentralized digital ledger system possible.
This system was designed to transfer the burden of trust in a digital ledger system from a single, centralized authority responsible for building and maintaining it to a set of cryptographic algorithms, blockchain protocols, and incentivized nodes.
However, the blockchain is not a perfect solution. Some of the most common complaints about the blockchain include:
- Scalability/Throughput: Blockchains produce blocks with a set maximum size at a certain rate. This means that the blockchain has a maximum capacity or throughput of transactions that cannot be exceeded.
- Transaction Speed: Transactions are added to the distributed ledger as part of blocks. These blocks are created at fixed intervals, transactions may not be included in the next block, and blocks (and the transactions that they contain) are not fully trusted until several blocks are built on top of them. All of these factors delay a transaction’s inclusion in the blockchain’s digital ledger.
- Overhead: Blockchains require the entire blockchain network to come to a consensus for a block or transaction to be accepted. This requires a large amount of network bandwidth and processing power to maintain full decentralization.
A number of different attempts have been made to “solve” these problems with Bitcoin. Some, like many altcoins, attempt to reduce the impact of these limitations by tweaking configuration settings within the blockchain protocol. Others use alternative distributed ledger architectures that eliminate some of these problems.
A third approach is to build systems that run on top of the distributed ledger. The most common example of a second-layer protocol built on top of the blockchain is the state channel.
Introduction to State Channels
State channels are designed to take advantage of the security provided by the blockchain but to enable transactions to be performed without including them in blocks. This is accomplished via the following process:
- Channel Creation: Two users of the blockchain network establish a channel. This is accomplished by performing a transaction on the blockchain network that locks a certain amount of cryptocurrency into this channel.
- Off-Chain Transactions: A state channel is essentially an agreement between two parties regarding how much cryptocurrency each currently holds within the channel. Transactions are performed by updating this shared state so that more or less of the balance in the channel belongs to one party or the other. Both parties mutually sign each update, which invalidates the previous version.
- Channel Teardown: At any given time, both participants within a state channel have a record of the current state of the channel. This enables either of them to tear down the channel by submitting the latest version as a blockchain transaction. This releases the locked cryptocurrency associated with the channel and transfers the appropriate amount to each party.
State channels are designed to solve the three main limitations of blockchain technology:
- Scalability/Throughput: A state channel can process an infinite number of transactions since the participants only need to keep track of the current balance. A state channel can only not perform a transaction if it becomes too “unbalanced” (i.e. there is not enough value at the sender’s end of the channel to perform the transaction).
- Transaction Speed: Unlike with blockchain, the only parties that need to be involved in a state channel transaction are the owners of the channel. This enables them to perform transactions as quickly as the two parties can mutually sign them.
- Overhead: State channels, unlike blockchain, do not require the entire blockchain network to come to consensus or even to be informed before a transaction is approved. This removes most of the overhead associated with blockchain transactions.
The main limitation of state channels is that it is only possible to directly perform a transaction between two parties if a state channel already exists between them. However, transactions can be performed between parties lacking such a direct connection via a series of state channels. In this case, each channel operator is paid a transaction fee for the use of their channel, but these fees may be zero or even negative if a transaction helps to rebalance a severely unbalanced channel.
Using State Channels Securely
State channels offer a number of different benefits compared to the traditional blockchain. The theoretically infinite scalability of state channels and the support for near-instant transactions solves some of the biggest challenges of blockchain technology.
However, state channel implementations like the Lightning and Raiden networks are still in their early stages, and new attacks are still being discovered. Understanding the potential threats and risks associated with state channels is essential to using them effectively and securely.