Zachary Goldstein
8 min readMay 4, 2022

--

Layer 2 Solutions: ZKproofs and much more!

What is an EVM?

Ethereum Virtual Machine, or EVM for short, is the software platform that devs can use to create DApps on ethereum. To take it back one abstraction, a Virtual Machine(VM) has all the same characteristics as a physical computer/machine. Such as CPU, memory, disks to store files, and connectivity to the internet. An EVM one single entity maintained by thousands of connected computers running the ethereum client. The EVM holds all ethereum accounts and smart contracts. The purpose of an EVM is to determine what the state of ethereum will be for each block on the blockchain. The EVM is what defines the rules for computing new valid states from one block to the next.

Source

What is Polygon

Polygon is a layer 2 solution. This means that Polygon sits on top of Ethereum which is layer 1. Polygon is a multi-level platform that has a goal to get rid of the congestion that is currently on the Ethereums network. Right now gas fees are extremely high on Ethereum and using layer 2 allows users to get quicker transactions at a very lower cost.

Polygons solutions:

● Polygon Edge- a modular framework for building Ethereum compatible blockchain networks

● Polygon PoS chain EVM compatible ethereum sidechain, secured by a permissionless set of Pos validators and checkpoints submitted to Ethereum

● Polygon Hermez(zk-rollup) Ethereum layer 2 solution based on succinct validity proofs(aka zero knowledge proofs) that get periodically submitted and verified on Ethereum

● Polygon Nightfall one-of-a-kind, privacy-focused Rollup that effectively combines the major concepts of Optimistic Rollups with Zero -knowledge cryptography commonly used in zk-rollups.

● Polygon Miden a STARK based, Ethereum compatible rollup

Polygon is like a swiss army knife of layer 2 solutions.

Source

Optimistic Roll-ups

Optimistic roll-ups are a Layer 2 solution that does not run on Ethereums base layer, but on top of it. This allows smart contracts to run at scale and being secured by Ethereum. A rollup is a type of scaling solution that works by executing transactions outside of Layer 1, but posting transaction data on Layer 1. This allows the rollup to scale the network and still derive its security from the Ethereum consensus. Moving computation off-chain allows for essentially processing more transactions in total as only some of the data of the roll-up transactions has to fit into Ethereums blocks. To achieve this, roll-up transactions are executed on a separate chain that can even run a rollup-specific version of the EVM.

The next step after executing transactions on a rollup is to batch them together and post them to the main Ethereum chain. The whole process essentially executes transactions, takes the data, compresses it, and rolls it up to the main chain in a single batch, hence the name- a rollup.

How does Ethereum know that the posted data is valid and wasn’t submitted by a bad actor? Each rollup deploys a set of smart contracts on Layer 1 that are responsible for processing deposits and withdrawals and verifying proofs. Proofs are also where the main distinction between different types of rollups come into play. Optimistic rollups use fraud proofs. Optimistic rollups post data to layer 1 and assume that it is correct. If the posted data is valid we are on the happy path and nothing else has to be done. The optimistic rollup benefits from not having to do any additional work in the optimistic scenario. In the case of an invalid transaction, the system has to be able to identify it, recover the correct state and penalize the party that submits such a transaction. To achieve this, optimistic rollups implement a dispute resolution that is able to verify fraud proofs, detect fraudulent transactions and disincentive bad actors from submitting other invalid transactions or incorrect fraud proofs. In most of the optimistic rollup implementations, the party that is able to submit batches of transactions to layer 1 has to provide a bond usually in the form of ETH. Any other network participant can submit a fraud proof if they spot an incorrect transaction. After a fraud proof is submitted, the system enters a dispute resolution mode. In this mode, the suspicious transaction is executed again this time on the main Ethereum chain. If the execution proves that the transaction was indeed fraudulent, the party that submitted this transaction is punished, usually by having their bonded ETH slashed. To prevent the bad actors from spamming the network with incorrect fraud proofs, the parties wishing to submit fraud proofs usually have to provide bond that can be subject to slashing. In order to be able to execute a rollup transaction on layer 1, optimistic rollups have to implement a system that is able to replay a transaction with the exact state that was present when the transaction was originally executed on the rollup. This is one of the complicated parts of optimistic rollups and is usually achieved by creating a separate manager contract that replaces certain function calls with a state from the rollup. The system can work as expected and detect fraud even if there is only 1 honest party that monitors the state of the rollup and submits fraud proofs if needed. Because of the correct incentives within the rollup system, entering the dispute resolution process should be an exceptional situation and not something that happens all the time

Optimistic rollups have to give enough time to all the network participants to submit the fraud proofs before finalizing a transaction on layer 1. This period is usually quite long to make sure that even in the worst-case scenario, fraudulent transactions can still be disputed. This causes the wait time to be long, so users have to wait for even as much as a week or two to be able to withdraw their funds back to layer 1

Optimistic Rollups only requires 1 person to submit

Source

Zk Rollups

Zk rollups do not have a dispute resolution. This is possible by leveraging a clever piece of cryptography called zero-knowledge proofs. In this model, every batch posted to layer 1 includes a cryptographic proof called ZK-SNARK. The proof can be quickly verified by the layer 1 contract when the transaction batch is submitted and invalid batches can be rejected right away. Zk-rollups do not have the problem of long withdrawals as the funds are available for withdrawals as soon as the rollup batch, together with a validity proof, is submitted to layer 1. Due to the complexity, it is harder to create an EVM compatible ZKrollup which makes it more difficult to scale general-purpose applications without having to rewrite the application logic. ZK-rollups are more computation-heavy than optimistic rollups. This means that nodes that compute ZKproofs have to be high spec machines, making it hard for other users to run them

Source

ZK-SNARKS

Zk-snarks stands for zero-knowledge succinct non-interactive argument of knowledge. Zk-snarks at the base depend on elliptic curves for its security. Zk-snarks also require that their is a trusted setup. A trusted setup refers to an initial creation event of the keys that are used to create the proofs required for private transactions and the verification of those proofs. Initially, when those keys are created, there is a hidden parameter linked between the verification key and the keys sending private transactions. If the secret used to create these keys in the trusted setup event are not destroyed, the secrets could be used to forge transactions by false verifications, giving the holder the ability to perform actions such as creating new tokens out of thin air and using them for transactions. Because of the privacy features zk-snarks, there would be no way to verify the tokens created out of thin air were actually created out of thin air. The trusted setup is needed only initially.

Source

ZK-STARKS

Zk-snarks stands for zero-knowledge scalable transparent argument of knowledge. The base technology relies on hash functions, this makes it quantum resistant. No trusted setup is required to begin using the network. Starks has far larger proof sizes, verifying starks takes more time and gas.

Source

StarkNet

StarkNet is a permissionless decentralized validity-rollup AKA a zk-rollup. It is an L2 solution built on top of ethereum, it’s benefits are unlimited scale for its computation by using dApps. StarkNet contracts and the StarkNet OS are written in Cairo, which is efficient, prod ready, and a Turing complete language. Turing complete means that the language is used for creating provable programs for general computation. In other words, it is a system in which a program can be written to find an answer. Cairo has a compiler, VM, IDE extensions, tracer, and application code. You are also able to write the smart contracts in Solidity which then transfers it over into Cario.

Source Good Reads

Avalanche

Avalanche is a highly scalable blockchain that is broken down into compartments. Avalanche has 3 built in blockchains:

● Exchange chain(x-chain) decentralized platform used for trading and creating digital assets

● Platform chain(p-chain) is the metadata blockchain that coordinates validators, keeps track of active subnets and enables the creation of new subnets. The p-chain implements the snowman consensus protocol.

● Contract chain(c-chain) allows for the creation of smart contracts using the c-chains API

What is the Avalanche Consensus Protocol?

Are we headed to a Multichain ecosystem?

Where will we end up? We have several different L1’s such as Ethereum, Solana, Avalanche, Telos. We have different L2 scaling solutions such as polygon, rollups, zk-starks, zk-snarks. How can everything operate together? Then we have Blockchains like Polkadot and Cosmos that operate like hubs. They are used as application specific. With all of these various different solutions to congestion and high fees Multichain might be the answer. Instead of having One chain dominating the whole ecosystem perhaps we will have different Blockchains having its strengths and weaknesses, but being able to connect to different chains through various L2’s. It seems that having EVM compatibility is extremely important since Ethereum is the foundation for developing popular products.

Skale

Skale is another layer 2 scaling solution which is based off of elastic side chains to move processing the mainnet. “SKALE’s nodal network is subdivided into Node Cores and subnodes. Each SKALE Node Core oversees node computation and storage resources, monitors uptime and latency, and provides node owners with an interface to withdraw, deposit, stake, or claim SKALE tokens” The elasticity component of the side chains, similar to a build your own side chain, are chains size, consensus protocol, VM, parent blockchain, and additional security measures. Benefits are high throughput, low cost, and low latency. The side chains are EVM compatible and enable provisioning and provably secure byzantine fault-tolerance blockchains for access to the main net.

Source

OMG Network (OMG)

OMG is a permissionless and trustless layer 2 scaling solution for ethereum. OMG increases the network’s throughput. The decentralized protocol is designed as a plasma chilid chain. A plasma child chain uses nested blockchains, which was explained earlier. Plasma is built through the use of smart contracts and Merkle trees, which allow the creation of unlimited child chains. This allows for more chains to be created on top of one another, building a tree-like structure. These child chains are smaller copies of the parent ethereum blockchain. The child chains are designed to work in a singular way, they coexist and operate independently. This use of plasma child chains takes the load off of the main ethereum chain.

Source

--

--

Zachary Goldstein

Syracuse University Senior in Information Management and Technology, Blockchain Researcher