This week I spent some time learning about how Ethereum works, what its governance and monetary policies are, what the key upcoming updates to it are, etc.
I checked Udemy & Coursera but couldn’t find any course that looked good (they seemed either super high level bordering on “get rich quick with Ethereum” or very low-level “let’s build smart contracts on Solidity”). Instead I went through a bunch of different docs sites and blog posts that seemed serious or were recommended to me.
Not following a course was probably a mistake. I struggled to stay focused without the structure & clear view on progress a course with an instructor bring. I probably should have gone for this course even though it seemed a bit too applied too fast (low on theory). Good to know for next time…
Anyway, here are the key things I learned and want to remember.
- Ethhub.io: great for explaining higher level concepts, the history, roadmap, etc. They also link to other good resources, blog posts etc. Was the site I used the most
- Ethereum.org docs: good for more technical topics (eg explaining the EVM and L2 solutions) and seemed up to date. More hands-on / dev focused
- Understanding Ethereum, on District0x’s education portal: what they covered was very clear, but they only covered quite high-level concepts. Probably the best starting points for the first 30mins learning about Eth.
- Ben Edgington’s updates on ETH 2.0. Was recommended this to understand how the Eth 2.0 rollout is going. A pleasure to read compared to a lot of much drier documentation. He now does fortnightly bulletins on the rollout
- I don’t cover anything that’s happening at the application stack – Defi products, NFT platforms, etc. But there’s fascinating stuff going on there (which keeps dragging me and taking my time), and will probably right about em in the future
History and Network Upgrades
- Eth first introduced by Vitalik at Bitcoin Miami 2014. Bringing smart-contract functionality (turing complete programs) to the blockchain
- Genesis block awarded 60M Eth to the initial contributors of the presale (who paid 31k BTC in total) + 12M Eth going to the foundation. Genesis block July 30th 2015
- 10+ major upgrades since:
- Dao hard fork leading to Eth classic. Major ddos attack on the network in late 2016. “Ethereum Ice Age” in which mining had become too difficult fixed by Byzantium fork
- The rewards that are paid out to miners by the protocol
- Bitcoin’s policy (good summary)
- Block rewards to miners halve every 4 years. Enables us to fully predict supply and know will never be above 21M.
- Pro is that there will be no monetary inflation and this policy is hardcoded in the network. Decentralised governance
- Con is that over time fees will have to become the main way miners get compensated. So higher fees for users.
- Eth uses a policy of “minimum issuance to secure the network” which is decided off-chain by various stakeholders
- Currently 2 ETH per block and an additional 1.75 Eth per uncle block (plus fees) rewarded to miners. Was previously 5, then 3
- Current issuance rate is about 4.5%
- With PoS the issuance rate will be able to go down a lot (I presume because each miner will have a lot less work to do so lower costs eg on electricity)
- EIP 1559. Proposing to turn gas prices into base fees + tip. Base fee would be dictated by the network based on demand rather than having users enter them as today which can be wasteful for the user. The base fee would be burnt by the miners. Tip component could be issued too which miners could keep. (summary)
- If goes through could turn Eth into a deflationary asset
- “Gas refers to the unit that measures the amount of computational effort required to execute specific operations on the Ethereum network.”
- “In essence, gas fees are paid in Ethereum’s native currency, ether (ETH). Gas prices are denoted in Gwei, which itself is a denomination of ETH – each Gwei is equal to 0.000000001 ETH (10-9 ETH). For example, instead of saying that your gas costs 0.000000001 Ether, you can say your gas costs 1 Gwei.” (source)
- Useful for security. Puts a cost on ddos
- When you send a transaction to the network you can put whatever gas price you want. But miners have default strategy to reject if below Gas Price Oracle value.
- The more you pay the faster it will go through
This is the most mind-blowing bit… very well explained here.
- “The EVM exists as one single entity maintained by thousands of connected computers running an Ethereum client”. It’s a world computer…
- “The Ethereum protocol itself exists solely for the purpose of keeping the continuous, uninterrupted, and immutable operation of this special state machine” – Ethereum is a distributed state machine
- “At any given block in the chain, Ethereum has one and only one ‘canonical’ state, and the EVM is what defines the rules for computing a new valid state from block to block”
- “Ethereum’s state is a large data structure which holds not only all accounts and balances, but a machine state, which can change from block to block according to a pre-defined set of rules, and which can execute arbitrary machine code.”
- “In the context of Ethereum, the state is an enormous data structure called a modified Merkle Patricia Trie, which keeps all accounts linked by hashes and reducible to a single root hash stored on the blockchain.”
- Two types of transactions: those which result in message calls and those which result in contract creation.
- Contract creation means new compiled smart contract bytecode on the contract account, and whenever another account makes a message call to that contract, it executes its bytecode. For instance, depositing Eth in a MakerDAO vault (which is a contract).
- The EVM has transient memory which doesn’t persist between transactions, but also has persistent storage associated with each account (in a “Merkle Patricia storage trie”)
- All Eth clients include an EVM implementation
- Useful analogy: tokens at a video game arcade instead of having to use fiat. Enables standardisation
- Usage tokens
- Required to use a service. “medium of exchange” tokens
- Examples: Golem, 0x, Civic, Raiden, Basic Attention Token
- Work tokens
- “Give users rights to contribute work to the organization to help it function. In this model, the user (or service provider) stakes the native token of the network to earn the right to perform work for the network.”
- “The cool thing about the work token model is that as demand for the service grows, more revenue will flow to service providers. Given a fixed supply of tokens, service providers will rationally pay more per token for the right to earn part of a growing cash flow stream.”
- Examples: Augur, Keep, Truebit, Gems
- Security tokens
- external, tradeable asset that is a representation of value in a system. Provide a financial right to the token holder
- Has to be compliant with SEC regulations
- “Security Token Offering”
- Example: Aspen Ski resort tokenisation
- ERC-20 is a standard interface for tokens, meaning ERC20 tokens are a subset of Ethereum tokens
- ERC-721 tokens – NFTs.
- In the ERC20 token standard, developers can create any number of tokens within one contract, but in the ERC721 token standard, each token within the contract holds a different value (so they are unique)
- Token curated registry (TCR)
- an incentivized voting game that helps create trusted lists that are maintained by the very people that use them
- users collectively vote (using tokens) to decide which submissions are valid and should be included in the list
- Could make a decentralised Yelp or TripAdvisor with this model
- Registration period. New item (eg restaurant) submit a deposit using the TCR token. Challenge period where someone can match the submission deposit to trigger a community vote. Incentive: If the token holders vote to exclude the submission, “Tommy’s Tacos” deposit is lost and redistributed to the challenger, and those who voted to exclude it from the list.
- However, if the token holders vote to include Tommy’s Tacos; the challenger’s deposit is lost and then redistributed to those who voted to include it.
- Key constituents
- node operators who want to run software but not develop it
- core devs, implement aspects of the protocol and want their versions to be chosen by node operators
- On-chain governance
- Nodes vote on code updates, everyone adopts the winning vote, no hard forks
- Pros: fully decentralised, possibility of hard fork reduced
- Cons: low voter turnout, tends towards plutocracy
- Tezos, Polkadot
- Off-chain governance
- More messy, a bit like real-world politics
- If consensus not reach on a new proposal, devs can hard fork and the market decides which chain is best
- In late 2018 was about 80 ppl working on
- Research (mainly Eth 2.0)
- Geth Client
- WASM (web assembly which EVM is planned to use a flavour of for 2.0)
- Whisper/Swarm (explained here – part of the stack for doing P2P communications)
- Pyevm/Trinity/Vyper (EVM implementations)
- Developer Tools
- Developer Grants
- It’s a Swiss nonprofit, Miyaguchi Ayako(@mi_ayako) is the Executive Director
- The Ethereum Foundation’s multisig wallet is known and as of 7/12/20 holds 562,438 Ether
Eth 2.0 Rationale & Design
Today’s big problems:
- clogged network: 15-45 tx limit, leading to fees getting higher. “We will either manage to scale Ethereum or die trying”. Vitalik few years ago.
- disk space (chain size grows) – currently 390GB
- too much energy taken by PoW
- Move to “shard chains” which will spread the load of the network onto 64 new chains
- Validators will only need to ‘run’ their shard and not the entire Ethereum chain. This makes nodes more lightweight, allowing Ethereum to scale and remain decentralized.
- The transition to proof-of-stake means that the Ethereum protocol has greater disincentives against attack. This is because in proof-of-stake, the validators who secure the network must stake significant amounts of ETH into the protocol. If they try and attack the network, the protocol can automatically destroy their ETH.
- (Whereas with PoW it can “just” be 51%+ of the mining equipment you need to acquire, and it wouldn’t get destroyed after)
- The Beacon Chain will randomly assign validators to different shards – this makes it virtually impossible for validators to ever collude by attacking a specific shard.
- Staking also means you don’t need to invest in elite hardware to ‘run’ an Ethereum node
- With PoS the network is secured by ETH not computing power. Much much less energy use
Eth 2.0 Roadmap
The Beacon Chain
The Beacon Chain was shipped on Dec 1st 2020. Good explanation of what it does from Edgington here.
- Name has its origins in idea of a “random beacon” that provide source of randomness to rest of the system
- 1) Manages validators and their stakes
- Validates new nodes and adds them to validator set
- Validators propose new blocks, when chosen to do so, on both the Beacon Chain and, once they have been implemented, the shard chains.
- Validators can signal that they wish to exit the system and cease being involved (with delay)
- Tracking & updating of validators’ deposits including rewards & penalties. Small penalty for being absent (“quadratic leak”) big penalty losing 32ETH deposit (“slashing”) if try to break rules
- 2) Randomness
- RANDAO construction with validators providing a “hash onion”. A RANDAO is simply a way to combine contributions (individual random numbers) provided by many participants into a single output number.
- 3) Block proposers
- Ethereum 2.0 blocks are produced regularly every 16 seconds (period called “slots”).
- At each slot, the chosen proposer for the Beacon Chain collects up all the protocol votes (attestations) from the Beacon Chain validator set for previous blocks and forms them into a block that it publishes.
- (when shard chains are in place they will do that just for this shard’s transactions)
- votes (known as “attestations”) on which blocks form the true history of the chain
- Crosslinks tie the whole sharded system together, anchoring each shard to the spine that is the Beacon Chain.
- Periodically, the current state (the “combined data root”) of each shard gets recorded in a Beacon Chain block as a crosslink. When the Beacon Chain block has been finalised, the corresponding shard block is considered finalised, and other shards know that they can rely on it for cross-shard transactions.
Broadly speaking moving down the stack from the architecture diagram above.
- Shard chains. Initially just with data availability, won’t handle transactions or smart contracts.
- Docking mainnet with Eth2. Expected 2021/2022. The Ethereum mainnet will be docked to the ETH2 and become a shard itself, adapting to the PoS system and getting rid of PoW.
- Ethereum Web Assmembly – “a proposed redesign of the Ethereum smart contract execution layer using a deterministic subset of WebAssembly” – is planned to ship with 2.0 as well. Will enable development of smart contracts in lots of traditional languages and reuse tooling.
And yes, like any software project it is very late 🙂
Scaling on Eth 1.0
Post from Vitalik from October 2020 where he explains why “the Ethereum ecosystem is likely to be all-in on rollups (plus some plasma and channels) as a scaling strategy for the near and mid-term future” until Eth 2.0 fully lands with full feature parity (enabling today’s dapps to run on it)
These are all “layer 2” solutions – handling transactions off the main Eth chain (layer 1).
State channels & Plasma
- The process in which users transact with one another directly outside of the blockchain. similar to the concept of payment channels in Bitcoin’s Lightning Network
- By being able to always revert back to the main chain as an arbitration mechanism, users are game-theoretically incentivized to act rationally
- Helps with scaling, and with privacy (transactions just between the 2 actors are not visible on mainnet)
- How they work
- Users lock up a portion of the state by sending money to a multisig contract
- Users sign transactions and send them to one another
- Each transaction contains a nonce so the smart contract knows chronological order of transactions
- Once transactions between parties are done state is closed by submitting a transaction to Eth blockchain (L1)
- After state is updated and unlocked, the smart contract sends each party their remaining balance
- Examples: Connext, Raiden, Perun, Statechannels.org
- Plasma is a similar concept
- allows the creation of ‘child’ blockchains that use the main Ethereum chain as a trust and arbitration layer (arbitration only in the case of dispute)
- While state channels allow users to withdraw their assets any time, Plasma users have to wait a predetermined arbitration window which usually lasts 7 – 14 days.
- Examples: OMG Network, Matic Network, Gluon, Gazelle, LeapDAO
- “Rollups are solutions that bundle or “roll up” sidechain transactions into a single transaction and generate a cryptographic proof, known as a SNARK (succinct non-interactive argument of knowledge). Only this proof is submitted to the main chain.”
- “Rollup solutions require relayers who have staked a bond in the rollup contract. This incentivises them to relay rollups accurately.”
- Zero-knowledge rollups
- Run computation off-chain and submit a validity proof to the chain
- Limited to simple transfers, not compatible with EVM
- Can be slow to compute the proof but once done no arbitration / dispute time on L1
- Examples: Loopring, Starkware, Matter Labs zkSync, Aztec 2.0
- Optimistic rollups
- Running computation on L2 and just proposing new state to L1. “notorising” the transaction
- Can have a big impact as computation is the slow, expensive part of Eth.
- The L1 state that was posted can be challenged. You can prove fraud by staking ETH (didn’t fully get it – explained here)
- Examples: Optimism (who just raised $25M A from a16z, and were “saved” for their testnet launch by my hero geohot), Offchain Labs Arbitrum Rollup, Fuel Network, Cartesi
Stuff gets even more mind-blowing with the Layer 2s (the VM executing across L1 and L2 contracts)… and no I definitely don’t get it all it’s just an awe-inspiring picture 🙂
Good writeup here of current solutions & their tradeoffs.
The amount of activity going on in different L2 solutions, combined with the roadmap for 2.0 (and $5B+ in ETH staked on the Beacon chain already, which people can’t take out until 2.0 launches), and some healthy competition breathing down it’s neck… makes me all quite bullish that Eth will scale fast enough to retain its lead as the biggest dev ecosystem…
[…] ✍ Writeup […]