Layer Two

From CryptoCurrency Wiki

(Redirected from Layer 2)

Basics

  • Since scaling issues started to happen, people have started talking about Layer One and Layer Two solutions. Layer One is the main chain and usually is about on-chain scaling.
  • L2 scaling techniques move txs off-chain and bundle them into proofs that are submitted back to the main chain (external scaling).
  • Not on the main blockchain but on a side chain or off-chain. The main chain is also called the First Layer.

Difference with a Sidechain

"The big difference between layer 2 and sidechains is that layer-2 solutions generally rely on the security on the main chain, while a sidechain has its own security properties. While layer 2 solutions should be trustless, sidechains require trust."

Examples

" L2 scaling solutions can roughly be divided into:

  1. State channels
  2. Sidechains

State channels assume a fixed set of participants where everyone acts as a validator, whereas sidechains have a separate validator set and allow anyone to use the network.

In state channels, state changes are made by a fixed set of live participants. Any update to the channel must be digitally signed by all channel participants.

What are sidechains? They are either:

  1. Custodial - assets are moved to a parallel chain with its own consensus mechanism & security.
  2. Non-custodial - assets are held & state is secured by smart contracts on Ethereum (= can survive an attack of the sidechain).

Plasma is a general framework for building non-custodial sidechains. However, unlike custodial sidechains, Plasma chains derive their security from the main chain (Ethereum). In Plasma, the block headers (snapshots of the balances) are enforced on Ethereum.

What are Rollups? Rollups are non-custodial sidechains that solve Plasma's data availability problem. Rollup blocks include enough data for anyone to reconstruct & challenge their state. In Plasma, only a subset of validators can challenge blocks sent to the main chain.

Rollups come in two flavours:

  1. Optimistic rollups - ORs depend on a dispute game run by active validators.
  2. ZkRollups - ZKRs rely on cryptographic zero-knowledge (ZK) proofs, which are instantly validated by a smart contract.

What are Optimistic rollups? ORs resemble Plasma sidechains, but tradeoff some of their scalability to run fully general smart contracts (whereas ZKRs are currently better suited for simple payment transactions). ORs can run anything Ethereum can.

What are ZkRollups? In a ZKR, validators generate ZK proofs of all state transitions. ZK proofs are instantly verified by the Rollup contract on Ethereum. This means that it is extremely difficult to manipulate a block or commit a block with an invalid state."

"Layer one is making the blockchain handle more work. Right now every node verifies every transaction, which means the network can only process as many transactions as its slowest node. We could require participants to have really fast computers, but then the network would no longer be open. We could make everything more efficient, but that only gets you so far. Instead, the strategy here is to stop requiring every node to verify all the transactions and instead divide the work up among the nodes. This sounds easy, but dividing work in a trustless, decentralized way is challenging.
Layer two is making the blockchain handle less work. Not every transaction needs to go to the blockchain. With some clever thinking, we can settle transactions off-chain. Payment channels are a nice example of this: I can keep a line of credit open with you where we do our payments, and only when we are done or something goes wrong do we escalate to layer one.
In short, layer two is where the transactions will happen most of the time, and layer one is always there to guarantee that everything is done correctly. Layer one doesn’t get involved unless it has to. In many ways it acts as a court to resolve conflicts in layer two."

Usage