## Ethereum in 30 minutes --- ### Ethereum is a general-purpose blockchain. ![](https://i.imgur.com/sMOslqO.png) --- ### We used to describe it like this... <img src="https://lh5.googleusercontent.com/xkkWdbZwXl5VHN8wQRQXdj2OafQ941Fi1TnLc9F82zLpq-jW9hjVa201BWiITK3XU_zFAsukYisP15v1CLBBkh1OsPmTneGJQ8kMKp7cOgbGPXGHwyTt5XUbsj1H-pmWtVb50S2ZPLf3X4k_8g567cMOP5CLGGRGtuBYjdSfD6ee6fjGVqh6Dqy5JDg" style="width: 30%" /> <img src="https://lh4.googleusercontent.com/NxTPwzEPse5gu-ib69I3qCpjoPGJiEz6zUOfOfVua7Ivaz1QLN78LI3yEBuUFgwcqTMZwtcI1-oWUjos4yovKL0VXHIEk17neH_iJgsJA9U37FHQaY-7mI3WjQXSJ3zGcMj9Zb0bg1zrDtXM0t2q0SjE9FiPb7b8fHDEstXx-5ltC-_e19bDhkQo8So" style="width: 30%" /> <img src="https://lh5.googleusercontent.com/QxBjuCDX-ETQEEZDE6xpq3Qp27zrYkE40Kjh3CgMdKnCLiqfaeBZSuJRAgUl-GCWk7CFcVJ89fpnPCnpnGn7AYY0KeXrOsTIADn3t23ju1WIYXAHaXpuXri7Fyd4wcIcuB6wjlNK-G79tW4MWacmTfhx_S9UN-ux35_vCQ3VInF532s2k93VsS-fHxY" style="width: 15%" /> But these days almost every new blockchain is general-purpose... --- ### So what does the blockchain look like? ![](https://i.imgur.com/TePLOPP.png) * Blocks contain transactions * Attestations "confirm" blocks --- ### Accounts <p style="margin: 1px; font-size: 50%">&nbsp;</p> <div style="font-size: 83%"> * The information ("**state**") that the blockchain keeps track of is made up of **accounts**. * There are two types of accounts: * **Externally owned account (EOA)** - this account represents the user, eg. if you hold ETH, that ETH is stored inside your EOA * **Contract** - this account is a computer program that lives on-chain. It has a piece of code, and internal storage. </div> --- ### What do contracts look like? &nbsp; <div style="font-size: 70%; padding-left: 100px; padding-right: 100px"> ``` struct Domain: owner: address ip: uint32 domains: public(HashMap[bytes32, Domain]) @external def set_owner(domain_name: bytes32, new_owner: address): owner: address = self.domains[domain_name].owner if owner == convert(0, address) or owner == self: self.domains[domain_name].owner = new_owner @external def set_ip(domain_name: bytes32, ip: uint32): if self.domains[domain_name].owner == self: self.domains[domain_name].ip = ip ``` </div> --- ### Transaction flow example <img src="https://i.imgur.com/M1AqQjs.png" style="width: 60%" /> --- ## Gas <p style="margin: 1px; font-size: 50%">&nbsp;</p> <div style="font-size: 83%"> * Gas is the "unit" of resource consumption within Ethereum * Gas cost examples: * A transaction costs a "base" 21,000 gas * Each computational step costs ~2-10 gas (usually) * Editing a storage slot costs 5,000 gas (20,000 if slot not filled yet) * Each byte of data costs 16 gas (4 if zero byte) </div> --- ### Gas <p style="margin: 1px; font-size: 50%">&nbsp;</p> <div style="font-size: 83%"> * If you send a transaction which gets included in a block, you must pay a fee proportional to how much gas the transaction consumed * <code style="color: yellow">fee = (base_fee + priority_fee) * gas_used</code> * Base fee: burned, value determined by protocol * Priority fee: paid to block proposer * A maximum of 30,000,000 gas can be spent in each block </div> --- ### Full transaction object <p style="margin: 1px; font-size: 20%">&nbsp;</p> <small> | Name | Type | Description | | - | - | - | | Tx type | byte | Here: 0x02 | | Chain ID | int | Which chain is this tx for? | | Nonce | int | Anti-replay value | | Max priority fee | int | Priority fee per gas, for block proposer | | Max fee | int | Max total fee (base + priority) per gas | | Gas limit | int | Max gas this tx is allowed to consume | | Destination | address | Which address this tx goes to | | Amount | int | How much ETH to send | | Data | bytes | Data passed in call if destination is a contract | | Access list | List[Tuple[int, List[int]]] | Accounts and storage slots to more cheaply pre-access | | Signature (3 fields) | (bool, int, int) | Verifies who sent it | </small> --- ### High level languages ![](https://i.imgur.com/mjkPdtH.png) --- ### Proof of stake consensus <p style="margin: 1px; font-size:50%">&nbsp;</p> * Deposit 32 ETH, become a validator * Each slot, 1/32 of all validators attest to the block created during that slot * Validator revenue: * In-protocol rewards * Priority fees and MEV from transactions * Validators can withdraw at any time, with a delay --- ### Fork choice <p style="margin: 1px; font-size:50%">&nbsp;</p> ![](https://i.imgur.com/X9EnWAO.png) --- ### Casper FFG finalization ![](https://i.imgur.com/lUTgZCE.png) If > 2/3 of validators online + honest, then after 2 epochs a block is finalized, and *cannot* be reverted. <small>(Though in practice 1 "safe" slot is enough for many apps)</small> --- ### Merkle trees ![](https://lh6.googleusercontent.com/vs4lIj3wGF2V2SbaYNkZn-hKHCOA8B8yoLXYz5U4-8-O79okvja3TU--iqK70Y1CLoFTPCDfjGbffGlw8oNvCP3dnUJrRgL1L1p_imBocdRHpDEZDJlbyqdm5Geudb77LvwjnvYbSYRqwED9ngO9thWjm3rujcdWTpWY0m3wyYwPeeho12h6MAeloTY) --- ### Merkle trees in Ethereum <p style="margin: 1px; font-size:50%">&nbsp;</p> <img src="https://lh5.googleusercontent.com/LQRvMnRw3vPLbpl15QICOFNcc_ttJJO48Lur9rbAMKKPlU5NOrAC2fKsrkblMYY68pskBr_LuETeCBw-ugDX9qybenySBVcvRKGPfPgDf8YLyQtr4O_rTs9sIX66G7sBdoD-Rcj1bxYHNcbT-JRdKS0JYo-vLmi0uYUuUdp1NjMQ86QoBr8if_bTcZ0" style="width:31%"/> <img src="https://lh6.googleusercontent.com/LuRmHqCT-roFyj1l9yOOM2CzFxFrkkw8C448jyR0PV3-0o14KLw0Z60SY2jLC4A3E24bQN7GhQeVUC6MVJKWN3yviDCWPsP5aFcVcGPL2r96zeuUmScW09Huem575M9ABdVdNGEZbbvTZhxwJekCa2TbpRIWWlEPRWsDN5FZA2YMafFAHAOAPTJCoe4" style="width:34%"/> <br> <p style="margin: 1px; font-size:50%">&nbsp;</p> * Allow for efficiently verifiable proofs that something happened in a block --- ### Merkle trees in Ethereum ![](https://lh4.googleusercontent.com/LmvrvQgR3ch7XjW7IRxDlqIVVtBkljuJO8M9KoRzApnsbIEvRv45T2X7Dlsh3KQlrEuVjYUxuhglh1PYmDsCaKX4yQg7nm-W2wo9EOtOCtqclYUHlxSXyePVz-CxC76SJNvIhoagjWKTrQUvY1daap22I7WqdEBl1K14EY1IaTAcT-cnHq-6csSdJJs) --- ### Layer 2 protocols ![](https://vitalik.ca/images/rollup-files/diag2.png) <p style="font-size: 83%">It is increasingly popular for users to "live" not on Ethereum directly, but on "layer 2" protocols that inherit security from Ethereum, and add higher scalability on top.</p> --- ### Layer 2 protocols <img src="https://i.imgur.com/RnPpA7k.png" style="width: 38%" /> <p style="margin: 1px; font-size:50%">&nbsp;</p> <div style="font-size: 83%"> * From a user's point of view, living on a modern layer 2 feels like living on Ethereum. Applications work the same way. * However, fees are many times lower. </div> --- ### Future directions <p style="margin: 1px; font-size:50%">&nbsp;</p> <div style="font-size: 83%"> * **The Merge**: Done! But PoS can be improved with single slot finality * **The Surge**: Improved scalability through rollups, danksharding and ZK-SNARKs * **The Verge**: Replacing Merkle trees with more efficient data structures that let Ethereum nodes be much lighter ("stateless clients") * **The Purge**: Clearing out old data and technical debt * **The Splurge**: a grab bag of various useful stuff: account abstraction, EVM improvements, PBS... </div>
{"type":"slide","slideOptions":{"transition":"slide","parallaxBackgroundImage":"https://i.imgur.com/pvPDNWD.png","parallaxBackgroundSize":"100% 100%","parallaxBackgroundHorizontal":0}}
    96 views