Development Update: May 2018


Heylo, community! This is the first in a series of monthly posts to update you on our work in the R&D and Dapp Development circles. This specific blog post is devoted to May 2018. Let's start!

Transaction and Proof Library

Kosta: First of all we have incepted a client library to work with the PARSEC network. Initially we have implemented primitives like transactions, blocks and periods. The Parsec library is used in all aspects of the implementation, being it contracts, node, CLI or frontend. The library was created in the scope of Bounty_007.

Plasma Node

Alex: Probably the main achievement of the month is the first version of our node, which can check transactions using LotionJS. The implementation was preceded by an evaluation of different implementation options:

  • Developing everything by ourselves - this would include components like p2p messaging, transaction storage, and more;
  • Forking the bcoin project. As Plasma exit proofs lend itself to UTXO-model blockchains like Bitcoin, we expected to be able to reuse big parts of the code base and put our Plasma code on top. Later we figured out that this is not the best option;
  • Our final choice fell on Tendermint. We chose it together with the Lotion library, which wraps it. In this case implementing the Plasma chain became much simpler, as almost everything is ready made. We adopted the selection of technologies provided by the Lotion examples and created a first stage realization including submission of block headers to the Plasma contract, among other things.

Proof Of Stake

Johann: This month we have extended our Plasma contract with PoS magic. One part of this magic are slot auctions. Slot auctions allow validators to purchase the rights to validate blocks and submit their results to earn rewards. Check the screenshot below for the final state machine that defines all transitions in the slot model!


We have also implemented a reflexive block reward function that is based on the percentage of total supply staked. This will ensure a healthy competition between the validators without ever binding all tokens into the staking contract. This way the token economy on chain will stay unaffected by validator staking. We have found a neat little formula that can be implemented in Solidity:


Where α is % of total supply staked, β is block reward, and ω represents total supply. The function looks like this:


EVM Computation Verification

On top of that we have started to collaborate with and to implement EVM fraud proof verification. These fraud proofs will allow to challenge invalid computation on the Plasma chain through the Plasma contracts. You can check out a first design document here. Stay tuned for bounties and code that will come out of this collaboration.

Gas Oracle

And finally, Alex Core made a gas oracle! Alex proposed two variants of the gas oracle.

  • Store gasPrice amount in block struct. The function getAverageGasPrice() calculates and returns the average gas price of 20 last blocks.
  • Store gasPrice in variable and modify it with every block submission. The pseudocode for this approach is as follows:

    avgGasPrice = avgGasPrice - avgGasPrice/15 + tx.gasprice/15

In first approach the transaction to query average gas price costs approximately 28864 gas. Every block submission costs 21500 gas more. In the second approach the getter is simply reading the storage, and every block submission costs approximately 6500 gas (21500 at first block). You can find more about it here. This feature was developed in the scope of Bounty_15.

These are all the updates for May 2018! If you are interested in our project and/or want to join our team - reach us in PARSEC Labs socials: