Road to HiveFest #2

avatar


source

Wie ihr vielleicht schon bei @smooms gelesen habt, haben wir vor zum HiveFest7 zu fahren. Da das Leben als HiQ Redakteur und Herausgeber nicht gerade das einkommensstärkste ist, möchte ich mir durch Posts auf meinen Blog und natürlich durch die Arbeit an der HiQ das Ticket zum HiveFest erposten.

Diese und letzte Woche habe ich an einem Payout Tool für @miketr gearbeitet. Die Challenge ist es den liquid Tokenstand aller SLICENSE Halter zu tracken und regelmäßige Snapshots zu machen. Für alle, die SLICENSE nicht kennen, SLICENSE ist ein Anteils Token erstellt von @miketr. Jede liquide Token Anzahl stellt einen Anteil an einer bzw. zwei SPS Node Lizenzen dar. Und wöchentlich sollen dann die SPS und VOUCHER Rewards anteilig an alle Halter ausgezahlt werden.

Eine Formel dafür hat sich @miketr auch schon überlegt und diese ist bereits implementiert. Letzten Mittwoch habe ich schon einen Payout gemacht. Allerdings war dieser noch nicht automatisiert. D.h. ich habe das Skript noch manuell gestartet. Deshalb passe ich das Skript gerade an, um automatisiert Snapshots, Payouts und Tabellen für Statusposts zu machen.

Ich habe die letzten Tage ein paar Test Snapshots gemacht. Neben Accountnamen und Tokenanzahl speichere ich auch den Timestamp der Snapshoterstellung in einer Datenbanktabelle. Soweit die Idee. Wie ich die Daten aber anhand des Timestamps aus der Datenbank aus lese, musste ich mir noch überlegen.

Während einer ausgedehnten Jagdsession bei Monster Hunter Rise Sunbreak mit @smooms (Anm. v. @quekery: Wir mussten unbedingt Meisterrang 50 knacken ;)) kam mir die zündende Idee - Modulo. Ich konnte meine Begeisterung kaum darüber im Zaum halten mal wieder ein Beispiel gefunden zu haben, wo man Modulo Rechnung auf ein "echtes" Problem anwenden kann. Diese Euphorie war verantwortlich dafür, dass ich bei Anomalie Magnamalo gestorben bin. Jetzt kann ich nachempfinden wie es Fomochimedes ging.

Aber nochmal einen Schritt zurück. Für diejenigen, die nichts mit Timestamps anfangen können, sei auch das noch fix erklärt. Der Timestamp 0 ist am 01.01.1970 um 0:00. Mit jeder vergehenden Sekunde erhöht sich diese Zahl um 1. Den gestrigen Snapshot habe ich beispielsweise mit dem Timestamp 1658065636 gemacht. Falls ihr euch fragt was der Nutzen von Timestamps ist, man kann damit super rechnen. Und genau das wollen wir.

Da ich in meiner Datenbanktabelle verschiedene Timestamps habe, habe ich mir gedacht, dass es doch praktisch wäre diese nach Tagen filtern zu können. Meine Idee war es den den Timestamp vom Ende eines angebrochenen Tages zu bestimmen und dann die jeweiligen Timestamps in meiner Snapshottabelle davon abzuziehen. Ist das Ergebnis kleiner als 86400 (Anm. v. @queker: so viele Sekunden hat ein Tag. Wieder was gelernt, lool.), so war der Snapshot heute, ist das Ergebnis zwischen 86400 und 2.86400, war der Snapshot gestern etc..

Soweit so gut. Aber wie bestimme ich den Timestamp vom Ende eines angebrochenen Tages? Tja und hier kommt Modulo Rechnung ins Spiel. An dieser Stelle noch ne ganz kleine Erklärung was Modulo ist. Wenn ich zum Beispiel 30 modulo 7 rechne ist das Ergebnis 2. Modulo ist immer der Rest, der beim Teilen mit der jeweiligen Modulo Zahl entsteht.

Wenn mein Programm startet hole ich mir den aktuellen Timestamp. Diesen Timestamp rechne ich modulo 86400. Dieses Ergebnis ziehe ich vom aktuellen Timestamp ab und addiere anschließend 86400. In Python mit Beem sieht es dann so aus:

from beem.utils import formatToTimeStamp,formatTimeFromNow
    
n=formatToTimeStamp(formatTimeFromNow(secs=0))
r=n%86400
k=n-r+86400
print(k)

Auf dieser Seite könnt ihr Timestamps umrechnen.

Und wie heißt es so schön in einem alten Hunter Spruchwort:

"Probier es mal mit Modulo, dann wird Anomalie Magnamalo mondemisch." Weil sich aus Monsterreste erstklassige Palico Rüstungen herstellen lassen, logisch.

As you may have already read at @smooms, we are planning to go to HiveFest7. Since life as a HiQ editor and publisher isn't exactly the highest income, I'd like to earn my ticket to HiveFest by posting on my blog and of course working on HiQ.

This week and last week I've been working on a payout tool for @miketr. The challenge is to track the liquid token state of all SLICENSE holders and take snapshots. For those who don't know SLICENSE, SLICENSE is a share token created by @miketr. Each liquid token represents a share of one or two SPS Node licenses. And weekly SPS and VOUCHER Rewards are then to be paid out proportionally to all holders.

A formula for this has @miketr also already thought of and this is already implied. Last Wednesday I have already made a payout. However, this was not yet automated. I.e. I started the script still manually. Therefore I am currently adapting the script to do automated snapshots, payouts and tables for status posts.

I made some test snapshots the last days. Besides account name and token balance I also store the timestamp of the snapshot creation in a database table. So far the idea. But I had to think about how to read the data from the database based on the timestamp.

During an extended hunting session on Monster Hunter Rise Sunbreak with @smooms (note from @quekery: we had to crack master rank 50 ;)) I had the brilliant idea - modulo. I could hardly contain my excitement about having found yet another example where you can apply modulo calculation to a "real" problem. This euphoria was responsible for me dying to Anomaly Magnamalo. Now I can relate to how Fomochimedes felt.

But let's take another step back. For those who don't know anything about timestamps, this is also explained. The timestamp 0 is on 1970-01-01 at 0:00. With every passing second this number increases by 1. Yesterday's snapshot for example I made with the timestamp 1658065636. In case you wonder what the use of timestamps is, you can do great math with them. And that's exactly what we want.

Since I have different timestamps in my database table, I thought it would be handy to be able to filter them by days. My idea was to determine the timestamp from the end of a started day and then subtract the respective timestamps in my snapshot table. If the result is less than 86400 (note from @queker: that's how many seconds a day has. Learned something again, lool.), the snapshot was today, if the result is between 86400 and 2.86400, the snapshot was yesterday etc..

So far so good. But how do I determine the timestamp of the end of a day? Well, and this is where modulo calculation comes into play. At this point a small explanation what modulo is. If I calculate for example 30 modulo 7 the result is 2. Modulo is always the remainder, which arises when dividing with the respective modulo number.

When my program starts I get the current timestamp. I calculate this timestamp modulo 86400. I subtract this result from the current timestamp and then add 86400. In Python with Beem it looks like this:

from beem.utils import formatToTimeStamp,formatTimeFromNow
    
n=formatToTimeStamp(formatTimeFromNow(secs=0))
r=n%86400
k=n-r+86400
print(k)

On this page you can convert timestamps..

And as the old Hunter saying goes:

"Try modulo, and Anomaly Magnamalo goes mon-emic." Because monster scraps can be used to make top-notch Palico armor, logically.



0
0
0.000
24 comments
avatar

Viel Erfolg beim Sammeln. Ich spiele auch noch mit dem Gedanken nach Amsterdam zu fahren.

0
0
0.000
avatar

Dear @quekery, sorry to jump in a bit off topic but may I ask you to support the HiveBuzz proposal?
It recently lost its funding, is struggling to get back above the HBD stabilizer proposal, and is in dire need of help.
You can support it on Peakd, Ecency, Hive.blog or using HiveSigner.

On behalf of The HiveBuzz team, thank you!

0
0
0.000
avatar

Also Hivefest ist ja eigendlich täglich auf der Chain
Durch Leute wie Du die unkompliziert anderen wie mir helfen!
Vielen Dank nochmals!

$WINE with !LUV !PIZZA !PGM und !invest_vote

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 15 SBT tokens to @miketr, @quekery

remaining commands 3

BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!

The tokens that the command sends are: 0.1 PGM-0.1 LVL-2.5 BUDS-0.01 MOTA-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]

5000 PGM IN STAKE = 2x rewards!

image.png
Discord image.png

Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP

Get potential votes from @ pgm-curator by paying in PGM, here is a guide

I'm a bot, if you want a hand ask @ zottone444


0
0
0.000
avatar

Danke, viele der Engage Token funktionieren nur, wenn man maximal 3 benutzt und BEER sogar nur alleine.

!PIZZA !hivebits !PGM

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 15 SBT tokens to @miketr

remaining commands 0

BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!

The tokens that the command sends are: 0.1 PGM-0.1 LVL-2.5 BUDS-0.01 MOTA-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]

5000 PGM IN STAKE = 2x rewards!

image.png
Discord image.png

Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP

Get potential votes from @ pgm-curator by paying in PGM, here is a guide

I'm a bot, if you want a hand ask @ zottone444


0
0
0.000
avatar
(Edited)

PIZZA! PIZZA! PIZZA! PIZZA!

PIZZA Holders sent $PIZZA tips in this post's comments:
der-prophet tipped quekery (x1)
miketr tipped quekery (x1)
quekery tipped miketr (x1)
@quekery(1/15) tipped @steevc (x1)

You can now send $PIZZA tips in Discord via tip.cc!

0
0
0.000
avatar
(Edited)

!WINE
!WITZ
!PIZZA

0
0
0.000
avatar

Darf ich das Kleid im Schaufenster probieren?
Nein, bitte in der Umkleidekabine.

Credit: burn950
@quekery, ich habe dir im Namen von @der-prophet einen $LOLZ Token gesendet
Verwende den Befehl !WITZ oder !LOOL, um einen Witz und ein $LOLZ zu teilen.
Use the !LOL or !LOLZ command to share a joke and an $LOLZ
.(1/6)

0
0
0.000
avatar

Danke, viele der Engage Token funktionieren nur, wenn man maximal 3 benutzt und BEER sogar nur alleine.

!BEER

0
0
0.000
avatar

Stimmt
!BEER verträgt keine anderen Spirituosen 😇

0
0
0.000
avatar

I'll see you in Amsterdam. It's going to be great.

!BEER

0
0
0.000
avatar

The hype train is near moon ^^

!PIZZA

0
0
0.000
avatar

Congratulations @quekery! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You got more than 2250 replies.
Your next target is to reach 2500 replies.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hivebuzz supports the HiveFest⁷ Travel Reimbursement Fund.
Our Hive Power Delegations to the July PUM Winners
Feedback from the August 1st Hive Power Up Day
Support the HiveBuzz project. Vote for our proposal!
0
0
0.000