Development Log for arikado gridcoin pool #2

in #utopian-io6 years ago

Repository

https://github.com/sau412/arikado_gridcoin_pool

Introduction

Here is changes, that were promised in project introduction roadmap section:

  • Big graphs
  • Faucet
  • Mobile version

And other changes also made:

  • Set transaction id for alternative currencies
  • Gridcoin rate from different source
  • Project structure
  • QR code generator

Details

Project folder structure

Let's start from project folder structure. List of files become bigger than my screen. Also I discovered vulnerability: if php not installed (or detached from apache), settings.php (which contain passwords and tokens) is available for everyone.

Now project split between several folders. Only one folder is available from web:

  • web, which has files, available from web
  • lib, with libraries
  • tasks, which contain scheduled tasks

Web interfaces are:

  • index.php - main page, user interface
  • tasks.php - tasks information
  • graph.php - view big graph
  • qr.php - QR code generator
  • setup.php - setup script (needed once)
  • common.css, mobile.css - stylesheets
  • common.js - scripts
  • get_project_config.php, rpc.php - BOINC manager interfaces

Libraries are:

  • auth.php - security and user register, log in, log out functions
  • billing.php - calculates rewards
  • boincmgr.php - core functions
  • canvas.php - graphs
  • db.php - database function
  • email.php - email functions
  • html.php - biggest library, return HTML code for interfaces
  • language.php - pool messages, for various language support in future
  • result_parser.php - import tasks data from BOINC project web pages
  • settings.php - project settings, now not in web-accessible folder
  • xml_parser.php - parse XML from user, instead of built-in php functions

Tasks are:

  • faucet_send_rewards.php - send pool faucet rewards
  • send_rewards.php - send pool mining rewards
  • update_blocks.php - update blockchain from gridcoin client
  • update_graphs.php - update graphs cache
  • update_projects.php - load project stats from BOINC project sites via RPC
  • update_rates.php - update cryptocurrencies rates
  • update_task_stats.php - update tasks stats from BOINC project without RPC

Interface call path:

  • User requests main page
  • index.php send you template of the page (without information block), and javascript
  • javascript checks anchor (part of the URL after #) then loads data with jQuery from index.php with 'json' parameter
  • index.php call function from html.php for HTML block
  • html.php generates HTML block
  • index.php returns the block
  • javascript shows than blocks and waits for user actions

User action call path (e.g. if user clicks button):

  • User requests index.php with POST or GET query with 'action' parameter.
  • index.php check access rights with auth.php, then call action
  • Redirect user to index.php with message
QR code generator

Generates QR code from given string. Using 'qrencode' command from linux console. Also check is string valid (because security)

Result looks like png image of QR code:
Link: https://grc.arikado.ru/qr.php?str=SDRJWNWezDp6aNGV8m9YchwKPKZ6kLRFRH
qr.png

Used in next feature.

Set transaction id function

Transaction id is a form of payment evidence.

Before that function I went to phpmyadmin and set transaction identifier manually in database. Now it can be done with web interface. That feauture available only for administrator.

Changes:

  • html.php generates HTML form (commit)
  • boincmgr.php do action (commit)
  • index.php handles action (commit)
  • language.php got new message (commit)

Web interface:

Usually I send altcoins from phone, now I can scan address with phone.

Gridcoin rate from different source

Previously I got gridcoin exchange rate from poloniex, cryptocurrency exchange platform. Now that platform removed gridcoin. Thus I need gridcoin exchange rate from different exchange. Now it bittrex.

Exchange data stored in SQL table 'boincmgr_variables' by update_rates.php (commit)

That feature is not visible directly, but used in reward calculations.

Also results are visible in currency exchange rates page: https://grc.arikado.ru/#currencies

Big graphs

Now you can click on small graph and see big graph.

How it implemended:

  • graph.php receive project, host and/or user parameters (commit)
  • canvas.php generates big graph (commit)
  • then graph is received by user

Small graph, data for a week:

Click!

Big graph, data for a month:

You can try it by youself here: https://grc.arikado.ru/#pool_stats
Also you can get direct link to graph: https://grc.arikado.ru/graph.php?project_uid=25

Faucet

As I mentioned in project introdunction, faucet can attract more users to the pool.

Implementation required several changes to start working:

  • New SQL table boincmgr_faucet with who, when and how much information (commit)
  • New SQL table boincmgr_faucet_payout with address, transaction id and timestamp information (same commit)
  • settings.php variable with amount (commit)
  • language.php with message for user (commit)
  • html.php should generate form (commit)
  • index.php should show that form (commit)
  • index.php should execute user action (commit)
  • boincmgr.php should validate claim and add payout data to table (commit)
  • faucet_send_rewards.php tasks sends reward via RPC (commit)

If user mining with that pool, he can press button for claim reward:

If user not contributing enough, message is different:

Mobile version

I cannot do own implementation of browser checking, because it takes too much time and requires uncommon devices to check page in. I used solution found on stackexchange. It determines, is page viewed from mobile browser. If browser mobile, then mobile.css is used. Main difference is font size, vertical menu and tables.

There are two files changed to create mobile version:

  • HTML library html.php (commit)
  • Cascade stylesheet for mobile version mobile.css (commit)

When user opens site from phone, he get mobile version:
IMG_4255.PNG
Tables also vertical:
IMG_4258.PNG

'Request desktop version' feature on iPhone also works:
IMG_4257.PNG

Github issue with that enhansement is closed now: https://github.com/sau412/arikado_gridcoin_pool/issues/6

Roadmap correction

Not needed anymore:

  • Project suggestion - World Community Grid is most profitable project now for CPU mining, because it rewarded with two currencies: gridcoin and byteball. About 100 times more profitable than the others.

Next changes are:

  • Add email unsubsribe, password recovery, notices for admin.
  • Video instructions (like grcpool's)
  • User can add notes to his host
  • Admin can add notes to projects and users
  • Wallet status page. Should provide information about wallet status.
  • News section

Resources

Series Backlinks

Sort:  

Thanks for the contribution, @sau412! The features you've added are very cool, especially the clickable graphs.

Since you have so many commits it would maybe be better to create pull requests instead, so you have a better overview of the changes (also easier for us to review!). There are some minor inconsistencies in your code that could probably be solved by using a linter, but other than those it looks great - good work!


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @amosbastian!

So far this week you've reviewed 6 contributions. Keep up the good work!

This post received a courtesy vote from @gridcoin-booster! Thank you for your contribution to the #gridcoin community!

Hey, @sau412!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Hi @sau412!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.033
BTC 64266.94
ETH 3077.24
USDT 1.00
SBD 3.87