HiveSQL: How to get delegations - Wie erhalte ich die Delegationen? #13

DE (EN below)

Im letzten Beitrag habe ich erklärt, wie man die Delegationen mit HiveJS auslesen kann. Diese Methode ist aber nicht empfehlenswert, weil es bei Nutzern mit sehr vielen Transaktionen sehr lange dauern kann.

Daher hier eine alternative: http://hivesql.io/

Was ist HiveSQL.io?

HiveSQL ist eine MSSQL-Datenbank mit den Daten der Hive-Blockchain. Die Daten sind dabei strukturiert in verschiedenen Tabellen gespeichert, sodass eine schnelle Abfrage von Daten möglich ist. Es ist somit nicht nötig, die ganze Blockchain zu durchsuchen.

Nutzung von HiveSQL

Die Nutzung ist für jeden frei, es bedarf nur einer einmaligen Registrierung mit einem HBD. Einfach 1 HBD an HiveSQL senden und wenige Sekunden später erhält man die Zugangsdaten zurück. Diese gelten so lange, bis das Proposal aktiv ist und die Finanzierung von HiveSQL somit gesichert ist.

Hier ist die Registrierung genau beschrieben.

hier könnt ihr für HiveSQL voten:
Vote for this proposal (#247) on Peakd.com
Vote for this proposal (#247) on Ecency
Vote for this proposal (#247) on Hive.blog
Vote for this Proposal (#247) using HiveSigner

Delegationen abfragen

Die Abfrage ist ganz simpel, mit dieser SQL Abfrage erhält man alle Delegationen, die @mein-senf-dazu aktuell erhalten hat:

    select * from delegations where delegatee='mein-senf-dazu'

Die Ausgabe erfolgt sofort, ohne große Wartezeit.

Wer diese Daten nun anderweitig nutzen will, müsste sich etwas erstellen, das diese Daten ausgibt, sodass man z.B. per Javascript darauf zugreifen kann.

Paar Abfragen

select sum(vests) from delegations


Mit dieser SQL Abfrage erhält man die Summer aller Delegationen in VEST

select delegatee,count(delegator) from delegations group by delegatee
order by count(delegator) desc

Mit dieser SQL Abfrage erhaltet ihr die Anzahl der Delegierenden pro User. @minnowbooster erhält aktuell von 1013 Nutzern eine Delegation, @ecency von 925 Nutzern.

select delegator,count(delegatee) from delegations group by delegator
order by count(delegatee)

Mit dieser Abfrage erhält man die Anzahl der Delegationen der Nutzer. In meinem letzten Beitrag hatte ich geschrieben, dass wohl kaum jemand an mehr als 1000 Nutzer etwas delegiert. Das muss ich jetzt revidieren. Tatsächlich gibt es 7 Nutzer, die an mehr als 1000 Nutzer etwas delegieren. @fireking delegiert sogar an 14075 Nutzer! Wahnsinn!

Zusammenfassung

Wer ganz schnell und sehr simpel Informationen von der Blockchain haben möchte, der kann diese mit der richtigen SQL Anweisung direkt von HiveSQL erhalten. Eine Registrierung lohnt sich für jeden, der etwas wissen will und sich mit SQL auskennt.

Du möchtest etwas Bestimmtes wissen und kennst dich aber nicht aus, dann schreib mir ein Kommentar, vielleicht kann ich es ja herausfinden.

Ich habe mir eben mal schnell alle Nachrichten mit verschlüsselter Memo ausgeben lassen und habe diese dann mit einem Script entschlüsselt.

Dadurch habe ich u.a. 2 Amazon Gutscheincodes gefunden, die ich noch nicht genutzt hatte ;)

EN

EN (EN below)

In the last post I explained how to read the delegations with HiveJS. However, this method is not recommended because it can take a long time for users with a lot of transactions.

So here is an alternative: http://hivesql.io/

What is HiveSQL.io?

HiveSQL is an MSSQL database with the data of the Hive blockchain. Here, the data is stored in a structured way in different tables, so that a quick query of data is possible. Thus, it is not necessary to search the entire blockchain.

Use of HiveSQL

It is free for everyone to use, it only requires a one-time registration with an HBD. Simply send 1 HBD to HiveSQL and a few seconds later you will receive your credentials back. These are valid until the proposal is active and thus the funding of HiveSQL is secured.

Here the registration is described in detail.

here you can vote for HiveSQL:
Vote for this proposal (#247) on Peakd.com
Vote for this proposal (#247) on Ecency
Vote for this proposal (#247) on Hive.blog
Vote for this proposal (#247) using HiveSigner

Query delegations

The query is quite simple, with this SQL query you get all delegations that @mein-senf-dazu has currently received:

    select * from delegations where delegatee='my-senf-dazu'

The output is immediate, without much waiting time.

If you want to use this data for other purposes, you have to create something that outputs this data, so that you can access it e.g. via Javascript.

Pair of queries

``sql
select sum(vests) from delegations

![](https://images.ecency.com/DQmbNpMZkRKrWFyWjqFo4Gc2omU3ZUiM8nAvt671UF8vdYY/grafik.png)
With this SQL query you get the sum of all delegations in VEST


``sql  
select delegatee,count(delegator) from delegations group by delegatee
order by count(delegator) desc

With this SQL query you get the number of delegators per user. @minnowbooster currently receives a delegation from 1013 users, @ecency from 925 users.

``sql
select delegator,count(delegatee) from delegations group by delegator
order by count(delegatee)

![](https://images.ecency.com/DQmTT2X5K46a1iV3yJqtNKucwwyKaSKLFNTF61C7aZZ2oXV/grafik.png)

With this query you get the number of delegations of the users. In my last [post](https://ecency.com/hive/@hive-coding/hivejs-how-to-get-delegations) I had written that hardly anyone delegates anything to more than 1000 users. I have to revise that now. In fact there are 7 users who delegate to more than 1000 users. @fireking even delegates to 14075 users! Awesome!

## Summary

If you want to get information from the blockchain very quickly and very simply, you can get it directly from HiveSQL with the right SQL statement. It's worth registering for anyone who wants to know something and knows SQL.

You want to know something specific but don't know your way around, drop me a comment and maybe I can figure it out.

I just had a quick look at all messages with encrypted memo and decrypted them with a script.

Thus I have found among other things 2 Amazon coupon codes that I had not yet used ;)

Translated with www.DeepL.com/Translator (free version)








0
0
0.000
6 comments
avatar

Followed and looking forward to your more posts. Hive basic level coding posts are already rare and you are doing them in this language is worth appreciation. !1UP

0
0
0.000