[Accusta for Steem] Export to csv, Block listener (v1.2.1)

in utopian-io •  5 months ago

https://github.com/semasping/Accusta - Accusta - this is a service with Statistic of Steem Accounts.

In 1.2.1 release of accusta_logo_line_170.png:

  • add block listener to search for various events in the blockchain
  • add function for sending tokens
  • update export to csv for Curation and Benefactor rewards

Accusta for Steem link: https://steemit.accusta.tk/

More detailed list:
5e6ca9a([update] csv export for curator rewards)
23523c7([add] csv export for benefactor rewards [add] csv export for curator rewards)
9e0e570([add] new queue settings for process author rewards)
b07e3e7([update] mongodb settings [add] test for tokenSend)
b650f74([add] block listener [add] command for get block [add] job for process blocks [add] model BchBlock for saving information about processed blocks)
668a84f([add] to blockchain api add new function getPost() for receiving posts from Blockchain [add] new wss servers to GOLOS node list)
b79ee14([add] to blockchain api add new function sendTokenToMany() for sending STEEM/SBD/GOLOS/GBG to any accounts)
1e6304d([fix] cleaning)
7ddc30d([add] to blockchain api add new function getOpsInBlock for receiving all operations from blocks)
4816cf1([add] to blockchain api add new function getOpsInBlock for receiving all operations from blocks)
f2e86fc([update] new articles)

More about block listner

Some time ago I had a telegram notifier bot, which was able to notify about various events that occurred in the blockchain.
But he was abandoned for various reasons. And now I decided to restore it as part of the Accusta system.
The listener of the blocks is necessary for catching events occurring in the blockchain.
There is command bch:get-block In https://github.com/semasping/Accusta/blob/master/app/Console/Commands/BchGetBlocks.php
which starts by cron every 10 minutes. It takes last_irreversible_block_num and processed the difference from last with the previous start. Then for each block, a separate job is run in a special queue https://github.com/semasping/Accusta/blob/master/app/Jobs/ProcessBchBlock.php.
And then in ProcessBchBlock is run more jobs for each event which need to be processed.

More about sending tokens

example of package sending tokens STEEM:

$accounts = [
    0 => [
        'to'=>'semasping',
        'amount'=>'0.001 STEEM',
        'memo'=>'test',
    ],
    1 => [
        'to'=>'semasping',
        'amount'=>'0.001 STEEM',
        'memo'=>'test2',
    ],
    2 => [
        'to'=>'semasping',
        'amount'=>'0.001 STEEM',
        'memo'=>'test3',
    ],
    3 => [
        'to'=>'semasping',
        'amount'=>'0.001 STEEM',
        'memo'=>'test4',
    ]
];
$from = 'semasping';
$key = getenv('STEEM_SEMASPING_ACTIVE_WIF');
//$key = getenv('GOLOS_SEMASPING_ACTIVE_WIF');
$result = \App\semas\SteemitApi::sendTokenToMany($accounts,$from,$key);
 echo $result // return block_num or false


Code for sending tokens are in https://github.com/semasping/Accusta/blob/1.2.1/app/semas/SteemitApi.php#L1097
Transactions sing are in https://github.com/t3ran13/php-graphene-node-client.
For ON broadcast in php-graphene-node-client I need to install some additional components and extensions on the server.

Installed components

  • automake
  • libtool
  • libgmp-dev

Installed extensions

  • secp256k1 (how to install secp256k1-php)
  • gmp

More about export to csv

Now data for export getting from mongodb:

$rewards = $this->getRewardsAll($acc);
return $this->exportToExcel($rewards->toArray(), 'CuratorRewards', $acc);

Where getRewardsAll() is different for each reward.
https://github.com/semasping/Accusta/blob/1.2.1/app/Http/Controllers/CuratorRewardsController.php#L285 - for curation rewards
https://github.com/semasping/Accusta/blob/1.2.1/app/Http/Controllers/BenefactorRewardsController.php#L397 - for benefactor rewards

Commits in this release:

Link to Comparing changes for this release: https://github.com/semasping/Accusta/compare/1.1.1...1.2.1

Plans for next releases:

  • Show separated lists of Posts and Comments
  • Add rewards for Post and Comments.
  • Add separated Charts for rewards by months for Post and Comment

Author`s GitHub Account https://github.com/semasping

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thanks for the contribution, @semasping! Large amount of work done, well done - keep it up!

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]

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

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

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

Vote for Utopian Witness!