create account

Development Log for arikado gridcoin pool #2 by sau412

View this thread on: hive.blogpeakd.comecency.com
@sau412
$90.84
Development Log for arikado gridcoin pool #2
#### Repository
https://github.com/sau412/arikado_gridcoin_pool

#### Introduction
Here is changes, that were promised in [project introduction](https://steemit.com/utopian-io/@sau412/project-introduction-for-arikado-gridcoin-pool) 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)
* Single file qr.php ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/75a9f6285ea0181375962174da8ebf510c788b13))

Result looks like png image of QR code:
Link: https://grc.arikado.ru/qr.php?str=SDRJWNWezDp6aNGV8m9YchwKPKZ6kLRFRH
![qr.png](https://cdn.steemitimages.com/DQmXHJh2BMtiBKzdnSS65pg9znz2SDtmk1ZpRQyYtRAon4e/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](https://github.com/sau412/arikado_gridcoin_pool/commit/bbf5c39110b1612274d0e312137b1e6cadd47dd4))
* boincmgr.php do action ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/ada9f53a4ff839035738744911ce73f51f52a74d))
* index.php handles action ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/f0ae30255d4efad516eb076e49939d4a12aee349))
* language.php got new message ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/9e6d34b1e1a9b9667459604c4339c1afc6b07a93))

Web interface:
![](https://cdn.steemitimages.com/DQmYuMMpxkMm4UwfHSaVQ6B63gyB6vuUmWmcj8gLexAca9u/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png)

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](https://github.com/sau412/arikado_gridcoin_pool/commit/a1dc53c6bf8335664ed81211d50f0bef70cbd1f3))

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
![](https://cdn.steemitimages.com/DQmfGEZx4x1Y8poYz9rEK3v7qf39U8eMsrF8R93TqDAA1zj/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png)

##### 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](https://github.com/sau412/arikado_gridcoin_pool/commit/cad7b8481050868527babe494e3792345309f96c))
* canvas.php generates big graph ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/cad7b8481050868527babe494e3792345309f96c))
* then graph is received by user

Small graph, data for a week:
![](https://cdn.steemitimages.com/DQmWv9a4nrGnYkMoZbeuUzqACmiZdbpM3U2kWxxc1BNiWsM/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png)

Click!

Big graph, data for a month:
![](https://cdn.steemitimages.com/DQmWSYao7gusvFnqarvLHuvrBBL19wxA7gRpsj1JkXHSC1Y/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png)

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](https://github.com/sau412/arikado_gridcoin_pool/commit/02463b7768d711cc1dbd4bff01182fa05ab2fefd))
* New SQL table boincmgr_faucet_payout with address, transaction id and timestamp information ([same commit](https://github.com/sau412/arikado_gridcoin_pool/commit/02463b7768d711cc1dbd4bff01182fa05ab2fefd))
* settings.php variable with amount ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/46516487541723460a28cd675a54bd9990e10037))
* language.php with message for user ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/9e6d34b1e1a9b9667459604c4339c1afc6b07a93))
* html.php should generate form ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/3435020dc72eca8b94de725b4416fb7faf90efd6))
* index.php should show that form ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/e884e95e39f742384358969d99fa8938d986331f))
* index.php should execute user action ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/07c3cdb5f9c49316500ac414cb97c6d28dc2fecd))
* boincmgr.php should validate claim and add payout data to table ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/cebe9650e407d57c634d8ad364318b37c7e8a08d))
* faucet_send_rewards.php tasks sends reward via RPC ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/b2535d1c953689163f843d4544ecff539c6a540b))

If user mining with that pool, he can press button for claim reward:
![](https://cdn.steemitimages.com/DQmVRtC1bTu62y63e7pyU6nDL8G15iGsiUKv5bmBPL3Soq3/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png)

If user not contributing enough, message is different:
![](https://cdn.steemitimages.com/DQmYTW1qHJWhqWfFkHbkagXHyfJDyJg2FRJgxKVSYPTgSF1/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png)

##### 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](https://github.com/sau412/arikado_gridcoin_pool/commit/de79af63b9d187592be329581a19d012ce8a98e0))
* Cascade stylesheet for mobile version mobile.css ([commit](https://github.com/sau412/arikado_gridcoin_pool/commit/16414da902153294e7cc753b97c0e9f71b0dc765))

When user opens site from phone, he get mobile version:
![IMG_4255.PNG](https://cdn.steemitimages.com/DQmbUKUzTpG9hjLoXZ1AyMK3VVMWzcVybNnoQfF7GqHqYzp/IMG_4255.PNG)
Tables also vertical:
![IMG_4258.PNG](https://cdn.steemitimages.com/DQmUbd2Fuv2rb77TBhueJgM9A9Jx6CujWgYCGVyS6pmQzpi/IMG_4258.PNG)

'Request desktop version' feature on iPhone also works:
![IMG_4257.PNG](https://cdn.steemitimages.com/DQmP29mDrtWDZkf5ScsM19rEFUU94uKpg8F1jJ14C2njTJJ/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
* Pool itself https://grc.arikado.ru/ or https://gridcoinpool.ru/
* New version is marked as v1.2 ([github link](https://github.com/sau412/arikado_gridcoin_pool/releases/tag/v1.2))
* How request mobile version works ([link](https://stackoverflow.com/questions/11702453/how-does-chromes-request-desktop-site-option-work))
* Stackexchange mobile version checker: ([link](https://stackoverflow.com/questions/4117555/simplest-way-to-detect-a-mobile-device))
* Official Gridcoin site: https://gridcoin.us/
* Bittrex API ([link](https://support.bittrex.com/hc/en-us/articles/115003723911-Developer-s-Guide-API))

#### Series Backlinks
* [Development log #1 ](https://steemit.com/utopian-io/@sau412/development-log-for-arikado-gridcoin-pool)
* [Project introduction](https://steemit.com/utopian-io/@sau412/project-introduction-for-arikado-gridcoin-pool)
馃憤  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorsau412
permlinkdevelopment-log-for-arikado-gridcoin-pool-2
categoryutopian-io
json_metadata{"tags":["utopian-io","blog","gridcoin","pool","development"],"image":["https://cdn.steemitimages.com/DQmXHJh2BMtiBKzdnSS65pg9znz2SDtmk1ZpRQyYtRAon4e/qr.png","https://cdn.steemitimages.com/DQmYuMMpxkMm4UwfHSaVQ6B63gyB6vuUmWmcj8gLexAca9u/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png","https://cdn.steemitimages.com/DQmfGEZx4x1Y8poYz9rEK3v7qf39U8eMsrF8R93TqDAA1zj/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png","https://cdn.steemitimages.com/DQmWv9a4nrGnYkMoZbeuUzqACmiZdbpM3U2kWxxc1BNiWsM/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png","https://cdn.steemitimages.com/DQmWSYao7gusvFnqarvLHuvrBBL19wxA7gRpsj1JkXHSC1Y/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png","https://cdn.steemitimages.com/DQmVRtC1bTu62y63e7pyU6nDL8G15iGsiUKv5bmBPL3Soq3/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png","https://cdn.steemitimages.com/DQmYTW1qHJWhqWfFkHbkagXHyfJDyJg2FRJgxKVSYPTgSF1/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png","https://cdn.steemitimages.com/DQmbUKUzTpG9hjLoXZ1AyMK3VVMWzcVybNnoQfF7GqHqYzp/IMG_4255.PNG","https://cdn.steemitimages.com/DQmUbd2Fuv2rb77TBhueJgM9A9Jx6CujWgYCGVyS6pmQzpi/IMG_4258.PNG","https://cdn.steemitimages.com/DQmP29mDrtWDZkf5ScsM19rEFUU94uKpg8F1jJ14C2njTJJ/IMG_4257.PNG"],"links":["https://github.com/sau412/arikado_gridcoin_pool","https://steemit.com/utopian-io/@sau412/project-introduction-for-arikado-gridcoin-pool","https://github.com/sau412/arikado_gridcoin_pool/commit/75a9f6285ea0181375962174da8ebf510c788b13","https://grc.arikado.ru/qr.php?str=SDRJWNWezDp6aNGV8m9YchwKPKZ6kLRFRH","https://github.com/sau412/arikado_gridcoin_pool/commit/bbf5c39110b1612274d0e312137b1e6cadd47dd4","https://github.com/sau412/arikado_gridcoin_pool/commit/ada9f53a4ff839035738744911ce73f51f52a74d","https://github.com/sau412/arikado_gridcoin_pool/commit/f0ae30255d4efad516eb076e49939d4a12aee349","https://github.com/sau412/arikado_gridcoin_pool/commit/9e6d34b1e1a9b9667459604c4339c1afc6b07a93","https://github.com/sau412/arikado_gridcoin_pool/commit/a1dc53c6bf8335664ed81211d50f0bef70cbd1f3","https://grc.arikado.ru/#currencies","https://github.com/sau412/arikado_gridcoin_pool/commit/cad7b8481050868527babe494e3792345309f96c","https://grc.arikado.ru/#pool_stats","https://grc.arikado.ru/graph.php?project_uid=25","https://github.com/sau412/arikado_gridcoin_pool/commit/02463b7768d711cc1dbd4bff01182fa05ab2fefd","https://github.com/sau412/arikado_gridcoin_pool/commit/46516487541723460a28cd675a54bd9990e10037","https://github.com/sau412/arikado_gridcoin_pool/commit/3435020dc72eca8b94de725b4416fb7faf90efd6","https://github.com/sau412/arikado_gridcoin_pool/commit/e884e95e39f742384358969d99fa8938d986331f","https://github.com/sau412/arikado_gridcoin_pool/commit/07c3cdb5f9c49316500ac414cb97c6d28dc2fecd","https://github.com/sau412/arikado_gridcoin_pool/commit/cebe9650e407d57c634d8ad364318b37c7e8a08d","https://github.com/sau412/arikado_gridcoin_pool/commit/b2535d1c953689163f843d4544ecff539c6a540b","https://github.com/sau412/arikado_gridcoin_pool/commit/de79af63b9d187592be329581a19d012ce8a98e0","https://github.com/sau412/arikado_gridcoin_pool/commit/16414da902153294e7cc753b97c0e9f71b0dc765","https://github.com/sau412/arikado_gridcoin_pool/issues/6","https://grc.arikado.ru/","https://gridcoinpool.ru/","https://github.com/sau412/arikado_gridcoin_pool/releases/tag/v1.2","https://stackoverflow.com/questions/11702453/how-does-chromes-request-desktop-site-option-work","https://stackoverflow.com/questions/4117555/simplest-way-to-detect-a-mobile-device","https://gridcoin.us/","https://support.bittrex.com/hc/en-us/articles/115003723911-Developer-s-Guide-API","https://steemit.com/utopian-io/@sau412/development-log-for-arikado-gridcoin-pool"],"app":"steemit/0.1","format":"markdown"}
created2018-10-11 09:27:33
last_update2018-10-11 09:27:33
depth0
children5
last_payout2018-10-18 09:27:33
cashout_time1969-12-31 23:59:59
total_payout_value68.370 HBD
curator_payout_value22.469 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length10,859
author_reputation8,198,119,818,978
root_title"Development Log for arikado gridcoin pool #2"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,062,349
net_rshares64,394,859,909,797
author_curate_reward""
vote details (46)
@amosbastian
$9.59
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](https://join.utopian.io/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](https://review.utopian.io/result/3/1212222).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
馃憤  , , , , , , , , , ,
properties (23)
authoramosbastian
permlinkre-sau412-development-log-for-arikado-gridcoin-pool-2-20181012t102118069z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["sau412"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/3/1212222","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-10-12 10:21:18
last_update2018-10-12 10:21:18
depth1
children1
last_payout2018-10-19 10:21:18
cashout_time1969-12-31 23:59:59
total_payout_value7.235 HBD
curator_payout_value2.354 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length923
author_reputation174,473,586,900,705
root_title"Development Log for arikado gridcoin pool #2"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,137,307
net_rshares6,989,441,642,903
author_curate_reward""
vote details (11)
@utopian-io
Thank you for your review, @amosbastian!

So far this week you've reviewed 6 contributions. Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-sau412-development-log-for-arikado-gridcoin-pool-2-20181012t102118069z-20181017t102657z
categoryutopian-io
json_metadata"{"app": "beem/0.20.1"}"
created2018-10-17 10:27:00
last_update2018-10-17 10:27:00
depth2
children0
last_payout2018-10-24 10:27:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length114
author_reputation152,955,367,999,756
root_title"Development Log for arikado gridcoin pool #2"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,470,837
net_rshares0
@gridcoin-booster
$0.04
This post received a courtesy vote from @gridcoin-booster! Thank you for your contribution to the #gridcoin community!
馃憤  , ,
properties (23)
authorgridcoin-booster
permlinkre-sau412-development-log-for-arikado-gridcoin-pool-2-20181011t103610692z
categoryutopian-io
json_metadata{"tags":["utopian-io","gridcoin"],"users":["gridcoin-booster"],"app":"steemit/0.1"}
created2018-10-11 10:36:12
last_update2018-10-11 10:36:12
depth1
children0
last_payout2018-10-18 10:36:12
cashout_time1969-12-31 23:59:59
total_payout_value0.029 HBD
curator_payout_value0.009 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length118
author_reputation206,584,707,024
root_title"Development Log for arikado gridcoin pool #2"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,065,369
net_rshares28,675,225,101
author_curate_reward""
vote details (3)
@steem-ua
#### 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](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-development-log-for-arikado-gridcoin-pool-2-20181012t102853z
categoryutopian-io
json_metadata"{"app": "beem/0.20.7"}"
created2018-10-12 10:28:54
last_update2018-10-12 10:28:54
depth1
children0
last_payout2018-10-19 10:28:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length285
author_reputation23,214,230,978,060
root_title"Development Log for arikado gridcoin pool #2"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,137,662
net_rshares0
@utopian-io
Hey, @sau412!

**Thanks for contributing on Utopian**.
We鈥檙e 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](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

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

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
馃憤  
properties (23)
authorutopian-io
permlinkre-development-log-for-arikado-gridcoin-pool-2-20181017t102539z
categoryutopian-io
json_metadata"{"app": "beem/0.20.1"}"
created2018-10-17 10:25:42
last_update2018-10-17 10:25:42
depth1
children0
last_payout2018-10-24 10:25:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length588
author_reputation152,955,367,999,756
root_title"Development Log for arikado gridcoin pool #2"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,470,762
net_rshares2,550,379,961
author_curate_reward""
vote details (1)