Fantom deep dive: Lachesis consensus, FVM and storage upgrades
Thread961 words
Long research thread on Fantom arguing FTM could regain DeFi relevance in 2023. Explains Lachesis DAG consensus, modular network architecture, the FVM's plan to replace the Merkle Patricia Trie and parallelize execution, and storage upgrades.
Key claims
Fantom TVL was USD 8bn a year earlier
Merkle trie manipulation consumes about 84% of EVM tx processing time on Fantom
FVM adds parallel transaction execution and a new data structure
0/ with the hype around #zkEVMs, many seem to have forgotten about @FantomFDN, while just a year ago #Fantom TVL was at USD 8 BILLION! 🤯
and $FTM could very well return to its former #DeFi glory in 2023 📈 👻
ALPHA-packed giga research 🧵 on $FTM (0/57) 👇
1/ Contents:
🤝 Consensus (2-13)
🏗 Network Architecture (14-18)
🖥️ Fantom Virtual Machine (19-28)
💾 Storage Upgrades (29-30)
⛽️ dApp Gas Monetization (31-34)
🌟 Account Abstraction (35-36)
⚖️ Governance (37-41)
🪙 Tokenomics (42-48)
💼 Team/Funding (49-51)
🌐 Ecosystem (52-57)
2/ 🤝 Consensus Mechanism
@FantomFDN uses #Lachesis, an asynchronous & leaderless consensus mechanism that is also Byzantine Fault Tolerant and provides almost instant finality
3/ each #Lachesis node stores a local acyclic directed graph (DAG) composed of frames & event blocks, where a frame is a set of connected event blocks, and an event block is like a block in a linear blockchain, containing the hashes of its parents & a list of transactions
4/ what is a #DAG you ask?
🔹 Directed, as nodes connect one-way
🔹 Acyclic, no loops (can't return to origin)
🔹 Graph, a mesh-like structure connecting all transactions.
5/ but back to #Fantom, where the event blocks contain data about transactions, smart contract interactions, and previously observed events, linking the event blocks into a graph/frame (see image in 3rd tweet)
6/ thanks to the #Fantom DAG 2.0 model, Fantom can confirm multiple blocks of transactions simultanously, as opposed to one block at a time as is the case with #Ethereum
7/ the #DAG captures the exact final order of events and each node independently keeps a record of transactions
new event blocks are unconfirmed, while event blocks that have reached a certain acceptance threshold are accepted and subsequently ordered by honest nodes
8/ unlike Proof-of-Work, round-robin Proof-of-Stake, coinage Proof-of-Stake or synchronous BFT, #Lachesis nodes don’t send blocks to each other. Only events are being synced between nodes
9/ hence validators don’t vote on a concrete network state. Instead, they periodically exchange observed transactions & events with peers in a querying process. When a query reaches an acceptance threshold of approvals, the node adds the transaction to the #DAG (in event block)
10/ new events are also used to vote for the events in 2-3+ previous virtual elections simultaneously. This leads to a smaller number of created consensus messages, as the same event is reused in different elections
11/ this enables #Lachesis to achieve a lower time to finality and a smaller communication overhead between nodes compared to synchronous #BFT consensus mechanisms
12/ #Lachesis’s event structure is a DAG of events. To optimize storage and retrieval, the #DAG is separated into sub-DAGs, each of them is called an epoch.
13/ each epoch is made up of many finalized event blocks. Each epoch is sealed when one of these conditions is satisfied:
✅ the epoch reaches a defined number of blocks
✅ the epoch lasts for a specified time
✅ at least one cheater is confirmed in this block
14/ 🏗 Network Architecture
But Fantom does not not solely pride itself with a high performance. Its modular approach to the Lachesis consensus module, allows devs to plug chains into the Lachesis conensus layer
15/ as #Lachesis is compatible with the @cosmos SDK, devs can for example use Fantom’s aBFT consensus mechanism as a base layer & use the #Cosmos SDK on top of it, focusing solely on building the application logic, while Lachesis handles consensus & state machine replication
16/ #Lachesis powers the #Fantom’s Opera mainnet deployment, which is an #Ethereum Virtual Machine (EVM) compatible L1 and the home of a vibrant #DeFi ecosystem that we will explore later in this thread
17/ thanks to the #EVM-compatibility developers can easily port their existing #Ethereum-based dApps (written in Solidity) to #FantomOpera mainnet without major changes to the code, while profiting from the high performance & low transaction costs
18/ if you need a refresher on the #EVM, check the thread below 👇
x.com/expctchaos/status/1569717621284806656
19/ 🖥️ Fantom Virtual Machine
but the EVM has certain limitations:
⚠️ Slow & sequential block processing
⚠️ EVM's storage design
20/ in the case of #Fantom for example, manipulation of #EVM state Merkle trie consumes ~84% of transaction processing time, while EVM instruction execution takes another ~13%
21/ additionally, with the #EVM, transactions have to be processed sequentially, as state changes require transaction reruns across all nodes, heavily limiting transactions per second and increasing time to finality
22/ a faster VM allows for faster processing & transaction verification and that's exactly what the #Fantom Virtual Machine (FVM) aims to achieve
23/ the #FVM offers a #Solidity-compatible, high-performance, scalable, and maintainable virtual machine, enabling users to interact with smart contracts in a familiar framework
24/ FVM Solutions:
✅ Efficient databases with a new data structure
✅ Adaptive smart contract execution
✅ Accelerated block processing via parallelism
✅ Performance engineering
25/ New Data Structure:
improved Data Structure #FVM replaces Merkle Patricia Trie (MPT) with a more efficient data structure for better data compression, storage cost reduction, and network speed enhancement
26/ Adaptive Smart Contract Execution:
#FVM optimizes processing time by merging certain smart contract instructions into single "super instructions" for enhanced efficiency and faster execution.
27/ Parallel Transaction Execution:
the FVM will support parallelized transactions execution within the same block (simultaneously executing transactions without storage access conflicts) to boost network throughput
28/ for a detailed roadmap for the FVM check the below thread
x.com/SimplifyDeFi/status/1630506926696984578
29/ 💾 Storage Upgrades
already last year, @FantomFDN released some impressive storage upgrades to #FantomOpera
30/
⬆️ Fantom's Snapsync upgrade significantly reduced storage load for nodes
⬆️ PebbleDB led to BIG decrease in memory consumption, allowing for vastly improved network performance
⬆️ Flat Storage enhances #Fantom nodes ability to read data for superior contract execution

5 more images on X