keppel / lotion

✨ Smooth, easy blockchain apps ✨
https://lotionjs.com
972 stars 133 forks source link

Variety of Consensus #103

Open shogochiai opened 6 years ago

shogochiai commented 6 years ago

Is lotion only uses PoA?

According to Consensus Compare: Casper vs. Tendermint, tendermint uses Slasher-applied-PoS.

Any way to use PoS on lotion.js?

ebuchman commented 5 years ago

Lotion uses Tendermint, a general purpose Byzantine Fault Tolerant consensus engine. It's much more correct, secure, and flexible than PoA.

You can build Proof of Stake as an economic layer in lotion by modifying the validator voting power based on some token stake. Eg:

// to modify voting power in a tx handler:
app.use(function(state, tx, context){
   context.validators[tx.somePubKey] += 42
})

// to modify voting power in endblock:
app.useBlock(function(state, context){
  context.validators['aOSx00CgYJ3/WGNgioJEs91irUHNvy+bV20hRTby7ak='] = 200
})