This page needs help! If you’re an expert on the topic and want to contribute, edit this page and sprinkle it with your wisdom.
, September 22, 2020
See contributors

layer 2 is a collective term for solutions designed to help scale your application by handling transactions off chain. transaction speed suffers when the network is busy which can make the user experience poor for certain types of dapps. and as the network gets busier, gas prices increase as transaction senders aim to outbid each other. this can make using ethereum very expensive.


you should have a good understanding of all the foundational topics. implementing layer 2 solutions are advanced as the technology is less battle-tested.

Why is layer 2 needed?


Channels allow participants to transact x number of times off-chain while only submitting two transaction to the network on chain.

Useful for:

participants must lock a portion of ethereum's state, like an eth deposit, into a multisig contract. a multisig contract is a type of contract that requires the signatures (and thus agreement) of multiple private keys to execute.

hg0088线上locking the state in this way is the first transaction and opens up the channel. the participants can then transact quickly and freely off-chain. when the interaction is finished, a final on-chain transaction is submitted, unlocking the state.

An example

state channel tic tac toe:

  1. create a multisig smart contract “judge” on the ethereum main-chain that understands the rules of tic-tac-toe, and can identify alice and bob as the two players in our game. this contract holds the 1eth prize.

  2. then, alice and bob begin playing the game, opening the state channel. each moves creates an off-chain transaction containing a “nonce”, which simply means that we can always tell later in what order the moves happened.

  3. hg0088线上when there's a winner, they close the channel by submitting the final state (e.g. a list of transactions) to the judge contract, paying only a single transaction fee. the judge ensures that this “final state” is signed by both parties, and waits a period of time to ensure that no one can legitimately challenge the result, and then pays out the 1eth award to alice.

there are two types of channels right now:


Rollups and sidechains

hg0088线上rollups are solutions that bundle or "roll up" sidechain transactions into a single transaction and generate a cryptographic proof, known as a snark (succinct non-interactive argument of knowledge). only this proof is submitted to the main chain.

Sidechains are Ethereum-compatible, independent blockchains.

in other words, rollups mean that all state and execution is handled in sidechains – signature verification, contract execution, etc. the main ethereum chain only stores transaction data.

rollup solutions require relayers who have staked a bond in the rollup contract. this incentivises them to relay rollups accurately.

Useful for:

hg0088线上there are two types of rollups:

Further reading

State channels

Payment channels

ZK rollups

Optimistic rollups


░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░ ░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░ ░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░ ░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░ ░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░ ░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░ ░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░ ░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░ ░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░ ░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░ ▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐░ ▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌ ▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐░ ░▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌░ ░▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐░░ ░░▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌░░ ░░░░▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀░░░ ░░░░░░▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀░░░░░ ░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▀▀░░░░░░░░

Help us with this page

hg0088线上if you’re an expert on the topic and want to contribute, edit this page and sprinkle it with your wisdom.

you'll be credited and you'll be helping the ethereum community!

use this flexible

questions? ask us in the #content channel on our

Back to top ↑
  • On this page
  • Prerequisites
  • Why is layer 2 needed?
  • Channels
  • Rollups and sidechains
  • Further reading