图解ETHPoS共识机制Gasper:合并后的以太坊是如何工作的?

区块律动Published on 2022-10-14Last updated on 2022-10-14

Abstract

众所周知, PoS 以太坊的共识协议是「Gasper」,它是在 LMD-GHOST( 分叉 选择规则)之上应用 Casper FFG(最终性确定工具)构建的。

众所周知, PoS 以太坊的共识协议是「Gasper」,它是在 LMD-GHOST( 分叉 选择规则)之上应用 Casper FFG(最终性确定工具)构建的。所以要想搞清楚完整的以太坊共识协议,就必须了解这两个部分(Casper + Ghost)。此外,这些设计真的很有趣。我打算梳理一下这两个协议的背景和演进,以及它们简单的工作流程。

PoS 共识算法的三大流派如下:

1.Nakamoto-inspired(Peercoin)

2.PBFT-inspired(Tendermint、Casper FFG)

3.CBC Casper

Nakamoto-inspired PoS 是一种基于链的算法,模拟在 PoW 中挖矿。它通过伪随机选择验证者来创建新区块。其在 2012 年的「Peercoin」论文中首次提出,peercoin 是基于权益证明共识的第一个加密货币。

PBFT-inspired(即 BFT-style)PoS 基于多年对拜占庭容错(尤其是 pBFT)的研究。在 2014 年的「Tendermint」论文中首次提出。一般来说,这些算法会选择一个代表账本规范交易的唯一链。

Casper 直接继承了 BFT 算法(更精确的是 pBFT),做了一些修改。CBC Casper 是由 @VladZamfir 提出的,有一些很好的资料可以更充分地解释它。

V 神的 CBC Casper 教程

VladZamfir 写的 CBC Casper 历史

CBC Casper 介绍视频

虽然以太坊最终选择了 Casper FFG 而不是 CBC Casper,但对 CBC Casper 的研究也很有价值,比如满足以太坊需求的分叉选择规则「LMD-GHOST」。Casper FFG 由 V 神和 Virgil Griffith在 2017 年提出,引入了 justification 和 finalization 的概念,并引入了 slashing conditions 和动态验证者机制,这些都是非常重要的特性。

Casper FFG 用于保证「最终性」(也就是安全性),这在 PoW 中是不存在的。简单来说,每个验证者都会对检查点进行投票,经过两轮投票后,检查点将被「最终确定」(第一轮为验证,第二轮为最终确定)。

所有最终确定的检查点都成为规范链(区块链历史的一部分),所有忠诚节点都同意他们永远不会逆转这条链。「最终检查点」之后的区块可以随意分叉,但之前的区块不允许分叉。

Casper FFG 除了通过「最终性」来保证区块链安全外,还引入了 slashing 条件来惩罚所有违反规则的验证者(这在传统 BFT 算法中是做不到的),所有违反规则的验证者都将被跟踪和惩罚。

除此之外,Casper FFG 是无需许可的(传统的 BFT 算法是需要许可认证的),pBFT 通过一个列表来维护共识,只有列表中的人才能成为参与者。Casper FFG 构建了动态验证者机制,所有验证者可以自由进出。Casper FFG 用于保证「最终性」和「安全性」,负责确认区块的最终状态,但不负责创建新区块,所以它需要底层区块链和分叉选择规则。

以太坊使用的分叉选择规则是基于 GHOST,该规则最早在2013 年的一篇论文中提出。2017 年,@VladZamfir 在 CBC Casper 工作时,他尝试将 GHOST 与 Casper 结合,产生了一个变种「LMD-GHOST」。

区块链允许分叉,当出现不同的分支时,应该选择哪条链继续添加后续新区块,需要分叉选择规则。PoW 使用的是最长链规则。思路是锻造最长的链需要最多的算力,所以这条链是最可信的。所以当所有矿工添加新区块时,他们会默认在最长的链上添加。

GHOST 的思路与此类似,其选择票数最多的链而不是高度最长的链,LMD-GHOST 做了一些修改,只考虑最近的投票(即所谓的「Least Message Driven」,LMD)。

LMD-GHOST 的规则很简单:

- 从创世区块开始;

- 每次有分叉,选择票数多的分支;

- 重复,直至找到 block leaf;

- 返回链的头部;

这是 Casper FFG 和 LMD-GHOST 的演变以及它们如何工作,它们共同保证「安全」+「活性」。LMD-GHOST 允许提议者随时创建新区块,新区块将按照分叉选择规则(即活跃度)添加到权重最大的链上。虽然 Casper FFG 将根据所有验证者的投票(两轮,超过 2/3,按存款)最终确定一个规范链。所有忠诚节点默认接受规范链,从而获得安全。

共识真的很有意思,以太坊对 PoS 的研究始于 2014 年,2022 年完成了合并。这是一条漫长而曲折的道路,过程中诞生了许多奇妙的想法、设计和工程。

Trending Cryptos

Related Reads

Michael Saylor, Founder of MicroStrategy, and CEO Phong Le Have Made Some Interesting Announcements! They Publicly Disclosed Their Bitcoin Price Forecast

During a Q&A session moderated by Natalie Brunell, Michael Saylor, founder of MicroStrategy, and CEO Phong Le discussed the company's strategy regarding its balance sheet, stock dynamics, and Bitcoin's role in the global financial ecosystem. Saylor described Bitcoin as the fundamental "capital asset" of the digital world, stating the company is building its future growth plans directly on this foundation. He argued that Bitcoin is not a traditional payment method or everyday currency, but digital capital, and that attracting capital from traditional finance is key to Bitcoin's growth. The company's digital credit instruments are designed to facilitate this capital inflow. CEO Phong Le addressed investor concerns about stock dilution and price volatility, asserting that capital raises and new instruments create shareholder value if they increase the amount of Bitcoin per share. He noted that a 50% drop in Bitcoin naturally leads to stock price fluctuations of up to 75%, emphasizing that MicroStrategy employs a long-term model of debt and equity financing, not short-term Bitcoin trading. The company also outlined its treasury management approach, stating it may dynamically buy BTC, repurchase credit instruments, or accumulate dollar reserves based on market conditions. Saylor reiterated his belief that Bitcoin could eventually reach $1 to $10 million as the company accumulates a larger share of its supply. He dismissed the idea of paying Bitcoin dividends as financially illogical, advocating instead for borrowing in low-cost, inflation-resistant fiat currencies (like dollars or yen) to invest in Bitcoin, which he views as the strongest appreciating asset. *This is not investment advice.

cryptonews.ru24m ago

Michael Saylor, Founder of MicroStrategy, and CEO Phong Le Have Made Some Interesting Announcements! They Publicly Disclosed Their Bitcoin Price Forecast

cryptonews.ru24m ago

Will This Trigger Panic in the $1.8 Trillion Bitcoin Market? A Prominent CEO Voices Opinion, Urges Preparation!

Amid Bitcoin's recent sideways trend, rising global bond yields are capturing crypto investors' attention. Sean Farrell, Fundstrat's Head of Digital Asset Strategy, notes Bitcoin's current volatility is historically low, suggesting sharper price swings could occur in the coming months. Historically, after similar low-volatility periods, Bitcoin's price has experienced median absolute moves of around 30% over 60-day periods. A key market concern is the rapid surge in global bond yields, with US Treasury yields reaching multi-decade highs. Farrell attributes this to factors like the growing US budget deficit, high AI infrastructure investment, elevated oil prices, and monetary policy uncertainty. This bond market turbulence has sparked discussions about a potential "panic" scenario affecting roughly $1.8 trillion in the global financial system, which could trigger significant volatility in high-risk assets like Bitcoin. Analysts note the focus is shifting beyond just Fed rate cuts to factors like long-term yields, energy prices, inflation risks, and the global risk premium for pricing assets like Bitcoin. While no true panic is currently observed, markets are watching bond investors closely. Koinly CEO Robin Singh warns not to ignore the possibility of another sharp Bitcoin drop in coming months, suggesting it could fall to around $50,000 in a negative scenario. He indicates that if historical cycles repeat, investors may need to endure a final wave of panic selling before Bitcoin potentially bottoms in the current cycle.

cryptonews.ru1h ago

Will This Trigger Panic in the $1.8 Trillion Bitcoin Market? A Prominent CEO Voices Opinion, Urges Preparation!

cryptonews.ru1h ago

Trading

Spot

Hot Articles

How to Buy CSPR

Welcome to HTX.com! We've made purchasing Casper (CSPR) simple and convenient. Follow our step-by-step guide to embark on your crypto journey.Step 1: Create Your HTX AccountUse your email or phone number to sign up for a free account on HTX. Experience a hassle-free registration journey and unlock all features.Get My AccountStep 2: Go to Buy Crypto and Choose Your Payment MethodCredit/Debit Card: Use your Visa or Mastercard to buy Casper (CSPR) instantly.Balance: Use funds from your HTX account balance to trade seamlessly.Third Parties: We've added popular payment methods such as Google Pay and Apple Pay to enhance convenience.P2P: Trade directly with other users on HTX.Over-the-Counter (OTC): We offer tailor-made services and competitive exchange rates for traders.Step 3: Store Your Casper (CSPR)After purchasing your Casper (CSPR), store it in your HTX account. Alternatively, you can send it elsewhere via blockchain transfer or use it to trade other cryptocurrencies.Step 4: Trade Casper (CSPR)Easily trade Casper (CSPR) on HTX's spot market. Simply access your account, select your trading pair, execute your trades, and monitor in real-time. We offer a user-friendly experience for both beginners and seasoned traders.

2.1k Total ViewsPublished 2024.03.29Updated 2026.06.02

How to Buy CSPR

What is CASPER

Vitalik's Casper: A Comprehensive Overview Introduction In the ever-evolving landscape of blockchain technology, consensus protocols play a crucial role in maintaining the integrity and security of decentralized networks. Vitalik's Casper, a pioneering proof-of-stake (PoS) consensus mechanism, is specifically designed for the Ethereum network. This innovative project represents a monumental shift from Ethereum's current proof-of-work (PoW) approach to a more energy-efficient and scalable model. As the crypto industry continues to grow, understanding the nuances and implications of Casper becomes increasingly vital for stakeholders, developers, and enthusiasts alike. What is Vitalik's Casper? Vitalik's Casper serves as a transformative variant of traditional PoS protocols. The primary objective of this project is to enhance the network's overall security and scalability while addressing inherent limitations commonly found in earlier PoS systems. At its core, Casper leverages a security deposit system that requires validators—participants responsible for confirming transactions and creating new blocks—to stake a certain amount of cryptocurrency. This deposit not only incentivizes good behavior but also establishes a penalty mechanism for validators exhibiting malicious conduct. In essence, Casper seeks to provide a reliable framework that fortifies the Ethereum ecosystem against potential threats and attacks while supporting the growing demand for network efficiency and scalability. Who is the Creator of Vitalik's Casper? Vitalik Buterin, a visionary in the world of blockchain, is credited as the creator of Vitalik's Casper. Buterin co-founded Ethereum in 2015 and has continuously driven the project’s development and evolution. His commitment to enhancing the Ethereum ecosystem and addressing its challenges culminated in the introduction of Casper, which aims to revolutionize the consensus mechanism in blockchain technology. Who Are the Investors of Vitalik's Casper? While specific information on individual investors backing Vitalik's Casper is not publicly available, the project is comprehensively supported by the Ethereum Foundation and the broader Ethereum community. The foundation plays a pivotal role in funding and advancing projects that improve Ethereum, and its backing of Casper highlights the importance of this protocol in the future of the network. Furthermore, various developers and stakeholders within the Ethereum ecosystem actively contribute to and advocate for the continued growth and implementation of Casper. How Does Vitalik's Casper Work? Vitalik's Casper operates through a sophisticated mechanism designed to facilitate smoother and more secure consensus within the Ethereum network. Key features that distinguish Casper from traditional consensus protocols include: Security Deposit System One of the hallmark features of Casper is its security deposit requirement for validators. To participate in the consensus process, validators must stake a certain amount of cryptocurrency, thereby ensuring their financial commitment to the network. This system deters malicious behavior, as any validator caught acting dishonestly risks losing their staked assets. Voting System Casper incorporates a voting mechanism where validators collaborate to finalize blocks on the blockchain. Each validator proposes and votes on blocks, contributing to the overall decision-making process. This democratic element fosters a decentralized approach to consensus, enhancing security and network stability. Penalty System The protocol's penalty system serves as a crucial deterrent against unethical validator behavior. Should a validator act maliciously or fail to participate in the consensus process adequately, they can be penalized by losing a portion—or in some cases, all—of their staked assets. This punitive measure reinforces the accountability of validators and upholds the integrity of the network. Hybrid Consensus By employing a hybrid consensus model, Casper smartly combines elements from both PoW and PoS mechanisms. This unique structure promotes a gradual transition from Ethereum's existing PoW model to a fully-fledged PoS system, allowing the network to evolve without compromising security during the changeover. Timeline of Vitalik's Casper The journey of Vitalik's Casper has been marked by significant milestones critical to its evolution. Here’s a brief timeline highlighting key events in its history: 2017: The conceptual framework of Casper was first articulated by Vitalik Buterin as a potential solution to Ethereum's scalability challenges. 2018: The first iteration of Casper was released on GitHub, marking the initial steps toward transitioning Ethereum to a PoS model. 2020: The launch of the Beacon Chain, a foundational blockchain for the Ethereum 2.0 ecosystem, occurred. This footstep marked the commencement of a multi-phased transition to the Casper protocol. Ongoing: The transition to Casper remains a continuous effort, with a series of phases developed to ensure the effective implementation of the new consensus mechanism. Key Features of Vitalik's Casper Vitalik's Casper boasts several distinguishing features that contribute to its viability and innovation within the blockchain landscape, including: Security Deposit System: Validators must stake a deposit, enhancing their commitment to network integrity. Voting System: A collaborative approach to block finalization promotes decentralized decision-making. Penalty System: Deters malicious activities through financial penalties, ensuring network stability and security. Hybrid Consensus: The blend of PoW and PoS elements facilitates a slower transition to PoS without abrupt disruptions to the network. Conclusion Vitalik's Casper represents a significant advancement in Ethereum's ongoing evolution. By introducing a secure and scalable consensus mechanism, Casper aims to address the inherent limitations of traditional PoS systems and enhance the overall functionality of the Ethereum network. The project’s emphasis on security, accountability, and innovation positions it as a critical component of Ethereum's future. Understanding Vitalik's Casper is essential not only for developers and investors within the crypto space but also for those interested in the broader implications of blockchain technology. As the Ethereum ecosystem continues its transformative journey towards scalability and efficiency, Casper stands at the forefront of this revolution, promising to reshape the landscape of decentralized consensus in the years to come.

1.3k Total ViewsPublished 2024.08.25Updated 2024.12.03

What is CASPER

Discussions

Welcome to the HTX Community. Here, you can stay informed about the latest platform developments and gain access to professional market insights. Users' opinions on the price of CSPR (CSPR) are presented below.

活动图片