Forger plugin

@liskhq/lisk-framework-forger-plugin is a plugin for the Lisk Framework that monitors configured delegates forging activity and voters information.

Name Property

Alias

forger

Actions

getVoters, getForgingInfo

Events

block:created, block:missed

Default configuration

Forger options in the configuration
{
  //[...]
  plugins: {
    forger: {
      dataPath: '~/.lisk/forger' (1)
    }
  }
}
1 dataPath: The data path for storing forging related information captured from application.

Registering the plugin

const { Application, ForgerPlugin, genesisBlockDevnet, configDevnet } = require('lisk-sdk');

const app = Application.defaultApplication(genesisBlockDevnet, configDevnet);

app.registerPlugin(ForgerPlugin);

app
  .run()
  .then(() => app.logger.info('App started...'))
  .catch(error => {
    console.error('Faced error in application', error);
    process.exit(1);
  });

Actions

getVoters

Returns the calculated voters for all forgers registered in the network.

Input

none

Returns

{
    "address": "a6f6a0543ae470c6b056021cb2ac153368eafeec",
    "username": "genesis_2",
    "totalVotesReceived": "1002000000000",
    "voters": [
      {
        "address": "a28d5e34007fd8fe6d7903044eb23a60fdad3c00",
        "amount": "2000000000"
      }
    ]
}[]

getForgingInfo

Return the status of all forgers registered in the network.

Input

none

Returns

{
  "address": "a28d5e34007fd8fe6d7903044eb23a60fdad3c00",
  "forging": true,
  "username": "genesis_1",
  "totalReceivedFees": "0",
  "totalReceivedRewards": "0",
  "totalProducedBlocks": 4,
  "totalVotesReceived": "1000000000000",
  "consecutiveMissedBlocks": 176
}[]

Events

block:created

Returns forging information about the latest forged block.

Message

{
    reward,
    forgerAddress,
    height,
    timestamp: Date.now(),
}

block:missed

Returns an object with information about how many blocks have been missed by any delegate until the current height of the blockchain.

Message

{
    {
      address: missedBlocks, (1)
      address2: missedBlocks,
      // ...
    }
    height, (2)
    timestamp: date, (3)
}
1 Number of missed blocks by delegate address.
2 Current height of the blockchain.
3 Current time.