Metahash Rewards
Metahash Rewards is a automated PHP script to pay bonus rewards to delegators from MetaHash nodes.
Requirements
- PHP 7.1+
- composer
- xboston/metahash-php 0.2.*
Installation
- Open your terminal and change the current working directory to the location where you want the cloned directory to be made.
$ cd path/to/your/folder/metahash-rewards/
- Clone repository by typing the following in your terminal:
$ git clone git@github.com:WPBC/metahash-rewards.git
- Run the following command in your terminal.
$ composer install
- Open the index.php and enter your node details in the $nodes array.
$nodes = [
'address' => '', // Node address. Example - 0x0....
'private_key' => '', // Node private Key. Example 3074020... or 3077020...
'data' => '', // Text data sent with transaction. Example - Reward from my SuperNode
'percentage' => 80, // Default percentage paid to delegators.
'superAddresses' => $superAddresses
];
- To skip payments on certain addresses, add the address to the $skipAddresses array.
$skipAddresses = [
'0x0072578dg76acc75554erg84es81seg4esg14se84841wfaw87',
'0x00256841dg47csca774de4gib6154see8451ff151841ddsd11'
];
- Add any addresses that get paid different percentages from default percentage to the $superAddresses array.
$superAddresses = [
'0x0072578dg76acc75554erg84es81seg4esg14se84841wfaw87' => 90, // 90%
'0x00256841dg47csca774de4gib6154see8451ff151841ddsd11' => 85, // 83%
];
- To automatically run the reward script. Firstly, run the following command in your terminal to open crontab.
$ crontab -e
- Set the PHP script to run at 0:02 am everyday by adding the following line to you crontab and pressing enter.
$ 2 0 * * * /usr/bin/php /metahash-rewards/example/index.php >> /metahash-rewards/example/log.log 2>&1
Debug Mode
Debug mode is initially enabled. Whilst in debug, the script will return an array of effective delegations, grouped by address. please note that payments will not be sent.
To disable debug mode, open index.php and set $node->debug to “false”.
$rewards->debug = true;
License
This package is released under the MIT license.