2024-09-26 - Distriator - Script to get Distriator's business reviews from Hive Blockchain

in #hive-1395312 months ago

Updates on Project Distriator

Deep Dive into script to import reviews

import data - part one

const dhive = require("@hiveio/dhive");
const { dhiveClient } = require("../../utils/dhive");

async function importData() {
  const op = dhive.utils.operationOrders;
  const operationsBitmask = dhive.utils.makeBitMaskFilter([op.transfer]);
  let allRecords = [];
  let pageIndex = -1;
}
  • We add dhive & dhive client to the script
  • We get types of operation filters
  • We prepare a bitmask filter with transfer types

Get account history

  • Now, using dhive client, we get 1000 records of fund transfer.
  • With this, we'll get all transfers done via @thedistriator account.
const dhive = require("@hiveio/dhive");
const { dhiveClient } = require("../../utils/dhive");

async function importData() {
  const op = dhive.utils.operationOrders;
  const operationsBitmask = dhive.utils.makeBitMaskFilter([op.transfer]);
  let allRecords = [];
  let pageIndex = -1;
  let records = await client.database.getAccountHistory(
    "thedistriator",
    pageIndex,
    1000,
    operationsBitmask
  );
}

loop to get full transfer history

  • There can be more records than 1000.
  • So, we must go through full account history & find all transfers done.
const dhive = require("@hiveio/dhive");
const { dhiveClient } = require("../../utils/dhive");

async function importData() {
  const op = dhive.utils.operationOrders;
  const operationsBitmask = dhive.utils.makeBitMaskFilter([op.transfer]);
  let allRecords = [];
  let pageIndex = -1;
  while (true) {
    let records = await client.database.getAccountHistory(
      config.distriator.account ?? "thedistriator",
      pageIndex,
      1000,
      operationsBitmask
    );
    allRecords = [...allRecords, ...records];
    if (records.length === 1000) {
      let last = records[0];
      pageIndex = last[0] - 1;
      logger.info(`Last record is ${JSON.stringify(last)}`);
    } else {
      break;
    }
  }
}

filter out transfers using memo

  • Once you get all the records, filter records by memo containing text "You claimed back"
  • With this, you'll be able to identify the rewards given to consumers
  • From memo, grab the username & permlink.
  • In our next post, I'll illustrate how to obtain more data from hive blockchain

What's Next?

  • 🧪 Improvement - Allow business guides to edit businesses
  • 🧪 Improvement - Intuitive Dashboard - In Testing
  • ⏳ Address feedback provided for Intuitive Dashboard
  • 🧪 Build Leaderboard
  • ⏳ Address feedback provided for Leaderboard
  • ⏳ Review Management Module
  • Script to take backup
  • Script for restoration
  • Script to analyse HBD purchases of all consumers
  • For some users webapp isnt working as expected. So distribute Anroid App instead of WebApp
  • Update UX for Business Reviews
  • 🧪 Bug - Two finger Zoom out rotates the map
  • ⏳ Improvement - "Approach A Business" in drawer menu
  • ✋ R & D - Server Status using uptime-kuma
  • ✋ R & D - CloudFlare Tunnels
  • ✋ R & D - Putting data on chain
  • 🤔 R & D - Login with PolkaDot & DollarOnChain

Little bit of #sportstalk

Little bit of #sportstalk

  • I do remember walking more & to me it looks like it calculated less
  • In my opinion, Apple's health app is buggy.
  • It isn't tracking steps properly & I am thinking of getting a new fitness band to count steps properly.
  • Any way, I didn't achieve 10k milestone on this day as well.
  • Stay health, Stay fit.

Updates: Video Encoder Nodes

  • I'm running 12 powerful video encoder nodes for 3Speak Community Members.
  • Monthly internet bandwidth usage which exceeds 15 TB, Maintenance cost, Electricity backup, Internet backup, Depreciation cost - it's all on me.
  • On 2024-09-26, 3Speak published total 229 videos.
  • My video encoder nodes encoded 218 videos from 229 videos published.
  • It means, my encoder nodes encoded 95.20 % of total videos published on 2024-09-26

My Daily Hive Investment Report for 2024-09-26

ValueInvestment Type
0.000 HiveHive Power Up
26.200 HiveWitness Rewards in Hive Power
96.260 HiveCuration Rewards as Hive Power
6.370 HiveBenefactor Rewards as Hive Power
----
128.830 HiveTotal Hive Power Invested
----

Support @sagarkothari88

Vote sagarkothari88 as Hive Witness

Support @threespeak

Vote for 3Speak as Witness

Get paid for paying in HBD/Hive & SATs

https://distriator.com

Credits to designers - noakmilo & josegrech

image by noakmilo

banner of distriator by josegrech

Swap your HBD/Hive using @ecency

Sort:  

This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.

Do you know that you can earn a passive income by delegating to @indiaunited. We share more than 100 % of the curation rewards with the delegators in the form of IUC tokens. HP delegators and IUC token holders also get upto 20% additional vote weight.

Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.

image.png

100% of the rewards from this comment goes to the curator for their manual curation efforts. Please encourage the curator @bhattg by upvoting this comment and support the community by voting the posts made by @indiaunited..

This post received an extra 10.00% vote for delegating HP / holding IUC tokens.

Good afternoon and peace be upon us all. Quite an interesting article that I have shown and want to be of benefit to us all.For today, I hope we are all always in good health and success always for all of us.