A revenue distribution tool for Waves nodes
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit May 3, 2017
README.md added mass transfer payments Apr 19, 2018
airdrop.js support for airdrops to Waves holders Aug 21, 2017
app.js fixed a minor bug in how the blocks are retrieved May 5, 2017
appFast.js removed sleep dependency Mar 12, 2018
appFastNG.js
checkPaymentsFile.js patched output Aug 21, 2017
massPayment.js added other assets for fees Jul 24, 2017
massPayment.py removed bug that empty transfers are made last Sep 15, 2018
package.json removed sleep dependency Mar 12, 2018

README.md

WavesLPoSDistributer

A revenue distribution tool for Waves nodes

Installation

First of all, you need to install Node.js (https://nodejs.org/en/) and NPM. Afterwards the installation of the dependencies could be done via:

mkdir node_modules
npm install

Once the dependencies are installed, the script that generates the payouts need to be configured. In order to do so, change the settings of the configuration section:

/*
    Put your settings here:
        - address: the address of your node that you want to distribute from
        - startBlockHeight: the block from which you want to start distribution for
        - endBlock: the block until you want to distribute the earnings
        - distributableMRTPerBlock: amount of MRT distributed per forged block
        - filename: file to which the payments for the mass payment tool are written
        - node: address of your node in the form http://<ip>:<port
        - percentageOfFeesToDistribute: the percentage of Waves fees that you want to distribute
 */
var config = {
    address: '',
    startBlockHeight: 462000,
    endBlock: 465000,
    distributableMrtPerBlock: 20,
    filename: 'test.json',
    node: 'http://<ip>:6869',
    percentageOfFeesToDistribute: 100
}

After a successful configuration of the tool, it could be started with:

node app.js

After the script is finished, the payments that should be distributed to the leasers are written to the file configured by the config.filename setting in the configuration section.

Doing the payments

For the actual payout, the masspayment tool needs to be run. Before it could be started, it also needs to be configured:

/*
 Put your settings here:
 - filename: file to which the payments for the mass payment tool are written
 - node: address of your node in the form http://<ip>:<port>
 - apiKey: the API key of the node that is used for distribution
 */
var config = {
    filename: 'test.json',
    node: 'http://<ip>:<port>',
    apiKey: 'put the apiKey for the node here'
},

After configuration, the script could be started with:

node massPayment.js

Why two seperate tools?

We decided to use two seperate tools since this allows for additional tests of the payments before the payments are actually executed. On the other hand, it does not provide any drawback since both scripts could also be called directly one after the other with:

node apps.js && node massPayment.js

We strongly recommend to check the payments file before the actual payments are done. In order to foster these checks, we added the checkPaymentsFile.js tool that could need to be configured as follows:

/**
 * Put your settings here:
 *     - filename: file to check for payments
 *     - node: address of your node in the form http://<ip>:<port
 */
var config = {
    filename: '',
    node: 'http://<ip>:<port>'
};

After the configuration the checking tool could be executed with:

node checkPaymentsFile.js

The output of the tool should provide an information about how man tokens of each asset will be paid by the payment script. After checking this information, you should be ready to execute the payments.

Airdrops

Payments for airdrops could be calculated by using the airdrop.js script. Configuration works pretty much the same way as for the other scripts:

/**
 * Put your settings here:
 *     - address: the address of your node that you want to distribute from
 *     - block: the block for which you want to calculate your richlist
 *     - total: amount of supply for the reference asset
 *     - amountToDistribute: amount of tokens that you want to distribute (have decimals in mind here...)
 *     - assetId: id of the reference asset
 *     - assetToDistributeId: id of the asset you want to airdrop
 *     - filename: name of the file the payments are written to
 *     - node: address of your node in the form http://<ip>:<port
 *     - excludeList: a list of addresses that should not receive the airdrop, e.g., exchanges...
 */
var config = {
    address: '',
    block: 500859,
    amountToDistribute: 35000000,
    assetId: '',
    assetToDistributeId: '',
    filename: '',
    node: '',
    excludeList: []
};

Afterwards, the script could be started with:

node airdrop.js

Mass transfer payouts

The generated payout files could now also be used as inputs for mass transfer transactions. this provides a faster and cheaper way to distribute funds.

python massPayment.py

Configuration is done via the configuration section:

'''
    Configuration section:
        privateKey: the private key of the address you want to distribute from
        file: the calculated payout file
        timeout: timeout between requests send to nodes in ms
        assetId: the id of the asset you want to distribute, '' for Waves
        nodes: a list of nodes to which the signed transactions should be send to, in the format: http://host:port
'''
config = {
	'privateKey': '',
	'file': '',
	# timeout between requests in ms
	'timeout': 20,
	'assetId': '',
	'nodes': [
	]
}

Disclaimer

Please always test your resulting payment scripts, e.g., with the checkPaymentsFile.js script!