# ETH - Ethereum

### First Mover Advantages

* the largest and most active communities & developers
* the public chain with the highest DeFi TVL
* well developed ecosystem from DApps to NFTs
  * **DApps:** fundamental infrastructures like MarkerDAO, AAVE, Curve, Uniswap, Compound
  * **NFTs:** blupchips like Crypto Punk, Bored Ape Yacht Club, Art Blocks auctioned on Sotheby’s
* first decentralized, stable, robust chain with long term development plan - lots early believers

### Proof of stake (POS) consensus mechanism

* first chain establishes POS to achieve distributed consensus
* validators stake Ethereum token into a smart contract of the network
  * algorithm to selected a validator from the pool to validate & forge a block of transactions
  * larger stake gets higher chance to be selected
  * nodes can validates blocks forged, dishonest validators will have fine costs more than earn
* benefits: better energy efficiency, lower validator requirements, decentralized, costly 51% attack

### Level 2 Solutions

Level 2 chain is a scaling solution that not scarifying Ethereum chain’s security, but executes transactions outside Level 1 to improve speed & reduce gas cost.

**ZK-Rollup - validity proof**

* batch of transactions generates a **Zero-Knowledge Proof (ZK-SNARK)** for the correct state root
* **ZK-SNARK** **proof** is:
  * a hash of the state after executing the transactions in the ZK-rollup layer
  * a proof of an underlying piece of data without revealing the data
  * people can verify that the data validity even if they don’t have access to the data itself
* this validity proof is validated against the smart contract before it can be implemented

**Optimistic Rollup - fraud proof**

* batch of transactions is bundle send to the mainchain, the state root and hash is posted
* assume the state transition is correct and not checking it every time by the smart contract
* if someone discovers an invalid state transition was published to the rollup contract, a **fraud proof** is posted to the rollup contract on the mainchain
* The **fraud proof** includes:
  * a proof of pre-state - status before a transaction was applied
  * a proof of post-state - status should have looked after the transaction was applied
  * a proof of the invalid transactions that were applied during a state transition
* contract verifies the proof by comparing post-state, reverts all following batches if mismatch

**Plasma - fraud proof**

* a ‘child’ blockchains that use the main Ethereum chain as a trust and arbitration layer
* each plasma chain can have its own mechanism for block validation
* fraud proofs ensure whenever any malicious activity, users can report dishonest nodes

### Ethereum 2.0 **Beacon Chain (coordination layer)**

* Beacon chain merges with Ethereum mainnet in ‘the merge’ upgrade
* transition from proof-of-work to proof-of-stake consensus layer
* manage validators’ rewards, penalties & how validators vote on the proposed blocks
* responsible for randomly assigning validators to validate upcoming shard chains

### Ethereum 2.0 Shard chains (data layer)

* scale by splitting a database horizontally to increase the size of the existing database
* reduce congestion and increase transactions per second
* validators only process data for the shard they're validating, not the entire network
* more shard, more validators, more decentralized, more secured
* with rollup L2s, transactions are bundle processed off chain to reduce data per transactions
