Forger plugin

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

Alias

forger

Actions

Events

Registering the plugin

How to register the forger plugin with the blockchain application.

// Import the ForgerPlugin from the lisk-sdk package
const { Application, ForgerPlugin, genesisBlockDevnet, configDevnet } = require('lisk-sdk');

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

// Register the plugin with the application
app.registerPlugin(ForgerPlugin);

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

Default configuration

The forger plugin can be configured in the configuration of the blockchain application under plugins.forger.

The application will use the default values, in case no plugin configuration is provdided.
Forger options in the configuration
const { Application, ForgerPlugin, genesisBlockDevnet, configDevnet } = require('lisk-sdk');

configDevnet.plugins.forger = {};
// Configure where to store the plugin data.
// Default location is ~/.lisk/forger
configDevnet.plugins.forger.dataPath = '~/.lisk/forger'; (1)

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);
  });
1 dataPath: The data path for storing forging related information captured from application.

Actions

forger: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"
      }
    ]
}[]

forger: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

forger:block:created

Returns forging information about the latest forged block.

Message

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

forger: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.