Requirements

  • PHP 7.2
  • Composer
  • SQLite
  • OpenSSL

Installation

1. Clone the project

git clone https://github.com/faustbrian/ploutos
cd ~/ploutos

2. Install Dependencies

composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader

3. Generate Application Key

php artisan key:generate

This key is later used to encrypt and decrypt your passphrases.

4. Configure Environment

There's an example .env file that you can use to configure the application. For it to work, simply copy it as follows:

cp .env.example .env

Here you can set the environment variables to your liking. For a full overview, please take a look at the Env Variables section further down below.

Not all of the variables will be necessary to set. However, you will need to fill in the passphrase and second passphrase fields, which require an encrypted value. You can encrypt your passphrases by executing php artisan tinker and then encrypt('your-passphrase');, repeat the same for your second passphrase.

The strings that result out of those actions should be placed in the env variables ARK_DELEGATE_PASSPHRASE and ARK_DELEGATE_SECOND_PASSPHRASE.

5. Fetch Data

You'll need to run a couple of commands to get the required data for the payout script to work:

Migrate Database

php artisan migrate:fresh

Poll Voters

php artisan ark:poll:voters

Poll Transactions

php artisan ark:poll:transactions

Migrate Blocks

php artisan ark:migrate:blocks LAST_PAYOUT_HEIGHT

In case you want to quickly setup the script and don't need any historical data, you can also run with the --skip option that skips any blocks that are older than your specified LAST_PAYOUT_HEIGHT:

php artisan ark:migrate:blocks LAST_PAYOUT_HEIGHT --skip

6. Setup Cronjob

You can setup a cronjob to let the payout script run its commands on a timely basis. You can find the commands, and how often they are executed, in the app/Console/Kernel.php file.

Open Crontab

crontab -e

Copy & Paste

* * * * * cd ~/ploutos && php artisan schedule:run >> /dev/null 2>&1

7. Switch to Production

Make the following changes to your .env file to make the script run in production mode:

APP_ENV=production
APP_DEBUG=false

Error Tracking

This package is ready to be used with Sentry. You'll only have to add the following to the .env file:

SENTRY_LARAVEL_DSN=https://your-sentry-dsn-url/

Env Variables

An overview of ARK_DELEGATE_* environment variables can be found in the config/delegates.php file, where their use is thoroughly documented.

Available Commands

CommandDescription
ark:broadcast {number=100}Broadcast the last number of transactions
ark:calculateCalculate voter rewards for any unprocessed blocks
ark:disburse:developerDisburse the delegate balance based on the values specified in the .env file
ark:disburse:votersDisburse the balances to the various voters
ark:distribute:amount {amount}Distributes an amount of ARK over the delegate's voters, based on their voting weight. This gets added to their current balance
ark:distribute:bannedDistributes the ARK balances of banned wallets over the delegate's voters, based on their voting weight
ark:earningsShows an overview of the current balances for each of the voters (and the delegate's cut)
ark:earnings:delegate:clearResets the delegate's unpaid balance to 0
ark:estimateShow an overview of the estimated daily earnings for each of the voters
ark:maintain:votersBans or unbans wallets of voters
ark:migrate:blocks {height=0} {--skip}Migrates blocks to the database for further use. If height is given it will gives blocks older than height the status processed. The --skip option can be used to skip any blocks older than height
ark:pingPings the host set in the .env
ark:poll:blocks {pages=1}Retrieves the last x pages of blocks
ark:poll:transactions {pages=5}Retrieves the last x pages of transactions
ark:poll:votersRetrieves the current voters of the delegate

Development

Depending on what environment you are, you will have several options for development.

TIP

We do not provide any support for windows development environments. You will need to figure that out yourself.