October 6, 2017

Everything Else

Before we dive headfirst into the Proof-of-Stake consensus algorithm, I want to make something crystal clear: Plasma chains do *not *have to use POS & POS is *not *the single solution to scaling. Plasma chains of varying sizes reserve the right to implement whichever consensus algorithm is decided upon by those present for the Plasma origin block. However, switching from POW to POS has largely been under public view & debate, therefore I decided to expand on POS at length.

Within the package of smart contracts in a Plasma chain we find the Proof-of-Stake mechanism contract. When launching any new Plasma chain, ** the stake amount is an agreed-upon minority percentage of the new total tokens in supply**, set by everyone present for the origin block. All stakers are users but not all users are stakers (minus those present for the Plasma origin block). Stakers participate in the verification mechanism in two key ways:

- They contribute a % stake of tokens to the total stake amount (say 4%)
- They propagate the same number of blocks (4) at a later point in time

A super-important fact here is that in this particular POS proposal, the stake amount is consistently updated & merkelized in strictly *only the last 100 blocks published to the Plasma chain.*

Simple, because of **ROI. **A key word to remember here is the proof-of-stake ** bonds. **Users within a Plasma chain that wish to see a small return on extra tokens they have lying around can essentially buy a bond — loaning out a % of the total stake amount (by rule this has to be less than 5% but we’ll break that for our example) & therefore volunteering to publishing that exact same % of blocks at some later point in time.

In our example, our group of five friends, Alice, Bob, Christian, Dan, & Evan start their own tokenized Plasma chain that uses its own cryptocurrency named TTT. They build a TicTacToe game with a limited gambling mechanism — each player bets strictly *two *TTT coins in an all-or-nothing scenario. In addition, it also costs both players an additional *single* TTT coin to execute their TicTacToe smart contract. Every time a game is played, or a TicTacToe smart contract is ran, one new Plasma block is added to the Plasma chain. They use Ethereum as their root blockchain & write-in a transfer rate of 1 TTT = 1 Ether in the origin block.

Before publishing their initial Plasma chain, they decide on the stake amount that’ll remain merkelized in the last 100 published blocks. They opt to go with a **stake total of 100 TTT coins**. This means at the beginning they’ll each *stake *20 TTT coins: they’re each 20% staked, & therefore are now responsible for propagating & broadcasting 20 of the next 100 next blocks in the Plasma chain.

In addition to the stake, **they decide to start their TTT Plasma chain with 1000 TTT coins in order to each play a few hundred games. **This brings the following TTT coin total without a single round of play to the following: 5 people * (1000 starting TTT coins + 20 staked TTT coins) = **5100 TTT coins.** Out of these initial 5100 TTT coins, 100 TTT coins, or **1.96%**(100/5100) of the total supply is the current stake size.

The five friends officially kick off their Plasma chain with the origin block (block #0) running a smart contract that contains a TicTacToe game between Dan & Evan.

They both pay the transaction fee of one TTT coin & put up two more TTT coins in an all-or-nothing game. Dan wins the TicTacToe game. Alice, the first of the five friends staked, starts verifying her required 20 blocks. She verifies the outcome of this game, publishes block #0 on the TTT Plasma chain, & broadcasts the new block to the rest of the network. To the five friends, the origin block looks something like the image to the left.

Assuming stake bonds are realized after every block published (probably not going to be the case) & fraud proofs aren’t submitted, the current economic activity of our TTT Plasma chain is now as follows:

Out of the 100 TTT coins originally staked, one has now been returned (Alice’s). She received back 1 of her 20 coins staked in the origin block with additional interest (fee charged to Dan + Evan). As you’ve probably guessed this means our original amount staked is now at 99 TTT. At this point in time any of the five friends can opt to, but are not immediately required to, stake a single TTT & volunteer to propagate future block#100. Let’s go another simple round (block #2) now between Alice & Evan. In this match, Evan wins. Once Alice verifies this & propagates block #2, the TTT economic landscape will look as such:

Alice has now verified & broadcasted block#2. Let’s assume that the next 18 blocks (blocks #2 — #19) on the TTT chain consist only of repeat games between Alice & Evan, where Alice has *lost* every game. For our chain’s credibility, let’s also assume that Christian has filled every open stake that Alice has left behind. After propagating her twentieth & final block (Block #19) & assuming no foul play we’d see the following:

Let’s list the ways she could display bad behavior but first, a quick review on stake constraints, time limits, & fraud proofs.

Again, we’re working with a dead simple example where we skipped over multiple details for simplicity. One of them is the maximum amount of stake any actor is allowed to hold. In the whitepaper, Vitalik & Poon claim:

*The minimum amount per staker is one percent of all tokens, with a maximum cap of five percent.*

Both Plasma chains & the resulting children proof-of-stake contracts have pre-defined time constraints.* *The *Plasma chain time limit* is a settlement delay that’s applied to every new verified block prior to updating the *root chain (Ethereum).* This time delay allows for anyone *within* the Plasma chain or its children time to submit a *fraud proof to the parent Plasma chain or the root chain *(previously covered in part I).

Proof-of-Stake contracts *also *have a time limit, however, they represent a very different thing. For POS contracts, time limits act as a date of maturity for a loan or bond — it’s the day & time that stake plus interest is returned. Additionally, it’s also the deadline for broadcasting the newest block propagated by that same staker.

If by the date of maturity of her stake, Alice failed to propagate & broadcast the newest block, she can fully expect that her stake will be returned but her interest reward will carry over to the next block. Since these deadlines are represented in every block on the Plasma chain, the next staker in line becomes aware of the delay & volunteers to propagate the block for additional reward.

This is where tying the number of POS bonds a staker holds to the exact amount of blocks he/she is responsible for propagating at a future time really clicks. If Alice has 4% stake, she is responsible for propagating exactly 4 blocks 96 blocks after the latest block committed. Meaning that if Alice publishes a single block less (such as an empty block), or a single block more, for that matter, than what is expected from her staker peers, she will eventually be flagged as a fraudulent actor through a fraud proof & won’t receive her interest.

And here’s where our handy-dandy fraud proofs come into play: our TicTacToe parent Plasma chain has a delay period in which any one of the other five friends can challenge what Alice submitted. So if Alice propagates a counterfeit block that falsely claims that *she *& not Evan won the last game, it’s on Evan or the rest of the crew to submit a fraud proof to the root blockchain (Ethereum). When this fraud proof is submitted & acknowledged in the Ethereum blockchain, a git-revert of sorts occurs within the Plasma TicTacToe chain & Alice is penalized for being a fraudulent actor. In this & the previous case Alice loses not only her interest, but her original stake as well.

Now that we’ve shown that Alice is reasonably financially incentivized to act truthfully, let’s move on to a slightly tricker scenario where multiple bad actors coordinate.

Let’s say that Alice coordinates an attack with next-in-line staker Bob. Alice gives Bob a heads up that she’ll soon commit a counterfeit block#19. If Bob promises to immediately propagate another false block (block#19) on top of that falsified block, she’ll reward him at a later point in time.

The enforcement mechanism here is simple as it’s something we’re now familiar with: fraud proof submissions. While Bob’s false block is now stacked on top of Alice’s false block, there’s no guarantee that the root blockchain has realized Alice’s false block let alone Bob’s. Again, the rest of the three friends find themselves with planned time delays. Only Christian, or Dan, or Evan has to submit a fraud proof to the root blockchain to begin the process of reverting. Here’s where multiple bad actors get really interesting & where the flexibility of a tree structure truly shines.

One solution for counterfeit blocks in Plasma is to construct a system whereby one can do mass exits in the event of chain halt at minimal cost of time or money. This mass exit, or mass withdrawal to a new sister Plasma chain within the same Plasma contract, is key to incentivizing good behavior.

We construct a system of higher and lower courts where particular venues can exist to prove state. One can view the root blockchain as the Supreme Court from which the power of all subordinate courts derive their power. It is the law of the root blockchain which allows for all lower courts to derive their judicial power. So if a fraud proof is submitted to the root chain claiming that the last two blocks committed to the child Plasma chain (our TicTacToe chain) are fraudulent, instead of reverting two blocks back, the Plasma chain automatically creates a new, pristine sister chain where all the good actors & funds are transferred towards.

In our case, shortly after one of the three truthful friends submits a fraud proof, our original TTT Plasma chain halts. At the exact same time a sister Plasma chain is created where Christian, Dan & Evan, their respective funds & the stake total are immediately mass-withdrawn & transferred over, reverting back to the same economic values prior to the two corrupt blocks.

It’s not explicitly written what would happen with Alice & Bob’s funds on the original Plasma chain. My best guess is it’s either forfeited over to the sister chain or forever locked in that halted chain.

We’ve now covered four different ways that Alice could try to cheat the TTT Plasma chain. In every case the inherent Plasma tree structure, fraud proof mechanism & last 100 block Proof-of-State bonds proved capable of thwarting Alice’s cheats.

As far as lowering computation costs to net settle off-root chains in order to scale to useable decentralized apps goes, the Proof-of-Stake bond proposal does not disappoint. It’s also, again at a theoretical level, economically sound. In a community of strangers that interact with a POS mechanism, it’s mainly a matter of self-governing by putting the responsible on the community to reach out to a parent Plasma chain or root chain if they think fraud has occurred.

With merkelized commitments only broadcasted periodically to the root blockchain, Ethereum can finally now allow for incredibly scalable, low cost transactions and computation.

**Far From Finished — Further From Implemented**

It’s worth stressing that we covered an insanely simple example of what a Proof-of-Stake model could look like with a glaring overlook: we never introduced new actors. What happens when two completely new people enter the TTT Plasma chain? Does it make sense to increase the total stake (100 TTTs)? By how much? Why? Etc…The white paper does not mention how introducing new actors changes the *original stake contract* over time. This, to me, is likely the largest indicator of just how far this model is from being implemented.

Still this is a phenomenal leap & I look forward to witnessing the Ethereum team answer the pending questions; however, Vitalik is right, this is probably far from the optimal solution. But I am excited to see how this evolves into that.

Part III: Plasma Key Innovations — Fraud Proofs & MapReduce https://medium.com/@jesus_notchrist/advanced-cryptocurrency-topics-plasma-key-innovations-fb82d6176529