Layer 2 – Mangrove

GlossaryBlockchain basics

Layer 2

Definition: A layer 2 is a network that processes transactions off a main blockchain, the layer 1, to cut costs while relying on that chain for its security.

Layer 1 is the base blockchain, such as Ethereum Mainnet. Ethereum’s documentation describes layer 2 as a collective term for solutions that help applications scale, meaning handle more transactions, “by handling transactions off the Ethereum Mainnet (layer 1)” while relying on Mainnet’s security (ethereum.org). A rollup runs batches of transactions outside layer 1 and posts their data to it. Because many transactions share one posting, fixed costs are spread across the batch, “reducing fees for end-users” (ethereum.org). Sidechains, by contrast, are separate chains that “derive their security separately from Mainnet”.

An optimistic rollup assumes its transactions are valid and posts no proof of validity with them. After each batch comes a challenge period, during which anyone can dispute a result with a fraud proof, a computation showing that a transaction was processed wrongly. Withdrawals back to Ethereum wait for that period, which ethereum.org says lasts “roughly seven days” (ethereum.org). A zero-knowledge (ZK) rollup posts a validity proof instead, “a cryptographic assurance that the state-change proposed by the rollup is really the result of executing the given batch of transactions” (ethereum.org), so its withdrawals face no such delay. Vitalik Buterin writes that the proofs rollups use “share the property that verifying the proofs on-chain is much cheaper than doing the original computation off-chain” (Buterin). Despite the name, ethereum.org notes that zero knowledge, meaning proofs that “reveal no information about private inputs beyond what follows from the public statement”, is a separate property: “using validity proofs for scaling does not, by itself, make a rollup’s transactions confidential”. For example, a user moving funds from an optimistic rollup back to Ethereum would wait until the challenge period ends. Base, which its documentation calls “a rollup built on Ethereum” (Base), charges each transaction “an L2 (execution) fee and an L1 (security) fee” (Base).

Some Mangrove workflows accept x402 payments, and a fresh x402 installation of the open-source Mangrove Agent pays in USDC, a stablecoin, on Base mainnet, the live network of the Base blockchain, where x402 payments spend real USDC. x402 is a separate entry.

On 5 September 2018, the GitHub user barryWhiteHat created roll_up, a project to “scale ethereum with snarks”, a kind of short cryptographic proof. On 22 September 2018, Buterin described on the Ethereum Research forum a design that combines many users’ transfers into one transaction and publishes a proof of their validity with the compressed transaction data (Ethereum Research). He presented it as a way to scale “without using layer 2’s”, naming “channels, plasma” as examples. On ethereum.org, channels let participants transact off-chain and then settle with Mainnet, and a Plasma chain is “a separate blockchain that is anchored to the main Ethereum chain”. In An Incomplete Guide to Rollups (5 January 2021), Buterin counted rollups among “the three major types of layer-2 scaling”, with state channels and Plasma.