How to enable the "Report Misbehavior" plugin
The "Report Misbehavior" plugin provides automatic detection of delegate misbehavior and sends a reportDelegateMisbehavior transaction to the running node.
To enable the plugin on your node, perform the following actions:
1. Choose sender account
The plugin will use a specified sender account to sign the reportDelegateMisbehavior transactions.
To automatically sign the transaction, the encrypted passphrase of the account must be added to the plugin configuration.
| Please note that the respective account should have a high enough account balance to be able to send a misbehavior report transaction. |
Encrypt the passphrase of the sender account before adding it to the configuration:
$ lisk-core passphrase:encrypt
? Please enter passphrase: [hidden]
? Please re-enter passphrase: [hidden]
? Please enter password: [hidden]
? Please re-enter password: [hidden]
{"encryptedPassphrase":"iterations=1000000&cipherText=643bfbf1b6f1dc0ce740dd9fc9f27a682e476dc5de4e6c023deded4d3efe2822346226541106b42638db5ba46e0ae0a338cb78fb40bce67fdec7abbca68e20624fa6b0d7&iv=8a9c461744b9e70a8ba65edd&salt=3fe00b03d10b7002841857c1f028196e&tag=c57a798ef65f5a7be617d8737828fd58&version=1"}
2. Plugin configuration
Add the encrypted passphrase to the configuration under plugins.reportMisbehavior.encryptedPassphrase in the node configuration:
"plugins": {
"reportMisbehavior": {
"encryptedPassphrase": "iterations=1000000&cipherText=643bfbf1b6f1dc0ce740dd9fc9f27a682e476dc5de4e6c023deded4d3efe2822346226541106b42638db5ba46e0ae0a338cb78fb40bce67fdec7abbca68e20624fa6b0d7&iv=8a9c461744b9e70a8ba65edd&salt=3fe00b03d10b7002841857c1f028196e&tag=c57a798ef65f5a7be617d8737828fd58&version=1",
},
}
| See more available configuration options at the lisk-sdk::plugins/report-misbehavior-plugin.adoc reference. |
3. PM2 configuration
Add the environment variable LISK_ENABLE_REPORT_MISBEHAVIOR_PLUGIN to the pm2 config for Lisk Core:
{
"name": "lisk-core",
"script": "lisk-core start --overwrite-config",
"env": {
"LISK_NETWORK": "testnet",
"LISK_CONFIG_FILE": "/home/lisk/lisk-core/custom-config.json",
"LISK_ENABLE_REPORT_MISBEHAVIOR_PLUGIN": true
}
}
5. Authorization
The "Report Misbehavior" plugin provides a dedicated action to enable and disable the plugin on the node.
For example use the lisk-client package and write a small script which invokes the reportMisbehavior:authorize action on the node.
Install the lisk-client package:
npm i @liskhq/lisk-client
Write a small script to enable the plugin on the node:
const { apiClient } = require('@liskhq/lisk-client');
let clientCache;
const getClient = async () => {
if (!clientCache) {
clientCache = await apiClient.createWSClient('ws://localhost:8080/ws');
}
return clientCache;
};
getClient().then((client) => {
client.invoke("reportMisbehavior:authorize", {
password: "myPassword",
enable: true
}).then(res => {
console.log(res);
process.exit(0);
});
});
Execute the script:
$ node authorize-plugin.js
{ result: 'Successfully enabled the reporting of misbehavior.' }
That’s it! The "Report Misbehavior" plugin is now successfully enabled on the node.