*https://gourmetcrypto.substack.com/p/layer-2-for-beginners*


Ali Atiia, March 2021

Misinformation campaigns in the crypto space increase dramatically during bull cycles. Many sidechain projects misleadingly present themselves as layer-2 scaling solutions. This article explains what makes a chain an L2, for absolute beginners.

Typically the layer-1 chain (L1) has higher security and liquidity, and the layer-2 (L2) is a new chain wanting to leech security and liquidity from L1.

Let's walk through a simple example to understand what that means, for absolute beginners, especially those who are just joining us here in crypto land (hi there 👋 welcome .. WATCH OUT!!!! oh uh, you just got rugged buddy, ops. What? It means you kinda lost your money …woo calm down!... you gonna call who?? What the hell is "The BBB" ??)

So you have 100 Dai on the Ethereum blockchain, it says so on your Metamask. But how does Metamask know? It's communicating with the Ethereum p2p network via an ethereum-node-as-a-service provider called Infura. But what does it really mean to have 100 Dai? It means that the Dai contract, which is a piece of software comprised of code and data that live on the Ethereum blockchain, has your address that you see in your Metamask, and next to it the number 100.

Back to the new shiny chain that may or may not be an L2, let's call this chain Macau. You want to "move" your 100 Dai from Ethereum to Macau because you want to buy something over there, or trade at cheaper gas prices, or maybe you just want to do something to feel something.

So how do you move your 100 Dai from Ethereum to Macau? Obviously you send an email to Vitalik's Masternode HQ and ask him to move it…. No, you actually transfer ownership of your 100 Dai to another contract on the Ethereum blockchain, which is typically referred to as the "deposit" contract (think of it like the deposit window at a casino).

Step 1/4: you send 100 Dai to Macau's deposit contract on the Ethereum blockchain.

Macau’s miners/validators detect your deposit because they constantly watch the Ethereum blockchain, particularly that deposit contract, and one of them says to the others: "hey guys! guys! we have a new victim, quick! look busy, ahem". She then says to you: "welcome chad, glad you could join us, here’s a 100 synthetic  Dai for you to play with on our chain, freshly minted in this new Macau block that I just mined/validated".

Step 2/4: you are issued a 100 IOU notes on Macau (think casino chips) representing a claim on the real 100 Dai that is locked up on the deposit contract on Ethereum. We call these notes synthetic Dai, or sDai for short.

You being "on Macau" practically means you are on some website, which has some Javascript that is communicating with the Macau p2p network. Exactly like you are "on Ethereum" when you are e.g. on Aave’s website to borrow or on Uniswap’s website to trade: the Javascript on these frontends package a borrow/swap transaction for you, feed it to your Metamask, you sob for 5 minutes after seeing the gas fee, then proceed to click "Confirm" to sign and broadcast your transaction. You're familiar with this workflow.

It's the same thing with Macau. In fact, it may even be the same exact workflow if Macau is a fork of Ethereum, like Binance's BSC or Avalanche's C-Chain because you can use Metamask with both, without the need for a specialized wallet to sign packaged transactions. This is because the address format and the cryptographic signature scheme is the same in Ethereum/BSC etc.

Step 3/4: do stuff with the 100 sDai on Macau, e.g. trade, farm, gamble, invest etc.

Say you played poker and turned your 100 sDai to 200 sDai. The +100 sDai you gained came from other people who also came to Macau to gamble (and so they too had previously locked real Dai on Macau's deposit contract on Ethereum).

We came to the critical moment (FOCUS 👏):