Ethereum Proof-Of-Stake: Vitalik Buterin Shares Casper Contract Code

in ethereum •  2 years ago 

Vitalik Buterin took to reddit to share “a (not so sneak) peek at the current version of the Casper contract” and offered a few answers to Proof-of-Stake questions.

One of the most anticipated events in the Ethereum ecosystem is the switch from Proof-of-Work to Proof-of-Stake. Both of these systems are used to achieve consensus and maintain the security of a blockchain-based network.

Proof-of-Work uses mining, requiring vast amounts of computing effort and electrical power. Proof-of-Stake is meant to move away from a system that demands such a high expenditure of resources (like heat and power consumption) and instead secure consensus through network participants putting up a “stake” of their virtual currency in return for proportional (to the amount staked vs. all coins available across the network) rewards for their “virtual mining.” No PoW-style mining actually takes place in PoS; the deposit is more about incentivizing honest actions. A validator’s deposit is burned (automatically forfeited and destroyed) if they make a malicious move, as defined by the minimal slashing conditions.

The changeover will be implemented in sequential steps, transitioning the system to a hybrid of PoW/PoS system before going full PoS. Writing the code for the Casper contract is a part of the first stage of the multistage roadmap to PoS. According to Buterin’s recent presentation at the Taipei Ethereum Meetup, stage one is “over three-quarters complete.”

In a highly transparent move, Buterin shared the code that would implement the hybrid system for his Casper contract. While Casper is the protocol set to govern Ethereum’s PoS system, it will be implemented as a contract in Ethereum in order to lessen the chance for consensus issues among clients. If Casper were implemented client-side, it’d be harder to guarantee everyone is using the same slashing conditions, which is important because those are the economic penalties for gaming the system. Without assured client consensus on those penalties, there’s potential for malicious actions. Also, in contract form, Casper can be easily upgraded by swapping out the contract’s address with that of a more updated version in any future hardforks.

While Buterin was ready to share the code for the Casper contract, it’s still only about three-quarters complete. The incomplete quarter of the code is described by Vitalik on reddit:

“Remaining to be implemented:

  • A sequence number mechanism on messages (needed to fully verify slashing conditions)

  • Switching from checking ECDSA signatures to checking arbitrary validation code

Aside from that, it's quite close to being done. Also, note that the Casper contract is only one of three parts, the other two being the validator daemon logic and the fork choice rule. Those are both in progress too, but not quite as advanced as the contract.”
So once the contract code is complete, only the daemon and fork choice rule remain. The validator daemon would be a program that runs off-chain (not on the blockchain, but on a user’s machine) that interacts with the Casper contract so a node knows when to send the proper messages (see here for more on prepare/commit messages) to validate a block.

The fork choice rule will be a piece of code that every node is running in order to determine what exact conditions the canonical (longest) chain will be made under. This is to ensure that a node bets on the winning chain. If a node bets on a false (malicious) chain, that node (validator) loses its deposit. This is a very important aspect of securing a blockchain network, as it is where consensus is determined regarding which blockchain is the canonical chain.

The question likely on everyone’s mind: how much ETH do I have to stake to offset the gas costs (transaction fees) of sending prepare/commit messages and make a profit? Buterin spoke about the minimum size of validator deposits, saying:

“This is a tricky issue. Here there is an implied minimum because you have to pay gas to prepare/commit, and so altogether it's not profitable unless you deposit at least 1000-4000 ETH. One possibility that we're thinking about is in later stages hardforking in a discount specifically for execution associated with this contract, but that's still nowhere near finalized.”
That’s a lot of money. Much like with PoW mining, unless you’re wealthy, you’ll likely have to join a PoS virtual mining pool to see any rewards. Proof-of-Stake should eventually be able to support validator pools.

Another beneficial feature of Casper is the ability to send in a deposit from a contract, instead of just your wallet address. A person could withdraw their validator rewards to a contract that only releases the funds back to them if some other set of conditions is met. That would allow a person to “dual-use [their] Casper deposit as a security deposit in some other application.” So, even though a validator would need to lock away a fair amount of money, they could use it for collateral, while it’s still virtually mining and getting block rewards.


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!