ARK True Block Weight Delegate Server

Travis Mathis
arkoar.group
Published in
5 min readApr 12, 2018
Development funded by https://arkcommunity.fund

Purpose

ARK True Block Weight Delegate Server is a community funded project for
managing voter reward disbursements using a true block weight algorithm.

Our focus is on making the delegate true block reward process as fast, accurate, secure, and easy as possible.

About

ARK Tbws can be compiled on any OS and run locally. We have an official Ubuntu 16.04 installation at this time. If you need help getting it to run on your operating system reach out to the arkoar.group delegate team on the official ARK Slack.

Features

  • Hopper resistant
  • Accurate to the Arktoshi
  • Rewards calculated by the weight of a voters wallet at the time the block was forged
  • Rolling balances
  • Adjustable payment threshold
  • Adjustable share percentage
  • Automated payments
  • Audit logs
  • Disbursement history
  • Outstanding balances
  • Voter List

Installation on Ubuntu 16.04

Cut & paste the command below into your terminal and run it, this will install everything you need including ARK Tbws.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/arkoar-group/ark_tbw_delegate_server/11f1a69ff98f32a11544188609adea7a62281b14/bin/install.sh)" && source ~/.bashrc

After that you can test to make sure everything was installed correctly by running the following:

atbw --help

Configuration

It’s important to note that if you are an existing delegate already using another reward mechanism, you should zero out your balances before using this app. When you do, log the block height of the final block you are paying out. You will need this during configuration.

You will need the following items to initially configure ARK Tbws:

  • Your delegate address
  • The last block height you paid out or 0 if you are a new delegate
  • A URL for your ARK Node(This should be YOUR node)
  • Your delegate private key
make sure you follow the configuration and enter as shown

If want to make changes to your config, you can do so through the command line option. Get a full list by running atbw --help

If you’re a non-technical user we recommend creating an Ubuntu 16.04 Virtual Box and using the automatic installer above.

How to use on other Operating Systems

We will be providing automatic installers for other operating systems as we did for Ubuntu. If you would like to support development for your OS submit a PR or speak with the ARK Community Fund about funding feature development.

We recommend you use a program like asdf to manage Erlang installations. Instructions for installing asdf can be found here https://github.com/asdf-vm/asdf#setup

Run the following commands:

asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf install erlang 20.3

Alternatively you can download Erlang here http://www.erlang.org/downloads

Then follow their build instructions for building and installing Erlang from source on your specified OS;

https://github.com/erlang/otp/blob/maint/HOWTO/INSTALL.md

Download the ARK Tbws binary

wget https://github.com/arkoar-group/ark_tbw_delegate_server/blob/master/releases/atbw-1.0.0?raw=true && mv atbw-1.0.0?raw=true atbw

Run on MacOS or Linux

chmod +x atbw
./atbw

Run on Windows

This is completely untested at this time but should work in theory. If you have any issues please reach out to either outboard or arkoar on the official ARK Slack and work with us so we can get this working for all delegates! If you have issues try compiling it from source as shown below then running it with the escript command.

escript atbw

Alternative Option: Compile from source

git clone git@github.com:arkoar-group/ark_tbw_delegate_server.git cd ark_tbw_delegate_server/mix deps.getmix deps.compilemix escript.buildchmod +x ark_tbw_delegate_server./ark_tbw_delegate_server(MacOS / Linix)
escript ark_tbw_delegate_server(Windows)

Now that you’ve installed…

The first time you run the application it will take awhile to build your delegate profile. It is downloading your forged block data, and building a ledger for each of your voters. If you have a large voter base and a long block history this could take upwards of 30 minutes.

Don’t worry you won’t have to go through this every time you do a payment run. We cache this data and all subsequent runs will be extremely fast since we only need to gather new data that has been created since your last run.

There are 4 main features that can be accessed from the main menu.

Main Menu

Option #1 allows you to calculate and disburse the rewards. As mentioned above, the first time you run this part of the script it can take quite a while to import and cache all of the forged blocks and transaction history for your voters. We’ve been forging for about a month and the first import takes 3–4 minutes. Please also note that we have an intentional delay of 5 seconds between each disbursement in order to be friendly to the ARK network as a whole.

Disbursement in progress

Options #2 scans your delegate transactions and displays previous disbursements by matching the smartbridge field against the following regex: /payout to height (\d+)/. You can also use this data in your delegate site by searching the vendorField in the blockchain transaction data.

Partial disbursement history

Option #3 shows the balances due to each of your voters.

Balances due / banked

Last but not least, option 4 prints a list of all of your voters and their current balances.

Voter list

If something seems weird or goes wrong, you can clear your config and cache with option 0. This is a last resort, though, so please come and ask @arkoar or @outboard for help in the ARK Slack before resorting to this.

Auditing

You should always check your wallet after the disbursement runs to make sure that everything looks good. If you’re ever unsure or doubt the amounts, feel free to check out the audit logs. A new one is created every time you start the application and includes all information about how it calculated the numbers being presented. This file also contains the full API response body of each transaction sent (which includes the transaction id).

Partial audit log

Audit logs, the config file, and the cache live in the ~/.atbw directory.

Thank you to the ARK Community Fund for funding the initial build of this project. Giving all delegates access to easy payment management using True Block Weight.

If you would like to donate to future development or are a user and just want to say thanks you can donate ARK to the address below.

Ad3YELdf2wDS57MR7qQMGVLAL8cvzue9fh

--

--