Lotion coins validator reward middleware

Usage no npm install needed!

<script type="module">
  import earn from 'https://cdn.skypack.dev/earn';



Middleware for paying rewards to validator nodes (used with lotion and coins).


npm install earn

let earn = require('earn')
let lotion = require('lotion')
let coins = require('coins')

let app = lotion({ ... })

  handlers: {
    earn({ perValidatorPerBlock: 100 })

Use by including as a handler inside your coins options. perValidatorPerBlock specifies the amount of coins each validator will earn per block.

The validators will all be paid equally each block, using their pubkey (both secp256k1 and ed25519 keys are supported). In the future, it can be possible to only pay validators who have a precommit signature in the block, but this is non-trivial since there might be some game theoretical attacks between validators (e.g. censoring others to prevent their rewards).