Skip to content

LPOS Distributor Tutorial

goldenbear7 edited this page Oct 18, 2018 · 16 revisions

Turtle Network LPOS Distributor Install

Created by frigobar, modified by Sunchaser

  1. Install Node.js (https://nodejs.org/en/)
  2. Download the WavesLPoSDistributer (https://github.com/jansenmarc/WavesLPoSDistributer)
  3. Unzip the archive in the directory /home/(username) folder in your VPS
  4. cd /home/(username); mkdir node_modules
  5. cd node_modules
  6. npm install

Editing files

All you need to edit is the appFastNG.js and masspayment.js:

Editing appFastNG.js

Modify the configuration as follows:

The following configuration shows calculating payments from block 1 to block 47342. On the second payments, you would put 47342 as startBlockHeight and the max Block Height discovered at payment time for endBlock.

var config = {
address: 'Your node address',
alias: 'Your node alias',
startBlockHeight: 1,\ // put here the block height you want to start the payment calculation from endBlock: 47342, // put here the block height you want to calculate the payment distribution to
distributableWfnPerBlock: 0,
filename: 'payments.json', // put here the file name where the payments needs to be written
node: 'http://0.0.0.0/', // put here the address of REST API
percentageOfFeesToDistribute: 90, // put here the percentage of fees you want to distribute
blockStorage: 'blocks.json'
};

Changing Network from W to L. Change the following line (102):

if (transaction.type === 8 && (transaction.recipient === config.address || transaction.recipient === "address:" + config.address || transaction.recipient === 'alias:W:' + config.alias)) {

to

if (transaction.type === 8 && (transaction.recipient === config.address || transaction.recipient === "address:" + config.address || transaction.recipient === 'alias:L:' + config.alias)) {

Setting the correct Fee for token creation. Change the following line (111):

if (transaction.fee < 10 * Math.pow(10, 8)) {
wavesFees += transaction.fee;
}

to

if (transaction.fee < 1001 * Math.pow(10, 8)) {
wavesFees += transaction.fee;
}

Setting the correct block height when NG was approved. Change the following line (208):

if (block.height >= 805000) {
fee = block.wavesFees * 0.4 + block.previousBlockWavesFees * 0.6;
} else {
fee = block.wavesFees
}

to

if (block.height >= 8000 ) {
fee = block.wavesFees * 0.4 + block.previousBlockWavesFees * 0.6;
} else {
fee = block.wavesFees
}

Setting correct first block with Lease. Change the following line (131)

var firstBlockWithLeases = 462000;

with

var firstBlockWithLeases = 1;

Setting correct fee. Change the following lines(242):

if (payment > 0) {
transactions.push({
"amount": Number(Math.round(payments[address])),
"fee": 0,
"sender": config.address,
"attachment": "",
"recipient": address
}); ...

to

if (payment > 0) {
transactions.push({
"amount": Number(Math.round(payments[address])),
"fee": 2000000,
"sender": config.address,
"attachment": "",
"recipient": address
});
...

Editing masspayment.js

Change the configuration as follows:

var config = {
filename: 'payments.json', // put the file name where payments have been written.
node: 'http://0.0.0.0', // put the IP address of your REST API node
apiKey: '', // put your secret API Key
feeAssetId: null,
fee: 2000000 // put 2000000 (0.02 TN)
};

Edit checkPaymentsFile.js (44):

name: 'TN'

Send payments

node appFastNG.js

node checkPaymentsFile.js (will give a reference to Waves but ignore, we will change it later)

Note: Check if the total of $TN distributed make sense

node massPayment.js

Forked LPOSDISTRIBUTOR

https://github.com/BoxiGod/TurtleNetworkLPoSDistributer


Tutorial tentang distribusi LPOS

Created by frigobar, modified by Sunchaser

  1. Pasang Node.js (https://nodejs.org/en/)
  2. Unduh distribusi LPOS Waves (https://github.com/jansenmarc/WavesLPoSDistributer)
  3. Buka arsip direktori/home/(namauser) map di dalam VPS anda
  4. cd /home/(username); mkdir node_modules
  5. cd node_modules
  6. pasang npm

Mengedit arsip

Semua yang perlu di edit adalah appFastNG.js dan pembayaran massa.js:

Mengedit appFastNG.js

Modifikasi konfigurasi sebagai berikut:

Konfigurasi berikut ini menunjukkan kalkulasi pembayaran dari block 1 hingga block 47342 sebagai startBlockHeight dan BlockHeight maksimal menunjukkan waktu pembayaran untuk Block terakhir.

var config = {
address: 'Your node address',
alias: 'Your node alias',
startBlockHeight: 1,\ // Letakkan disini Block height yang anda ingin memulai pembayaran endBlock: 47342, // put here the block height you want to calculate the payment distribution to
distributableWfnPerBlock: 0,
filename: 'payments.json', // put here the file name where the payments needs to be written
node: 'http://0.0.0.0/', // put here the address of REST API
percentageOfFeesToDistribute: 90, // put here the percentage of fees you want to distribute
blockStorage: 'blocks.json'
};

Perubahan jaringan kerja dari W ke L. Merubah baris berikut (102):

if (transaction.type === 8 && (transaction.recipient === config.address || transaction.recipient === "address:" + config.address || transaction.recipient === 'alias:W:' + config.alias)) {

ke

if (transaction.type === 8 && (transaction.recipient === config.address || transaction.recipient === "address:" + config.address || transaction.recipient === 'alias:L:' + config.alias)) {

Mengeset biaya yang benar untuk menciptakan token. Ubah baris berikut (208):

if (transaction.fee < 10 * Math.pow(10, 8)) {
wavesFees += transaction.fee;
}

to

if (transaction.fee < 1001 * Math.pow(10, 8)) {
wavesFees += transaction.fee;
}

Setting the correct block height when NG was approved. Change the following line (208):

if (block.height >= 805000) {
fee = block.wavesFees * 0.4 + block.previousBlockWavesFees * 0.6;
} else {
fee = block.wavesFees
}

to

if (block.height >= 8000 ) {
fee = block.wavesFees * 0.4 + block.previousBlockWavesFees * 0.6;
} else {
fee = block.wavesFees
}

Mengeset dengan benar block pertama dengan Lease. Ubah baris berikut (131)

var firstBlockWithLeases = 462000;

dengan

var firstBlockWithLeases = 1;

Mengeset biaya yang benar. Ubah baris berikutnya (242:

if (payment > 0) {
transactions.push({
"amount": Number(Math.round(payments[address])),
"fee": 0,
"sender": config.address,
"attachment": "",
"recipient": address
}); ...

ke

if (payment > 0) {
transactions.push({
"amount": Number(Math.round(payments[address])),
"fee": 2000000,
"sender": config.address,
"attachment": "",
"recipient": address
});
...

Mengedit pembayaran massa.js

Ubah konfigurasi sebagai berikut :

var config = {
filename: 'payments.json', // put the file name where payments have been written.
node: 'http://0.0.0.0', // put the IP address of your REST API node
apiKey: '', // put your secret API Key
feeAssetId: null,
fee: 2000000 // put 2000000 (0.02 TN)
};

Mengedit pemeriksaan file pembayaran:

name: 'TN'

Mengirim pembayaran

node appFastNG.js

node checkPaymentsFile.js (will give a reference to Waves but ignore, we will change it later)

Note: Check if the total of $TN distributed make sense

node massPayment.js

Distribusi forked LPOS

https://github.com/BoxiGod/TurtleNetworkLPoSDistributer

You can’t perform that action at this time.