The Importance of Layer 2
Last weekend we held a Layer 2 Summit at Fidelity Labs and the MIT Media Lab. This post is based on my opening statements from the conference and is about what Layer 2 is, why it’s important, and what I learned at the summit.
I think the most pressing issue in cryptocurrency and blockchain technology right now is, how are we going to achieve the original vision of blockchains as open, decentralized networks while scaling to reach a billion people? At the summit, we gathered practitioners who are working on projects that address that question from a particular angle: Layer 2.
Why is scaling such an important problem right now? Well, how many of you have ever played Cryptokitties?
Cryptokitties was by far the most popular application on Ethereum, and when it launched, it slowed Ethereum to a crawl. Gas prices skyrocketed, people were waiting days for transactions. It was half of all the gas used on the network. People said Cryptokitties “broke” Ethereum.
At its peak, Cryptokitties had 14K daily active users and 130K transactions a day.
Now, you can argue CryptoKitties doesn’t “need” to operate in a decentralized fashion, or on Ethereum, and I am very sympathetic to that argument. But it is a real example of the limits of this technology. The team has so much more that they want to build and try, but they simply can’t because the underlying platform can’t support it.
Bitcoin’s peak is around 425K transactions per day and Ethereum’s is 1.4 million. But Twitter has 150 million daily active users, and Facebook has 1.4 billion. The financial system is much larger than even that.
If you believe that one goal of this technology is to democratize access to the financial system, we have a very long way to go.
The scaling challenge for blockchain technology is what first got me interested in this space. I had finished research at MIT where I worked on scaling multi-core databases, and I was interested in techniques to scale distributed databases. It’s a challenging problem which is very workload-dependent. Often the techniques you use to scale actually make things slower overall, or don’t work in a generalized way. They certainly add a lot of complexity.
This was 2015, and I kept hearing in the news how there was this big debate raging about the blocksize and how to scale Bitcoin — in fact, there was a conference happening in Montreal literally called “Scaling Bitcoin”. I decided to take a look at why it might be so hard to scale blockchains, and then I went down a rabbit hole and never came out.
You see, fundamentally, blockchains just don’t scale. There are different ideas on how to increase the capacity of the underlying blockchains behind cryptocurrencies like Bitcoin and Ethereum — faster consensus protocols and sharding being the most well-known — but I believe they are all going to reach their limits before we get to the scale we want to achieve.
Scalability is defined as getting a proportional increase in the amount of work you can do in a system by adding more resources. But the security of blockchains is based on as many participants as possible verifying and validating every transaction or, in the case of Ethereum, every step of every smart contract. What this means is that you don’t reduce the amount of work per node when you add more nodes — they all still have to verify everything, and the new nodes cannot do new, useful work. The design doesn’t scale.
Faster consensus protocols will certainly help increase the amount of transactions per second up to a point, but they do not help with scalability.
One potential solution proposed for scalability is sharding, or dividing the network of nodes into multiple partitions which each process a subset of transactions. I’m not optimistic about this solution because in distributed databases, sharding solutions are quite complex and the cost of cross-shard transactions, even if there are only a few of them, can dominate the cost of the overall system. Money is not a perfectly partitionable workload, so I imagine there will be a significant number of cross-shard transactions.
One way to try to circumvent this issue is to create a new blockchain for each application. This is essentially partitioning by application, which cannot help scale within an application. Also, it makes one question the need for a blockchain in the first place — why can’t the application creator just manage the application? — and it affects interoperability and reduces security. Cryptokitties is building their own blockchain. Will it be less interesting for people to build things like KittyHats if it’s on an AxiomZen blockchain? Will they even be able to?
So far, the only viable solutions I’ve seen to address scalability are Layer 2 solutions. The idea behind these projects is to achieve amortized costs: the more transactions, the lower the cost per transaction. Right now in cryptocurrencies the more transactions, the higher the cost per transaction, because there is limited space, processing capacity, and bandwidth, and the increased competition for these limited resources makes fees go up.
We want to get lower costs per unit of work the more work we do. One way to do that is to use the blockchain as an anchor of trust instead of as a generalized state machine which processes everything.
Layer 2 encompasses many different techniques and projects. This post does an excellent job describing many Layer 2 solutions, but I want to broaden the definition. The most well-known and advanced Layer 2 solution so far is the Lightning Network, which uses payment channels; the counterparts in Ethereum use state channels. But Layer 2 is also off-chain computation and hiding complex scripts inside signatures, or using zero-knowledge contingent payments, because we can achieve amortization using these techniques too: a signature validation is the same cost no matter the complexity of the off-chain script. It’s also about interoperability between different blockchains. Ultimately, it’s designing applications that anchor to the blockchain as a root of trust, instead of executing every step on the chain.
The #L2Summit and open questions
Unfortunately, it’s not at all clear how to directly apply Layer 2 solutions to a complex application. Writing a contract that executes entirely on-chain is a much easier task for an application developer than reasoning about Layer 2 solutions. There are many questions that will need to be answered as Layer 2 development proceeds: How can you effectively divide up an application into these pieces, the piece that anchors on the blockchain and is as small and cheap as possible, and the pieces that execute off-chain? Where should one run these off-chain bits, and how can one achieve fault-tolerance and decentralization in this context?
Payment channels are by far the most advanced Layer 2 implementations, in particular those of the Lightning Network. But even though people are making Lightning transactions on Bitcoin’s mainnet, it’s still unclear exactly how to effectively run a Lightning hub and protect your private keys, or what the right fees are. At the summit, Alex Bosworth had a great presentation on his experience running Y’alls where he detailed these issues.
The state channels panel was fascinating because I realized that there is currently no standard way of using state channels on Ethereum. I’m looking forward to seeing more of the work L4 is doing and Patrick McCorry’s upcoming work on a new model for outsourcing arbitration.
Even if these issues get solved, Layer 2 solutions can greatly affect the incentives of the underlying blockchains. And it’s not clear what classes of applications can benefit from Layer 2 solutions and what classes cannot.
Despite these challenging problems, I’m excited — we’ve started the conversation. The summit marked an important step in that process, gathering people who work on Layer 2 projects on many different platforms and cryptocurrencies. The participants often attend different conferences and talk in different channels, but last weekend they took the time to listen to people who might be approaching things from a completely different perspective. We had presentations on Lightning, Truebit, Raiden, Interledger, scriptless scripts, Discreet Log Contracts, and more. I know we missed many exciting projects that are doing important work in this space; please reach out to get in touch so we can invite you next time.
We will need funding for these projects of course. So, if you’re a VC or funder, I encourage you to invest in people working on this. The returns aren’t as immediate or obvious as for people doing ICOs, but your investment will ultimately create more value and be more impactful. If you are a non-cryptocurrency company, you should know about this set of technologies and know that within the next year, we’re going to have cheap, plentiful micropayments using cryptocurrency.
There are many daunting challenges but I think Layer 2 is the best hope we have of scaling blockchain technology. Now it’s time to build.